lkml.org 
[lkml]   [2012]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Incorrect uses of get_driver()/put_driver()
On Tue, 10 Jan 2012, Sebastian Ott wrote:

> [PATCH] cio: remove {get,put}_driver
>
> Remove useless {get,put}_driver - the caller of the functions
> has to ensure valid driver pointers.
>
> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> ---
> drivers/s390/cio/ccwgroup.c | 2 --
> drivers/s390/cio/device.c | 8 +-------
> 2 files changed, 1 insertion(+), 9 deletions(-)
>
> --- a/drivers/s390/cio/ccwgroup.c
> +++ b/drivers/s390/cio/ccwgroup.c
> @@ -580,7 +580,6 @@ void ccwgroup_driver_unregister(struct c
> struct device *dev;
>
> /* We don't want ccwgroup devices to live longer than their driver. */
> - get_driver(&cdriver->driver);
> while ((dev = driver_find_device(&cdriver->driver, NULL, NULL,
> __ccwgroup_match_all))) {
> struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
> @@ -592,7 +591,6 @@ void ccwgroup_driver_unregister(struct c
> mutex_unlock(&gdev->reg_mutex);
> put_device(dev);
> }
> - put_driver(&cdriver->driver);
> driver_unregister(&cdriver->driver);
> }
> EXPORT_SYMBOL(ccwgroup_driver_unregister);
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -1676,15 +1676,9 @@ struct ccw_device *get_ccwdev_by_busid(s
> const char *bus_id)
> {
> struct device *dev;
> - struct device_driver *drv;
>
> - drv = get_driver(&cdrv->driver);
> - if (!drv)
> - return NULL;
> -
> - dev = driver_find_device(drv, NULL, (void *)bus_id,
> + dev = driver_find_device(&cdrv->driver, NULL, (void *)bus_id,
> __ccwdev_check_busid);
> - put_driver(drv);
>
> return dev ? to_ccwdev(dev) : NULL;
> }

Thanks Sebastian and everybody else. It looks like there's no reason
not to simply remove get_driver() and put_driver(), so I'll do just
that. This patch can be part of the job -- unless someone else wants
to commit it first.

To avoid possible conflicts, I'll wait until after the merge window
closes and things stabilize a little before posting any changes.

Alan Stern



\
 
 \ /
  Last update: 2012-01-10 21:35    [W:0.071 / U:3.428 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site