[PATCH 10/10] osduld: No need to use dev_set_drvdata on embedded devices

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

 



This is a micro optimization patch on cold path code.
Use container_of() on embedded device instead of using
dev_set_drvdata. Also makes code structure more clear.

Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
---
 drivers/scsi/osd/osd_uld.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index 0484bae..0a90702 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -246,7 +246,8 @@ struct find_oud_t {
 
 int _mach_odi(struct device *dev, void *find_data)
 {
-	struct osd_uld_device *oud = dev_get_drvdata(dev);
+	struct osd_uld_device *oud = container_of(dev, struct osd_uld_device,
+						  class_dev);
 	struct find_oud_t *fot = find_data;
 	const struct osd_dev_info *odi = fot->odi;
 
@@ -367,7 +368,8 @@ static int __detect_osd(struct osd_uld_device *oud)
 
 static void __remove(struct device *dev)
 {
-	struct osd_uld_device *oud = dev_get_drvdata(dev);
+	struct osd_uld_device *oud = container_of(dev, struct osd_uld_device,
+						  class_dev);
 	struct scsi_device *scsi_device = oud->od.scsi_device;
 
 	kfree(oud->odi.osdname);
@@ -461,7 +463,6 @@ static int osd_probe(struct device *dev)
 	oud->class_dev.class = &osd_uld_class;
 	oud->class_dev.parent = dev;
 	oud->class_dev.release = __remove;
-	dev_set_drvdata(&oud->class_dev, oud);
 	error = dev_set_name(&oud->class_dev, disk->disk_name);
 	if (error) {
 		OSD_ERR("dev_set_name failed => %d\n", error);
-- 
1.6.5.2


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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux