public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org
Cc: Robert Love <robert.w.love@intel.com>
Subject: [PATCH 14/17] libfc, fcoe: Remove unnecessary cast by removing inline wrapper
Date: Fri, 06 Feb 2009 10:57:04 -0800	[thread overview]
Message-ID: <20090206185704.26188.79425.stgit@fritz> (raw)
In-Reply-To: <20090206185548.26188.51580.stgit@fritz>

Comment from "Andrew Morton <akpm@linux-foundation.org>"

> +{
> +     return (struct fcoe_softc *)lport_priv(lp);

unneeded/undesirable cast of void*.  There are probably zillions of
instances of this - there always are.

This whole inline function was unnecessary. The FCoE layer knows
that it's data structure is stored in the lport private data, it
can just access it from lport_priv().

Signed-off-by: Robert Love <robert.w.love@intel.com>
---

 drivers/scsi/fcoe/fcoe_sw.c |    2 +-
 drivers/scsi/fcoe/libfcoe.c |   12 ++++++------
 include/scsi/libfcoe.h      |    8 +-------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sw.c b/drivers/scsi/fcoe/fcoe_sw.c
index b5b2abf..91bae90 100644
--- a/drivers/scsi/fcoe/fcoe_sw.c
+++ b/drivers/scsi/fcoe/fcoe_sw.c
@@ -298,7 +298,7 @@ static int fcoe_sw_destroy(struct net_device *netdev)
 	if (!lp)
 		return -ENODEV;
 
-	fc = fcoe_softc(lp);
+	fc = lport_priv(lp);
 
 	/* Logout of the fabric */
 	fc_fabric_logoff(lp);
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index e76e4f6..5dae859 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -387,7 +387,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
 
 	WARN_ON((fr_len(fp) % sizeof(u32)) != 0);
 
-	fc = fcoe_softc(lp);
+	fc = lport_priv(lp);
 	/*
 	 * if it is a flogi then we need to learn gw-addr
 	 * and my own fcid
@@ -770,7 +770,7 @@ static int fcoe_check_wait_queue(struct fc_lport *lp)
 	struct sk_buff *skb;
 	struct fcoe_softc *fc;
 
-	fc = fcoe_softc(lp);
+	fc = lport_priv(lp);
 	spin_lock_bh(&fc->fcoe_pending_queue.lock);
 
 	/*
@@ -807,7 +807,7 @@ static void fcoe_insert_wait_queue_head(struct fc_lport *lp,
 {
 	struct fcoe_softc *fc;
 
-	fc = fcoe_softc(lp);
+	fc = lport_priv(lp);
 	spin_lock_bh(&fc->fcoe_pending_queue.lock);
 	__skb_queue_head(&fc->fcoe_pending_queue, skb);
 	spin_unlock_bh(&fc->fcoe_pending_queue.lock);
@@ -825,7 +825,7 @@ static void fcoe_insert_wait_queue(struct fc_lport *lp,
 {
 	struct fcoe_softc *fc;
 
-	fc = fcoe_softc(lp);
+	fc = lport_priv(lp);
 	spin_lock_bh(&fc->fcoe_pending_queue.lock);
 	__skb_queue_tail(&fc->fcoe_pending_queue, skb);
 	spin_unlock_bh(&fc->fcoe_pending_queue.lock);
@@ -1115,7 +1115,7 @@ MODULE_PARM_DESC(destroy, "Destroy fcoe port");
  */
 int fcoe_link_ok(struct fc_lport *lp)
 {
-	struct fcoe_softc *fc = fcoe_softc(lp);
+	struct fcoe_softc *fc = lport_priv(lp);
 	struct net_device *dev = fc->real_dev;
 	struct ethtool_cmd ecmd = { ETHTOOL_GSET };
 	int rc = 0;
@@ -1331,7 +1331,7 @@ int fcoe_hostlist_add(const struct fc_lport *lp)
 
 	fc = fcoe_hostlist_lookup_softc(fcoe_netdev(lp));
 	if (!fc) {
-		fc = fcoe_softc(lp);
+		fc = lport_priv(lp);
 		write_lock_bh(&fcoe_hostlist_lock);
 		list_add_tail(&fc->list, &fcoe_hostlist);
 		write_unlock_bh(&fcoe_hostlist_lock);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 89fdbb9..f43d383 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -58,16 +58,10 @@ struct fcoe_softc {
 	u8 address_mode;
 };
 
-static inline struct fcoe_softc *fcoe_softc(
-	const struct fc_lport *lp)
-{
-	return (struct fcoe_softc *)lport_priv(lp);
-}
-
 static inline struct net_device *fcoe_netdev(
 	const struct fc_lport *lp)
 {
-	return fcoe_softc(lp)->real_dev;
+	return ((struct fcoe_softc *)lport_priv(lp))->real_dev;
 }
 
 static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)


  parent reply	other threads:[~2009-02-06 18:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-06 18:55 [PATCH 00/17] Open-FCoE Updates Robert Love
2009-02-06 18:55 ` [PATCH 01/17] libfc: fixed a read IO data integrity issue when a IO data frame lost Robert Love
2009-02-06 18:55 ` [PATCH 02/17] fcoe: exch mgr is freed while lport still retrying sequences Robert Love
2009-02-06 18:56 ` [PATCH 03/17] libfc: Don't violate transport template for rogue port creation Robert Love
2009-02-06 18:56 ` [PATCH 04/17] libfc: correct RPORT_TO_PRIV usage Robert Love
2009-02-06 18:56 ` [PATCH 05/17] libfc: rename rp to rdata in fc_disc_new_target() Robert Love
2009-02-06 18:56 ` [PATCH 06/17] libfc: check for err when recv and state is incorrect Robert Love
2009-02-06 18:56 ` [PATCH 07/17] fcoe: runtime debugging with debug_logging module parameter Robert Love
2009-02-06 18:56 ` [PATCH 08/17] fcoe: Logging review changes Robert Love
2009-02-06 18:56 ` [PATCH 09/17] libfc: runtime debugging with debug_logging module parameter Robert Love
2009-02-06 18:56 ` [PATCH 10/17] libfc: Logging review changes Robert Love
2009-02-06 18:56 ` [PATCH 11/17] libfc: Cleanup libfc_function_template comments Robert Love
2009-02-06 18:56 ` [PATCH 12/17] libfc, fcoe: Fix kerneldoc comments Robert Love
2009-02-06 18:56 ` [PATCH 13/17] libfc, fcoe: Cleanup function formatting and minor typos Robert Love
2009-02-06 18:57 ` Robert Love [this message]
2009-02-06 18:57 ` [PATCH 15/17] fcoe: Use setup_timer() and mod_timer() Robert Love
2009-02-06 18:57 ` [PATCH 16/17] fcoe: Correct fcoe_transports initialization vs. registration Robert Love
2009-02-06 18:57 ` [PATCH 17/17] [SCSI] fcoe: fix kfree(skb) Robert Love
2009-02-26  2:49 ` [PATCH 00/17] Open-FCoE Updates Mike Christie
2009-02-26 18:29   ` Robert Love
2009-02-26 19:05     ` James Bottomley
2009-02-26 19:54       ` Love, Robert W
2009-03-02 22:24       ` Love, Robert W

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=20090206185704.26188.79425.stgit@fritz \
    --to=robert.w.love@intel.com \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.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