Snap for 9421047 from 031ea788a9
to android12-5.10-keystone-qcom-release
Change-Id: Ibc0eeec52e265cbecfa1b32b5ce347f8071c9120
This commit is contained in:
commit
897411a3f5
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#ifndef __GENKSYMS__
|
||||
#include <linux/dma-buf.h>
|
||||
#include <linux/rmap.h>
|
||||
#endif
|
||||
|
||||
|
@ -142,15 +142,21 @@ void dma_buf_uninit_sysfs_statistics(void)
|
||||
kset_unregister(dma_buf_stats_kset);
|
||||
}
|
||||
|
||||
struct dma_buf_create_sysfs_entry {
|
||||
struct dma_buf *dmabuf;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
union dma_buf_create_sysfs_work_entry {
|
||||
struct dma_buf_create_sysfs_entry create_entry;
|
||||
struct dma_buf_sysfs_entry sysfs_entry;
|
||||
};
|
||||
|
||||
static void sysfs_add_workfn(struct work_struct *work)
|
||||
{
|
||||
/* The ABI would have to change for this to be false, but let's be paranoid. */
|
||||
_Static_assert(sizeof(struct kobject) >= sizeof(struct work_struct),
|
||||
"kobject is smaller than work_struct");
|
||||
|
||||
struct dma_buf_sysfs_entry *sysfs_entry =
|
||||
container_of((struct kobject *)work, struct dma_buf_sysfs_entry, kobj);
|
||||
struct dma_buf *dmabuf = sysfs_entry->dmabuf;
|
||||
struct dma_buf_create_sysfs_entry *create_entry =
|
||||
container_of(work, struct dma_buf_create_sysfs_entry, work);
|
||||
struct dma_buf *dmabuf = create_entry->dmabuf;
|
||||
|
||||
/*
|
||||
* A dmabuf is ref-counted via its file member. If this handler holds the only
|
||||
@ -161,6 +167,7 @@ static void sysfs_add_workfn(struct work_struct *work)
|
||||
* is released, and that can't happen until the end of this function.
|
||||
*/
|
||||
if (file_count(dmabuf->file) > 1) {
|
||||
dmabuf->sysfs_entry->dmabuf = dmabuf;
|
||||
/*
|
||||
* kobject_init_and_add expects kobject to be zero-filled, but we have populated it
|
||||
* to trigger this work function.
|
||||
@ -185,8 +192,8 @@ static void sysfs_add_workfn(struct work_struct *work)
|
||||
|
||||
int dma_buf_stats_setup(struct dma_buf *dmabuf)
|
||||
{
|
||||
struct dma_buf_sysfs_entry *sysfs_entry;
|
||||
struct work_struct *work;
|
||||
struct dma_buf_create_sysfs_entry *create_entry;
|
||||
union dma_buf_create_sysfs_work_entry *work_entry;
|
||||
|
||||
if (!dmabuf || !dmabuf->file)
|
||||
return -EINVAL;
|
||||
@ -196,21 +203,18 @@ int dma_buf_stats_setup(struct dma_buf *dmabuf)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sysfs_entry = kmalloc(sizeof(struct dma_buf_sysfs_entry), GFP_KERNEL);
|
||||
if (!sysfs_entry)
|
||||
work_entry = kmalloc(sizeof(union dma_buf_create_sysfs_work_entry), GFP_KERNEL);
|
||||
if (!work_entry)
|
||||
return -ENOMEM;
|
||||
|
||||
sysfs_entry->dmabuf = dmabuf;
|
||||
dmabuf->sysfs_entry = sysfs_entry;
|
||||
dmabuf->sysfs_entry = &work_entry->sysfs_entry;
|
||||
|
||||
/*
|
||||
* The use of kobj as a work_struct is an ugly hack
|
||||
* to avoid an ABI break in this frozen kernel.
|
||||
*/
|
||||
work = (struct work_struct *)&dmabuf->sysfs_entry->kobj;
|
||||
INIT_WORK(work, sysfs_add_workfn);
|
||||
create_entry = &work_entry->create_entry;
|
||||
create_entry->dmabuf = dmabuf;
|
||||
|
||||
INIT_WORK(&create_entry->work, sysfs_add_workfn);
|
||||
get_dma_buf(dmabuf); /* This reference will be dropped in sysfs_add_workfn. */
|
||||
schedule_work(work);
|
||||
schedule_work(&create_entry->work);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -906,18 +906,6 @@ static void uvc_function_unbind(struct usb_configuration *c,
|
||||
uvcg_dbg(f, "done waiting with ret: %ld\n", wait_ret);
|
||||
}
|
||||
|
||||
/* If we know we're connected via v4l2, then there should be a cleanup
|
||||
* of the device from userspace either via UVC_EVENT_DISCONNECT or
|
||||
* though the video device removal uevent. Allow some time for the
|
||||
* application to close out before things get deleted.
|
||||
*/
|
||||
if (uvc->func_connected) {
|
||||
uvcg_dbg(f, "waiting for clean disconnect\n");
|
||||
wait_ret = wait_event_interruptible_timeout(uvc->func_connected_queue,
|
||||
uvc->func_connected == false, msecs_to_jiffies(500));
|
||||
uvcg_dbg(f, "done waiting with ret: %ld\n", wait_ret);
|
||||
}
|
||||
|
||||
device_remove_file(&uvc->vdev.dev, &dev_attr_function_name);
|
||||
video_unregister_device(&uvc->vdev);
|
||||
v4l2_device_unregister(&uvc->v4l2_dev);
|
||||
|
@ -11,13 +11,7 @@
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
#ifdef __GENKSYMS__
|
||||
struct dma_buf_sysfs_entry;
|
||||
#else
|
||||
/* struct dma_buf_sysfs_entry */
|
||||
#include <linux/dma-buf.h>
|
||||
#endif
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_dma_buf_stats_teardown,
|
||||
TP_PROTO(struct dma_buf_sysfs_entry *sysfs_entry, bool *skip_sysfs_release),
|
||||
TP_ARGS(sysfs_entry, skip_sysfs_release), 1);
|
||||
|
Loading…
Reference in New Issue
Block a user