Messages in this thread Patch in this message | | | From | Dmitry Torokhov <> | Subject | Re: [PATCH 2.6.10-rc1 2/5] driver-model: bus_recan_devices() locking fix | Date | Tue, 9 Nov 2004 23:17:31 -0500 |
| |
On Tuesday 09 November 2004 07:40 pm, Greg KH wrote: > > I think we just have lay down the rules that one needs to get a reference > > to an object in the following cases: > > - object creation (first reference) > > - linking some other object to the object in question. Every link to the > > ? object should increase reference count. > > - before passing object to another thread of execution to guarantee that > > ? the object will live long enough for both threads. > > The rules are defined. ?See my OLS 2004 paper on krefs for details. >
So that means you will patches like the one below, right?
-- Dmitry
===================================================================
ChangeSet@1.1964, 2004-11-09 23:14:31-05:00, dtor_core@ameritech.net Driver core: remove unnecessary get_driver/put_driver from driver.c Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
driver.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-)
===================================================================
diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c --- a/drivers/base/driver.c 2004-11-09 23:16:43 -05:00 +++ b/drivers/base/driver.c 2004-11-09 23:16:43 -05:00 @@ -26,13 +26,7 @@ int driver_create_file(struct device_driver * drv, struct driver_attribute * attr) { - int error; - if (get_driver(drv)) { - error = sysfs_create_file(&drv->kobj, &attr->attr); - put_driver(drv); - } else - error = -EINVAL; - return error; + return sysfs_create_file(&drv->kobj, &attr->attr); } @@ -44,10 +38,7 @@ void driver_remove_file(struct device_driver * drv, struct driver_attribute * attr) { - if (get_driver(drv)) { - sysfs_remove_file(&drv->kobj, &attr->attr); - put_driver(drv); - } + sysfs_remove_file(&drv->kobj, &attr->attr); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |