Re: [PATCH] Driver Core patches for 2.6.9-rc1

From: Greg KH
Date: Wed Aug 25 2004 - 18:23:17 EST


ChangeSet 1.1803.64.5, 2004/08/23 13:17:08-07:00, greg@xxxxxxxxx

KREF: make kref_get() return void as it makes sense to do so.

Thanks to Kiran for bugging me to do this.

Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/scsi/sd.c | 4 +---
drivers/scsi/sr.c | 4 +---
include/linux/kref.h | 2 +-
lib/kref.c | 3 +--
4 files changed, 4 insertions(+), 9 deletions(-)


diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c 2004-08-25 14:56:03 -07:00
+++ b/drivers/scsi/sd.c 2004-08-25 14:56:03 -07:00
@@ -180,8 +180,7 @@
if (disk->private_data == NULL)
goto out;
sdkp = scsi_disk(disk);
- if (!kref_get(&sdkp->kref))
- goto out_sdkp;
+ kref_get(&sdkp->kref);
if (scsi_device_get(sdkp->device))
goto out_put;
up(&sd_ref_sem);
@@ -189,7 +188,6 @@

out_put:
kref_put(&sdkp->kref, scsi_disk_release);
- out_sdkp:
sdkp = NULL;
out:
up(&sd_ref_sem);
diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
--- a/drivers/scsi/sr.c 2004-08-25 14:56:03 -07:00
+++ b/drivers/scsi/sr.c 2004-08-25 14:56:03 -07:00
@@ -140,15 +140,13 @@
if (disk->private_data == NULL)
goto out;
cd = scsi_cd(disk);
- if (!kref_get(&cd->kref))
- goto out_null;
+ kref_get(&cd->kref);
if (scsi_device_get(cd->device))
goto out_put;
goto out;

out_put:
kref_put(&cd->kref, sr_kref_release);
- out_null:
cd = NULL;
out:
up(&sr_ref_sem);
diff -Nru a/include/linux/kref.h b/include/linux/kref.h
--- a/include/linux/kref.h 2004-08-25 14:56:03 -07:00
+++ b/include/linux/kref.h 2004-08-25 14:56:03 -07:00
@@ -23,7 +23,7 @@
};

void kref_init(struct kref *kref);
-struct kref *kref_get(struct kref *kref);
+void kref_get(struct kref *kref);
void kref_put(struct kref *kref, void (*release) (struct kref *kref));

#endif /* _KREF_H_ */
diff -Nru a/lib/kref.c b/lib/kref.c
--- a/lib/kref.c 2004-08-25 14:56:03 -07:00
+++ b/lib/kref.c 2004-08-25 14:56:03 -07:00
@@ -27,11 +27,10 @@
* kref_get - increment refcount for object.
* @kref: object.
*/
-struct kref *kref_get(struct kref *kref)
+void kref_get(struct kref *kref)
{
WARN_ON(!atomic_read(&kref->refcount));
atomic_inc(&kref->refcount);
- return kref;
}

/**

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/