All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Swen Schillig <swen@vnet.ibm.com>,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 06/13] zfcp: Simplify get_adapter_by_busid
Date: Wed, 01 Oct 2008 12:42:19 +0200	[thread overview]
Message-ID: <20081001104800.675874000@de.ibm.com> (raw)
In-Reply-To: 20081001104213.585200000@de.ibm.com

[-- Attachment #1: zfcp_ccw_by_busid.diff --]
[-- Type: text/plain, Size: 2209 bytes --]

From: Swen Schillig <swen@vnet.ibm.com>

Call the helper function from cio instead looping through all zfcp
adapters.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---
 drivers/s390/scsi/zfcp_aux.c |   13 -------------
 drivers/s390/scsi/zfcp_ccw.c |   17 +++++++++++++++++
 drivers/s390/scsi/zfcp_ext.h |    1 +
 3 files changed, 18 insertions(+), 13 deletions(-)

--- a/drivers/s390/scsi/zfcp_aux.c	2008-09-30 13:51:03.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_aux.c	2008-09-30 13:51:20.000000000 +0200
@@ -106,19 +106,6 @@ static int __init zfcp_device_setup(char
 	return 0;
 }
 
-static struct zfcp_adapter *zfcp_get_adapter_by_busid(char *bus_id)
-{
-	struct zfcp_adapter *adapter;
-
-	list_for_each_entry(adapter, &zfcp_data.adapter_list_head, list)
-		if ((strncmp(bus_id, adapter->ccw_device->dev.bus_id,
-			     BUS_ID_SIZE) == 0) &&
-		    !(atomic_read(&adapter->status) &
-		      ZFCP_STATUS_COMMON_REMOVE))
-		    return adapter;
-	return NULL;
-}
-
 static void __init zfcp_init_device_configure(void)
 {
 	struct zfcp_adapter *adapter;
--- a/drivers/s390/scsi/zfcp_ccw.c	2008-09-30 13:50:29.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_ccw.c	2008-09-30 13:51:20.000000000 +0200
@@ -224,3 +224,20 @@ int __init zfcp_ccw_register(void)
 {
 	return ccw_driver_register(&zfcp_ccw_driver);
 }
+
+/**
+ * zfcp_get_adapter_by_busid - find zfcp_adapter struct
+ * @busid: bus id string of zfcp adapter to find
+ */
+struct zfcp_adapter *zfcp_get_adapter_by_busid(char *busid)
+{
+	struct ccw_device *ccw_device;
+	struct zfcp_adapter *adapter = NULL;
+
+	ccw_device = get_ccwdev_by_busid(&zfcp_ccw_driver, busid);
+	if (ccw_device) {
+		adapter = dev_get_drvdata(&ccw_device->dev);
+		put_device(&ccw_device->dev);
+	}
+	return adapter;
+}
--- a/drivers/s390/scsi/zfcp_ext.h	2008-09-30 13:51:03.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_ext.h	2008-09-30 13:51:20.000000000 +0200
@@ -27,6 +27,7 @@ extern int zfcp_sg_setup_table(struct sc
 
 /* zfcp_ccw.c */
 extern int zfcp_ccw_register(void);
+extern struct zfcp_adapter *zfcp_get_adapter_by_busid(char *);
 
 /* zfcp_cfdc.c */
 extern struct miscdevice zfcp_cfdc_misc;

-- 

  parent reply	other threads:[~2008-10-01 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01 10:42 [patch 00/13] zfcp updates for 2.6.28 Christof Schmitt
2008-10-01 10:42 ` [patch 01/13] zfcp: add queue_full sysfs attribute Christof Schmitt
2008-10-01 10:42 ` [patch 02/13] zfcp: Update message with input from review Christof Schmitt
2008-10-01 10:42 ` [patch 03/13] zfcp: remove unused references, declarations and flags Christof Schmitt
2008-10-01 10:42 ` [patch 04/13] zfcp: attach and release SAN nameserver port on demand Christof Schmitt
2008-10-01 10:42 ` [patch 05/13] zfcp: remove all typedefs and replace them with standards Christof Schmitt
2008-10-01 10:42 ` Christof Schmitt [this message]
2008-10-01 10:42 ` [patch 07/13] zfcp: Simplify zfcp data structures Christof Schmitt
2008-10-01 10:42 ` [patch 08/13] zfcp: put threshold data in hba trace Christof Schmitt
2008-10-01 10:42 ` [patch 09/13] zfcp: deadlock via shared work queue tasks Christof Schmitt
2008-10-01 10:42 ` [patch 10/13] zfcp: prevent fc_remote_port_delete calls for unregistered rport Christof Schmitt
2008-10-01 10:42 ` [patch 11/13] zfcp: fix erp list usage without using locks Christof Schmitt
2008-10-01 10:42 ` [patch 12/13] zfcp: wait on SCSI work to be finished before proceeding with init dev Christof Schmitt
2008-10-01 10:42 ` [patch 13/13] zfcp: fix double dbf id usage Christof Schmitt

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=20081001104800.675874000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=swen@vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.