Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@SteelEye.com>,
	open-osd <osd-dev@open-osd.org>,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH 10/10] osduld: No need to use dev_set_drvdata on embedded devices
Date: Tue, 17 Nov 2009 15:50:59 +0200	[thread overview]
Message-ID: <4B02AA43.4010407@panasas.com> (raw)
In-Reply-To: <4B019BEC.3080909@panasas.com>


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@panasas.com>
---
 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



  parent reply	other threads:[~2009-11-17 13:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-16 18:37 [PATCHES 0/9] osd patches for 2.6.33 merge window - resend Boaz Harrosh
2009-11-16 18:39 ` [PATCH 1/9] libosd: osd_dev_is_ver1 - Minor API cleanup Boaz Harrosh
2009-11-16 18:41 ` [PATCH 2/9] libosd: osd_sense: OSD_CFO_PERMISSIONS Boaz Harrosh
2009-11-16 18:44 ` [PATCH 3/9] osduld: Ref-counting bug fix Boaz Harrosh
2009-11-16 18:45 ` [PATCH 4/9] osduld: Use device->release instead of internal kref Boaz Harrosh
2009-11-16 19:52   ` James Bottomley
2009-11-16 18:45 ` [PATCH 5/9] libosd: osd_dev_info: Unique Identification of an OSD device Boaz Harrosh
2009-11-16 18:47 ` [PATCH 6/9] libosd: bug in osd_req_decode_sense_full() Boaz Harrosh
2009-11-16 18:47 ` [PATCH 7/9] libosd: Bugfix of error handling in attributes-list decoding Boaz Harrosh
2009-11-16 18:48 ` [PATCH 8/9] libosd: Error handling revamped Boaz Harrosh
2009-11-16 18:49 ` [PATCH 9/9] osd_protocol.h: Add missing #include Boaz Harrosh
2009-11-16 18:57   ` Martin Michlmayr
2009-11-16 19:01     ` Boaz Harrosh
2009-11-16 19:09       ` Martin Michlmayr
2009-11-16 20:01       ` James Bottomley
2009-11-17  7:54         ` Boaz Harrosh
2009-11-17 13:50 ` Boaz Harrosh [this message]
2009-11-23 16:34 ` [osd-dev] [PATCHES 0/9] osd patches for 2.6.33 merge window - resend Boaz Harrosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B02AA43.4010407@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=osd-dev@open-osd.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox