aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/toshiba
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2013-03-21 20:06:59 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-22 10:21:46 -0400
commit6b0c21cede22be1f68f0a632c0ca38008ce1abe7 (patch)
treeb5cb7c72f54c8e6cc7c7073a1ae5c829eae9dd32 /drivers/net/ethernet/toshiba
parent9b5645b51384d094b4b3230c491530382ea5c7bb (diff)
net: Fix p3_gelic_net sparse warnings
Rearrange routines to avoid local declarations and remove unnecessary inline tags. No functional changes. Fixes sparse warnings like these: ps3_gelic_net.c: error: marked inline, but without a definition Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/toshiba')
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_net.c240
1 files changed, 117 insertions, 123 deletions
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index 445c0595c997..ad32af67e618 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -58,13 +58,6 @@ MODULE_DESCRIPTION("Gelic Network driver");
58MODULE_LICENSE("GPL"); 58MODULE_LICENSE("GPL");
59 59
60 60
61static inline void gelic_card_enable_rxdmac(struct gelic_card *card);
62static inline void gelic_card_disable_rxdmac(struct gelic_card *card);
63static inline void gelic_card_disable_txdmac(struct gelic_card *card);
64static inline void gelic_card_reset_chain(struct gelic_card *card,
65 struct gelic_descr_chain *chain,
66 struct gelic_descr *start_descr);
67
68/* set irq_mask */ 61/* set irq_mask */
69int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask) 62int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
70{ 63{
@@ -78,12 +71,12 @@ int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
78 return status; 71 return status;
79} 72}
80 73
81static inline void gelic_card_rx_irq_on(struct gelic_card *card) 74static void gelic_card_rx_irq_on(struct gelic_card *card)
82{ 75{
83 card->irq_mask |= GELIC_CARD_RXINT; 76 card->irq_mask |= GELIC_CARD_RXINT;
84 gelic_card_set_irq_mask(card, card->irq_mask); 77 gelic_card_set_irq_mask(card, card->irq_mask);
85} 78}
86static inline void gelic_card_rx_irq_off(struct gelic_card *card) 79static void gelic_card_rx_irq_off(struct gelic_card *card)
87{ 80{
88 card->irq_mask &= ~GELIC_CARD_RXINT; 81 card->irq_mask &= ~GELIC_CARD_RXINT;
89 gelic_card_set_irq_mask(card, card->irq_mask); 82 gelic_card_set_irq_mask(card, card->irq_mask);
@@ -127,6 +120,120 @@ static int gelic_card_set_link_mode(struct gelic_card *card, int mode)
127 return 0; 120 return 0;
128} 121}
129 122
123/**
124 * gelic_card_disable_txdmac - disables the transmit DMA controller
125 * @card: card structure
126 *
127 * gelic_card_disable_txdmac terminates processing on the DMA controller by
128 * turing off DMA and issuing a force end
129 */
130static void gelic_card_disable_txdmac(struct gelic_card *card)
131{
132 int status;
133
134 /* this hvc blocks until the DMA in progress really stopped */
135 status = lv1_net_stop_tx_dma(bus_id(card), dev_id(card));
136 if (status)
137 dev_err(ctodev(card),
138 "lv1_net_stop_tx_dma failed, status=%d\n", status);
139}
140
141/**
142 * gelic_card_enable_rxdmac - enables the receive DMA controller
143 * @card: card structure
144 *
145 * gelic_card_enable_rxdmac enables the DMA controller by setting RX_DMA_EN
146 * in the GDADMACCNTR register
147 */
148static void gelic_card_enable_rxdmac(struct gelic_card *card)
149{
150 int status;
151
152#ifdef DEBUG
153 if (gelic_descr_get_status(card->rx_chain.head) !=
154 GELIC_DESCR_DMA_CARDOWNED) {
155 printk(KERN_ERR "%s: status=%x\n", __func__,
156 be32_to_cpu(card->rx_chain.head->dmac_cmd_status));
157 printk(KERN_ERR "%s: nextphy=%x\n", __func__,
158 be32_to_cpu(card->rx_chain.head->next_descr_addr));
159 printk(KERN_ERR "%s: head=%p\n", __func__,
160 card->rx_chain.head);
161 }
162#endif
163 status = lv1_net_start_rx_dma(bus_id(card), dev_id(card),
164 card->rx_chain.head->bus_addr, 0);
165 if (status)
166 dev_info(ctodev(card),
167 "lv1_net_start_rx_dma failed, status=%d\n", status);
168}
169
170/**
171 * gelic_card_disable_rxdmac - disables the receive DMA controller
172 * @card: card structure
173 *
174 * gelic_card_disable_rxdmac terminates processing on the DMA controller by
175 * turing off DMA and issuing a force end
176 */
177static void gelic_card_disable_rxdmac(struct gelic_card *card)
178{
179 int status;
180
181 /* this hvc blocks until the DMA in progress really stopped */
182 status = lv1_net_stop_rx_dma(bus_id(card), dev_id(card));
183 if (status)
184 dev_err(ctodev(card),
185 "lv1_net_stop_rx_dma failed, %d\n", status);
186}
187
188/**
189 * gelic_descr_set_status -- sets the status of a descriptor
190 * @descr: descriptor to change
191 * @status: status to set in the descriptor
192 *
193 * changes the status to the specified value. Doesn't change other bits
194 * in the status
195 */
196static void gelic_descr_set_status(struct gelic_descr *descr,
197 enum gelic_descr_dma_status status)
198{
199 descr->dmac_cmd_status = cpu_to_be32(status |
200 (be32_to_cpu(descr->dmac_cmd_status) &
201 ~GELIC_DESCR_DMA_STAT_MASK));
202 /*
203 * dma_cmd_status field is used to indicate whether the descriptor
204 * is valid or not.
205 * Usually caller of this function wants to inform that to the
206 * hardware, so we assure here the hardware sees the change.
207 */
208 wmb();
209}
210
211/**
212 * gelic_card_reset_chain - reset status of a descriptor chain
213 * @card: card structure
214 * @chain: address of chain
215 * @start_descr: address of descriptor array
216 *
217 * Reset the status of dma descriptors to ready state
218 * and re-initialize the hardware chain for later use
219 */
220static void gelic_card_reset_chain(struct gelic_card *card,
221 struct gelic_descr_chain *chain,
222 struct gelic_descr *start_descr)
223{
224 struct gelic_descr *descr;
225
226 for (descr = start_descr; start_descr != descr->next; descr++) {
227 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED);
228 descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr);
229 }
230
231 chain->head = start_descr;
232 chain->tail = (descr - 1);
233
234 (descr - 1)->next_descr_addr = 0;
235}
236
130void gelic_card_up(struct gelic_card *card) 237void gelic_card_up(struct gelic_card *card)
131{ 238{
132 pr_debug("%s: called\n", __func__); 239 pr_debug("%s: called\n", __func__);
@@ -183,29 +290,6 @@ gelic_descr_get_status(struct gelic_descr *descr)
183} 290}
184 291
185/** 292/**
186 * gelic_descr_set_status -- sets the status of a descriptor
187 * @descr: descriptor to change
188 * @status: status to set in the descriptor
189 *
190 * changes the status to the specified value. Doesn't change other bits
191 * in the status
192 */
193static void gelic_descr_set_status(struct gelic_descr *descr,
194 enum gelic_descr_dma_status status)
195{
196 descr->dmac_cmd_status = cpu_to_be32(status |
197 (be32_to_cpu(descr->dmac_cmd_status) &
198 ~GELIC_DESCR_DMA_STAT_MASK));
199 /*
200 * dma_cmd_status field is used to indicate whether the descriptor
201 * is valid or not.
202 * Usually caller of this function wants to inform that to the
203 * hardware, so we assure here the hardware sees the change.
204 */
205 wmb();
206}
207
208/**
209 * gelic_card_free_chain - free descriptor chain 293 * gelic_card_free_chain - free descriptor chain
210 * @card: card structure 294 * @card: card structure
211 * @descr_in: address of desc 295 * @descr_in: address of desc
@@ -286,31 +370,6 @@ iommu_error:
286} 370}
287 371
288/** 372/**
289 * gelic_card_reset_chain - reset status of a descriptor chain
290 * @card: card structure
291 * @chain: address of chain
292 * @start_descr: address of descriptor array
293 *
294 * Reset the status of dma descriptors to ready state
295 * and re-initialize the hardware chain for later use
296 */
297static void gelic_card_reset_chain(struct gelic_card *card,
298 struct gelic_descr_chain *chain,
299 struct gelic_descr *start_descr)
300{
301 struct gelic_descr *descr;
302
303 for (descr = start_descr; start_descr != descr->next; descr++) {
304 gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED);
305 descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr);
306 }
307
308 chain->head = start_descr;
309 chain->tail = (descr - 1);
310
311 (descr - 1)->next_descr_addr = 0;
312}
313/**
314 * gelic_descr_prepare_rx - reinitializes a rx descriptor 373 * gelic_descr_prepare_rx - reinitializes a rx descriptor
315 * @card: card structure 374 * @card: card structure
316 * @descr: descriptor to re-init 375 * @descr: descriptor to re-init
@@ -599,71 +658,6 @@ void gelic_net_set_multi(struct net_device *netdev)
599} 658}
600 659
601/** 660/**
602 * gelic_card_enable_rxdmac - enables the receive DMA controller
603 * @card: card structure
604 *
605 * gelic_card_enable_rxdmac enables the DMA controller by setting RX_DMA_EN
606 * in the GDADMACCNTR register
607 */
608static inline void gelic_card_enable_rxdmac(struct gelic_card *card)
609{
610 int status;
611
612#ifdef DEBUG
613 if (gelic_descr_get_status(card->rx_chain.head) !=
614 GELIC_DESCR_DMA_CARDOWNED) {
615 printk(KERN_ERR "%s: status=%x\n", __func__,
616 be32_to_cpu(card->rx_chain.head->dmac_cmd_status));
617 printk(KERN_ERR "%s: nextphy=%x\n", __func__,
618 be32_to_cpu(card->rx_chain.head->next_descr_addr));
619 printk(KERN_ERR "%s: head=%p\n", __func__,
620 card->rx_chain.head);
621 }
622#endif
623 status = lv1_net_start_rx_dma(bus_id(card), dev_id(card),
624 card->rx_chain.head->bus_addr, 0);
625 if (status)
626 dev_info(ctodev(card),
627 "lv1_net_start_rx_dma failed, status=%d\n", status);
628}
629
630/**
631 * gelic_card_disable_rxdmac - disables the receive DMA controller
632 * @card: card structure
633 *
634 * gelic_card_disable_rxdmac terminates processing on the DMA controller by
635 * turing off DMA and issuing a force end
636 */
637static inline void gelic_card_disable_rxdmac(struct gelic_card *card)
638{
639 int status;
640
641 /* this hvc blocks until the DMA in progress really stopped */
642 status = lv1_net_stop_rx_dma(bus_id(card), dev_id(card));
643 if (status)
644 dev_err(ctodev(card),
645 "lv1_net_stop_rx_dma failed, %d\n", status);
646}
647
648/**
649 * gelic_card_disable_txdmac - disables the transmit DMA controller
650 * @card: card structure
651 *
652 * gelic_card_disable_txdmac terminates processing on the DMA controller by
653 * turing off DMA and issuing a force end
654 */
655static inline void gelic_card_disable_txdmac(struct gelic_card *card)
656{
657 int status;
658
659 /* this hvc blocks until the DMA in progress really stopped */
660 status = lv1_net_stop_tx_dma(bus_id(card), dev_id(card));
661 if (status)
662 dev_err(ctodev(card),
663 "lv1_net_stop_tx_dma failed, status=%d\n", status);
664}
665
666/**
667 * gelic_net_stop - called upon ifconfig down 661 * gelic_net_stop - called upon ifconfig down
668 * @netdev: interface device structure 662 * @netdev: interface device structure
669 * 663 *
@@ -746,7 +740,7 @@ static void gelic_descr_set_tx_cmdstat(struct gelic_descr *descr,
746 } 740 }
747} 741}
748 742
749static inline struct sk_buff *gelic_put_vlan_tag(struct sk_buff *skb, 743static struct sk_buff *gelic_put_vlan_tag(struct sk_buff *skb,
750 unsigned short tag) 744 unsigned short tag)
751{ 745{
752 struct vlan_ethhdr *veth; 746 struct vlan_ethhdr *veth;