Skip to content

Commit eeb7cd5

Browse files
committed
[netdevice] Remove netdev_priv() helper function
Some network device drivers use the trivial netdev_priv() helper function while others use the netdev->priv pointer directly. Standardise on direct use of netdev->priv, in order to free up the function name netdev_priv() for reuse. Signed-off-by: Michael Brown <[email protected]>
1 parent 0aa2e4e commit eeb7cd5

23 files changed

+182
-193
lines changed

src/drivers/net/3c90x.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static int a3c90x_setup_tx_ring(struct INF_3C90X *p)
272272
*/
273273
static void a3c90x_process_tx_packets(struct net_device *netdev)
274274
{
275-
struct INF_3C90X *p = netdev_priv(netdev);
275+
struct INF_3C90X *p = netdev->priv;
276276
unsigned int downlist_ptr;
277277

278278
DBGP("a3c90x_process_tx_packets\n");
@@ -320,7 +320,7 @@ static void a3c90x_free_tx_ring(struct INF_3C90X *p)
320320
static int a3c90x_transmit(struct net_device *netdev,
321321
struct io_buffer *iob)
322322
{
323-
struct INF_3C90X *inf_3c90x = netdev_priv(netdev);
323+
struct INF_3C90X *inf_3c90x = netdev->priv;
324324
struct TXD *tx_cur_desc;
325325
struct TXD *tx_prev_desc;
326326

@@ -518,7 +518,7 @@ static void a3c90x_process_rx_packets(struct net_device *netdev)
518518
{
519519
int i;
520520
unsigned int rx_status;
521-
struct INF_3C90X *p = netdev_priv(netdev);
521+
struct INF_3C90X *p = netdev->priv;
522522
struct RXD *rx_cur_desc;
523523

524524
DBGP("a3c90x_process_rx_packets\n");
@@ -567,7 +567,7 @@ static void a3c90x_process_rx_packets(struct net_device *netdev)
567567
*/
568568
static void a3c90x_poll(struct net_device *netdev)
569569
{
570-
struct INF_3C90X *p = netdev_priv(netdev);
570+
struct INF_3C90X *p = netdev->priv;
571571
uint16_t raw_status, int_status;
572572

573573
DBGP("a3c90x_poll\n");
@@ -611,7 +611,7 @@ static void a3c90x_free_resources(struct INF_3C90X *p)
611611
static void a3c90x_remove(struct pci_device *pci)
612612
{
613613
struct net_device *netdev = pci_get_drvdata(pci);
614-
struct INF_3C90X *inf_3c90x = netdev_priv(netdev);
614+
struct INF_3C90X *inf_3c90x = netdev->priv;
615615

616616
DBGP("a3c90x_remove\n");
617617

@@ -628,7 +628,7 @@ static void a3c90x_remove(struct pci_device *pci)
628628

629629
static void a3c90x_irq(struct net_device *netdev, int enable)
630630
{
631-
struct INF_3C90X *p = netdev_priv(netdev);
631+
struct INF_3C90X *p = netdev->priv;
632632

633633
DBGP("a3c90x_irq\n");
634634

@@ -657,7 +657,7 @@ static void a3c90x_hw_start(struct net_device *netdev)
657657
unsigned int cfg;
658658
unsigned int mopt;
659659
unsigned short linktype;
660-
struct INF_3C90X *inf_3c90x = netdev_priv(netdev);
660+
struct INF_3C90X *inf_3c90x = netdev->priv;
661661

662662
DBGP("a3c90x_hw_start\n");
663663

@@ -796,7 +796,7 @@ static void a3c90x_hw_start(struct net_device *netdev)
796796
static int a3c90x_open(struct net_device *netdev)
797797
{
798798
int rc;
799-
struct INF_3C90X *inf_3c90x = netdev_priv(netdev);
799+
struct INF_3C90X *inf_3c90x = netdev->priv;
800800

801801
DBGP("a3c90x_open\n");
802802

@@ -845,7 +845,7 @@ static int a3c90x_open(struct net_device *netdev)
845845
*/
846846
static void a3c90x_close(struct net_device *netdev)
847847
{
848-
struct INF_3C90X *inf_3c90x = netdev_priv(netdev);
848+
struct INF_3C90X *inf_3c90x = netdev->priv;
849849

850850
DBGP("a3c90x_close\n");
851851

@@ -895,7 +895,7 @@ static int a3c90x_probe(struct pci_device *pci)
895895
pci_set_drvdata(pci, netdev);
896896
netdev->dev = &pci->dev;
897897

898-
inf_3c90x = netdev_priv(netdev);
898+
inf_3c90x = netdev->priv;
899899
memset(inf_3c90x, 0, sizeof(*inf_3c90x));
900900

901901
adjust_pci_device(pci);

src/drivers/net/atl1e.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
173173
static int atl1e_mdio_read(struct net_device *netdev, int phy_id __unused,
174174
int reg_num)
175175
{
176-
struct atl1e_adapter *adapter = netdev_priv(netdev);
176+
struct atl1e_adapter *adapter = netdev->priv;
177177
u16 result;
178178

179179
atl1e_read_phy_reg(&adapter->hw, reg_num & MDIO_REG_ADDR_MASK, &result);
@@ -183,7 +183,7 @@ static int atl1e_mdio_read(struct net_device *netdev, int phy_id __unused,
183183
static void atl1e_mdio_write(struct net_device *netdev, int phy_id __unused,
184184
int reg_num, int val)
185185
{
186-
struct atl1e_adapter *adapter = netdev_priv(netdev);
186+
struct atl1e_adapter *adapter = netdev->priv;
187187

188188
atl1e_write_phy_reg(&adapter->hw, reg_num & MDIO_REG_ADDR_MASK, val);
189189
}
@@ -841,7 +841,7 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter)
841841
*/
842842
static void atl1e_poll(struct net_device *netdev)
843843
{
844-
struct atl1e_adapter *adapter = netdev_priv(netdev);
844+
struct atl1e_adapter *adapter = netdev->priv;
845845
struct atl1e_hw *hw = &adapter->hw;
846846
int max_ints = 64;
847847
u32 status;
@@ -963,7 +963,7 @@ static void atl1e_tx_queue(struct atl1e_adapter *adapter, u16 count __unused,
963963

964964
static int atl1e_xmit_frame(struct net_device *netdev, struct io_buffer *iob)
965965
{
966-
struct atl1e_adapter *adapter = netdev_priv(netdev);
966+
struct atl1e_adapter *adapter = netdev->priv;
967967
u16 tpd_req = 1;
968968
struct atl1e_tpd_desc *tpd;
969969

@@ -1013,7 +1013,7 @@ int atl1e_up(struct atl1e_adapter *adapter)
10131013

10141014
void atl1e_irq(struct net_device *netdev, int enable)
10151015
{
1016-
struct atl1e_adapter *adapter = netdev_priv(netdev);
1016+
struct atl1e_adapter *adapter = netdev->priv;
10171017

10181018
if (enable)
10191019
atl1e_irq_enable(adapter);
@@ -1051,7 +1051,7 @@ void atl1e_down(struct atl1e_adapter *adapter)
10511051
*/
10521052
static int atl1e_open(struct net_device *netdev)
10531053
{
1054-
struct atl1e_adapter *adapter = netdev_priv(netdev);
1054+
struct atl1e_adapter *adapter = netdev->priv;
10551055
int err;
10561056

10571057
/* allocate rx/tx dma buffer & descriptors */
@@ -1086,7 +1086,7 @@ static int atl1e_open(struct net_device *netdev)
10861086
*/
10871087
static void atl1e_close(struct net_device *netdev)
10881088
{
1089-
struct atl1e_adapter *adapter = netdev_priv(netdev);
1089+
struct atl1e_adapter *adapter = netdev->priv;
10901090

10911091
atl1e_down(adapter);
10921092
atl1e_free_ring_resources(adapter);
@@ -1138,7 +1138,7 @@ static int atl1e_probe(struct pci_device *pdev)
11381138

11391139
atl1e_init_netdev(netdev, pdev);
11401140

1141-
adapter = netdev_priv(netdev);
1141+
adapter = netdev->priv;
11421142
adapter->bd_number = cards_found;
11431143
adapter->netdev = netdev;
11441144
adapter->pdev = pdev;
@@ -1227,7 +1227,7 @@ static int atl1e_probe(struct pci_device *pdev)
12271227
static void atl1e_remove(struct pci_device *pdev)
12281228
{
12291229
struct net_device *netdev = pci_get_drvdata(pdev);
1230-
struct atl1e_adapter *adapter = netdev_priv(netdev);
1230+
struct atl1e_adapter *adapter = netdev->priv;
12311231

12321232
unregister_netdev(netdev);
12331233
atl1e_free_ring_resources(adapter);

src/drivers/net/b44.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ static void b44_load_mac_and_phy_addr(struct b44_private *bp)
622622

623623
static void b44_set_rx_mode(struct net_device *netdev)
624624
{
625-
struct b44_private *bp = netdev_priv(netdev);
625+
struct b44_private *bp = netdev->priv;
626626
unsigned char zero[6] = { 0, 0, 0, 0, 0, 0 };
627627
u32 val;
628628
int i;
@@ -667,7 +667,7 @@ static int b44_probe(struct pci_device *pci)
667667
netdev->dev = &pci->dev;
668668

669669
/* Set up private data */
670-
bp = netdev_priv(netdev);
670+
bp = netdev->priv;
671671
memset(bp, 0, sizeof(*bp));
672672
bp->netdev = netdev;
673673
bp->pci = pci;
@@ -712,7 +712,7 @@ static int b44_probe(struct pci_device *pci)
712712
static void b44_remove(struct pci_device *pci)
713713
{
714714
struct net_device *netdev = pci_get_drvdata(pci);
715-
struct b44_private *bp = netdev_priv(netdev);
715+
struct b44_private *bp = netdev->priv;
716716

717717
ssb_core_disable(bp);
718718
unregister_netdev(netdev);
@@ -729,7 +729,7 @@ static void b44_remove(struct pci_device *pci)
729729
*/
730730
static void b44_irq(struct net_device *netdev, int enable)
731731
{
732-
struct b44_private *bp = netdev_priv(netdev);
732+
struct b44_private *bp = netdev->priv;
733733

734734
/* Interrupt mask specifies which events generate interrupts */
735735
bw32(bp, B44_IMASK, enable ? IMASK_DEF : IMASK_DISABLE);
@@ -743,7 +743,7 @@ static void b44_irq(struct net_device *netdev, int enable)
743743
*/
744744
static int b44_open(struct net_device *netdev)
745745
{
746-
struct b44_private *bp = netdev_priv(netdev);
746+
struct b44_private *bp = netdev->priv;
747747
int rc;
748748

749749
rc = b44_init_tx_ring(bp);
@@ -769,7 +769,7 @@ static int b44_open(struct net_device *netdev)
769769
*/
770770
static void b44_close(struct net_device *netdev)
771771
{
772-
struct b44_private *bp = netdev_priv(netdev);
772+
struct b44_private *bp = netdev->priv;
773773

774774
b44_chip_reset(bp, B44_FULL_RESET);
775775
b44_free_tx_ring(bp);
@@ -785,7 +785,7 @@ static void b44_close(struct net_device *netdev)
785785
*/
786786
static int b44_transmit(struct net_device *netdev, struct io_buffer *iobuf)
787787
{
788-
struct b44_private *bp = netdev_priv(netdev);
788+
struct b44_private *bp = netdev->priv;
789789
u32 cur = bp->tx_cur;
790790
u32 ctrl;
791791

@@ -905,7 +905,7 @@ static void b44_process_rx_packets(struct b44_private *bp)
905905
*/
906906
static void b44_poll(struct net_device *netdev)
907907
{
908-
struct b44_private *bp = netdev_priv(netdev);
908+
struct b44_private *bp = netdev->priv;
909909
u32 istat;
910910

911911
/* Interrupt status */

src/drivers/net/bnxt/bnxt.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void bnxt_set_txq ( struct bnxt *bp, int entry, dma_addr_t mapping, int len )
307307

308308
static void bnxt_tx_complete ( struct net_device *dev, u16 hw_idx )
309309
{
310-
struct bnxt *bp = netdev_priv ( dev );
310+
struct bnxt *bp = dev->priv;
311311
struct io_buffer *iob;
312312

313313
iob = bp->tx.iob[hw_idx];
@@ -484,7 +484,7 @@ void bnxt_rx_process ( struct net_device *dev, struct bnxt *bp,
484484
static int bnxt_rx_complete ( struct net_device *dev,
485485
struct rx_pkt_cmpl *rx_cmp )
486486
{
487-
struct bnxt *bp = netdev_priv ( dev );
487+
struct bnxt *bp = dev->priv;
488488
struct rx_pkt_cmpl_hi *rx_cmp_hi;
489489
u8 cmpl_bit = bp->cq.completion_bit;
490490

@@ -1927,7 +1927,7 @@ int bnxt_hwrm_run ( hwrm_func_t cmds[], struct bnxt *bp )
19271927

19281928
static int bnxt_open ( struct net_device *dev )
19291929
{
1930-
struct bnxt *bp = netdev_priv ( dev );
1930+
struct bnxt *bp = dev->priv;
19311931

19321932
DBGP ( "%s\n", __func__ );
19331933
bnxt_mm_nic ( bp );
@@ -1952,7 +1952,7 @@ static void bnxt_tx_adjust_pkt ( struct bnxt *bp, struct io_buffer *iob )
19521952

19531953
static int bnxt_tx ( struct net_device *dev, struct io_buffer *iob )
19541954
{
1955-
struct bnxt *bp = netdev_priv ( dev );
1955+
struct bnxt *bp = dev->priv;
19561956
u16 len, entry;
19571957
dma_addr_t mapping;
19581958

@@ -2009,7 +2009,7 @@ void bnxt_link_evt ( struct bnxt *bp, struct hwrm_async_event_cmpl *evt )
20092009

20102010
static void bnxt_service_cq ( struct net_device *dev )
20112011
{
2012-
struct bnxt *bp = netdev_priv ( dev );
2012+
struct bnxt *bp = dev->priv;
20132013
struct cmpl_base *cmp;
20142014
struct tx_cmpl *tx;
20152015
u16 old_cid = bp->cq.cons_id;
@@ -2057,7 +2057,7 @@ static void bnxt_service_cq ( struct net_device *dev )
20572057

20582058
static void bnxt_service_nq ( struct net_device *dev )
20592059
{
2060-
struct bnxt *bp = netdev_priv ( dev );
2060+
struct bnxt *bp = dev->priv;
20612061
struct nq_base *nqp;
20622062
u16 old_cid = bp->nq.cons_id;
20632063
int done = SERVICE_NEXT_NQ_BD;
@@ -2102,7 +2102,7 @@ static void bnxt_poll ( struct net_device *dev )
21022102

21032103
static void bnxt_close ( struct net_device *dev )
21042104
{
2105-
struct bnxt *bp = netdev_priv ( dev );
2105+
struct bnxt *bp = dev->priv;
21062106

21072107
DBGP ( "%s\n", __func__ );
21082108
bnxt_down_nic (bp);
@@ -2143,7 +2143,7 @@ static int bnxt_init_one ( struct pci_device *pci )
21432143
netdev_init ( netdev, &bnxt_netdev_ops );
21442144

21452145
/* Driver private area for this device */
2146-
bp = netdev_priv ( netdev );
2146+
bp = netdev->priv;
21472147

21482148
/* Set PCI driver private data */
21492149
pci_set_drvdata ( pci, netdev );
@@ -2197,7 +2197,7 @@ static int bnxt_init_one ( struct pci_device *pci )
21972197
static void bnxt_remove_one ( struct pci_device *pci )
21982198
{
21992199
struct net_device *netdev = pci_get_drvdata ( pci );
2200-
struct bnxt *bp = netdev_priv ( netdev );
2200+
struct bnxt *bp = netdev->priv;
22012201

22022202
DBGP ( "%s\n", __func__ );
22032203
/* Unregister network device */

src/drivers/net/eepro100.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ static void ifec_reset ( struct net_device *netdev )
690690
*/
691691
static void ifec_free ( struct net_device *netdev )
692692
{
693-
struct ifec_private *priv = netdev_priv ( netdev );
693+
struct ifec_private *priv = netdev->priv;
694694
int i;
695695

696696
DBGP ( "ifec_free\n" );

src/drivers/net/efi/snpnet.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static const char * snpnet_mac_text ( EFI_MAC_ADDRESS *mac, size_t len ) {
9797
* @v netdev Network device
9898
*/
9999
static void snpnet_dump_mode ( struct net_device *netdev ) {
100-
struct snp_nic *snp = netdev_priv ( netdev );
100+
struct snp_nic *snp = netdev->priv;
101101
EFI_SIMPLE_NETWORK_MODE *mode = snp->snp->Mode;
102102
size_t mac_len = mode->HwAddressSize;
103103
unsigned int i;
@@ -136,7 +136,7 @@ static void snpnet_dump_mode ( struct net_device *netdev ) {
136136
* @v netdev Network device
137137
*/
138138
static void snpnet_check_link ( struct net_device *netdev ) {
139-
struct snp_nic *snp = netdev_priv ( netdev );
139+
struct snp_nic *snp = netdev->priv;
140140
EFI_SIMPLE_NETWORK_MODE *mode = snp->snp->Mode;
141141

142142
/* Do nothing unless media presence detection is supported */
@@ -160,7 +160,7 @@ static void snpnet_check_link ( struct net_device *netdev ) {
160160
*/
161161
static int snpnet_transmit ( struct net_device *netdev,
162162
struct io_buffer *iobuf ) {
163-
struct snp_nic *snp = netdev_priv ( netdev );
163+
struct snp_nic *snp = netdev->priv;
164164
EFI_STATUS efirc;
165165
int rc;
166166

0 commit comments

Comments
 (0)