Skip to content

Commit fc47ff6

Browse files
Robert Lovejejb
authored andcommitted
[SCSI] libfc, fcoe: Remove unnecessary cast by removing inline wrapper
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> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
1 parent b2ab99c commit fc47ff6

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

‎drivers/scsi/fcoe/fcoe_sw.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int fcoe_sw_destroy(struct net_device *netdev)
297297
if (!lp)
298298
return -ENODEV;
299299

300-
fc = fcoe_softc(lp);
300+
fc = lport_priv(lp);
301301

302302
/* Logout of the fabric */
303303
fc_fabric_logoff(lp);

‎drivers/scsi/fcoe/libfcoe.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
387387

388388
WARN_ON((fr_len(fp) % sizeof(u32)) != 0);
389389

390-
fc = fcoe_softc(lp);
390+
fc = lport_priv(lp);
391391
/*
392392
* if it is a flogi then we need to learn gw-addr
393393
* and my own fcid
@@ -768,7 +768,7 @@ static int fcoe_check_wait_queue(struct fc_lport *lp)
768768
struct sk_buff *skb;
769769
struct fcoe_softc *fc;
770770

771-
fc = fcoe_softc(lp);
771+
fc = lport_priv(lp);
772772
spin_lock_bh(&fc->fcoe_pending_queue.lock);
773773

774774
/*
@@ -805,7 +805,7 @@ static void fcoe_insert_wait_queue_head(struct fc_lport *lp,
805805
{
806806
struct fcoe_softc *fc;
807807

808-
fc = fcoe_softc(lp);
808+
fc = lport_priv(lp);
809809
spin_lock_bh(&fc->fcoe_pending_queue.lock);
810810
__skb_queue_head(&fc->fcoe_pending_queue, skb);
811811
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
@@ -823,7 +823,7 @@ static void fcoe_insert_wait_queue(struct fc_lport *lp,
823823
{
824824
struct fcoe_softc *fc;
825825

826-
fc = fcoe_softc(lp);
826+
fc = lport_priv(lp);
827827
spin_lock_bh(&fc->fcoe_pending_queue.lock);
828828
__skb_queue_tail(&fc->fcoe_pending_queue, skb);
829829
spin_unlock_bh(&fc->fcoe_pending_queue.lock);
@@ -1113,7 +1113,7 @@ MODULE_PARM_DESC(destroy, "Destroy fcoe port");
11131113
*/
11141114
int fcoe_link_ok(struct fc_lport *lp)
11151115
{
1116-
struct fcoe_softc *fc = fcoe_softc(lp);
1116+
struct fcoe_softc *fc = lport_priv(lp);
11171117
struct net_device *dev = fc->real_dev;
11181118
struct ethtool_cmd ecmd = { ETHTOOL_GSET };
11191119
int rc = 0;
@@ -1329,7 +1329,7 @@ int fcoe_hostlist_add(const struct fc_lport *lp)
13291329

13301330
fc = fcoe_hostlist_lookup_softc(fcoe_netdev(lp));
13311331
if (!fc) {
1332-
fc = fcoe_softc(lp);
1332+
fc = lport_priv(lp);
13331333
write_lock_bh(&fcoe_hostlist_lock);
13341334
list_add_tail(&fc->list, &fcoe_hostlist);
13351335
write_unlock_bh(&fcoe_hostlist_lock);

‎include/scsi/libfcoe.h‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,10 @@ struct fcoe_softc {
5858
u8 address_mode;
5959
};
6060

61-
static inline struct fcoe_softc *fcoe_softc(
62-
const struct fc_lport *lp)
63-
{
64-
return (struct fcoe_softc *)lport_priv(lp);
65-
}
66-
6761
static inline struct net_device *fcoe_netdev(
6862
const struct fc_lport *lp)
6963
{
70-
return fcoe_softc(lp)->real_dev;
64+
return ((struct fcoe_softc *)lport_priv(lp))->real_dev;
7165
}
7266

7367
static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)

0 commit comments

Comments
 (0)