Re: [PATCH 01/10] staging: gasket: save struct device for a gasket device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 26, 2018 at 08:07:28PM -0700, Todd Poynor wrote:
> From: Todd Poynor <toddpoynor@xxxxxxxxxx>
> 
> Save the struct device pointer to a gasket device in gasket's metadata,
> to facilitate use of standard logging calls and in anticipation of
> non-PCI gasket devices in the future.
> 
> Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx>
> ---
>  drivers/staging/gasket/gasket_core.c | 5 +++--
>  drivers/staging/gasket/gasket_core.h | 3 +++
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index 732218773c3c6..e8f3b021c20d1 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -450,6 +450,7 @@ static int gasket_alloc_dev(
>  	gasket_dev->internal_desc = internal_desc;
>  	gasket_dev->dev_idx = dev_idx;
>  	snprintf(gasket_dev->kobj_name, GASKET_NAME_MAX, "%s", kobj_name);
> +	gasket_dev->dev = parent;

Normally when saving off a pointer to an object that you reference later
on, and that you rely on, you need to grab a reference to it, otherwise
it may disappear at any point in time.

However this whole "wrap the pci layer" nonsense is a total mess with
the lifetime rules of devices, so it's probably the least of your
worries....

As long as you know you will have to fix that crud up, and what you are
doing here will bite you if you do not do it right, that's fine with
me...

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux