hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/marvell/libertas/if_spi.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * linux/drivers/net/wireless/libertas/if_spi.c
34 *
....@@ -10,11 +11,6 @@
1011 * Colin McCabe <colin@cozybit.com>
1112 *
1213 * Inspired by if_sdio.c, Copyright 2007-2008 Pierre Ossman
13
- *
14
- * This program is free software; you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License as published by
16
- * the Free Software Foundation; either version 2 of the License, or
17
- * (at your option) any later version.
1814 */
1915
2016 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -39,7 +35,7 @@
3935 struct if_spi_packet {
4036 struct list_head list;
4137 u16 blen;
42
- u8 buffer[0] __attribute__((aligned(4)));
38
+ u8 buffer[] __aligned(4);
4339 };
4440
4541 struct if_spi_card {
....@@ -239,8 +235,9 @@
239235 spi_message_add_tail(&dummy_trans, &m);
240236 } else {
241237 /* Busy-wait while the SPU fills the FIFO */
242
- reg_trans.delay_usecs =
238
+ reg_trans.delay.value =
243239 DIV_ROUND_UP((100 + (delay * 10)), 1000);
240
+ reg_trans.delay.unit = SPI_DELAY_UNIT_USECS;
244241 }
245242
246243 /* read in data */
....@@ -770,19 +767,15 @@
770767
771768 /* Read the data from the WLAN module into our skb... */
772769 err = spu_read(card, IF_SPI_DATA_RDWRPORT_REG, data, ALIGN(len, 4));
773
- if (err)
774
- goto free_skb;
770
+ if (err) {
771
+ dev_kfree_skb(skb);
772
+ goto out;
773
+ }
775774
776775 /* pass the SKB to libertas */
777776 err = lbs_process_rxed_packet(card->priv, skb);
778
- if (err)
779
- goto free_skb;
777
+ /* lbs_process_rxed_packet() consumes the skb */
780778
781
- /* success */
782
- goto out;
783
-
784
-free_skb:
785
- dev_kfree_skb(skb);
786779 out:
787780 if (err)
788781 netdev_err(priv->dev, "%s: err=%d\n", __func__, err);
....@@ -796,15 +789,13 @@
796789 {
797790 struct lbs_private *priv = card->priv;
798791 int err = 0;
799
- u16 int_type, port_reg;
792
+ u16 port_reg;
800793
801794 switch (type) {
802795 case MVMS_DAT:
803
- int_type = IF_SPI_CIC_TX_DOWNLOAD_OVER;
804796 port_reg = IF_SPI_DATA_RDWRPORT_REG;
805797 break;
806798 case MVMS_CMD:
807
- int_type = IF_SPI_CIC_CMD_DOWNLOAD_OVER;
808799 port_reg = IF_SPI_CMD_RDWRPORT_REG;
809800 break;
810801 default:
....@@ -1146,8 +1137,8 @@
11461137 * This will call alloc_etherdev.
11471138 */
11481139 priv = lbs_add_card(card, &spi->dev);
1149
- if (!priv) {
1150
- err = -ENOMEM;
1140
+ if (IS_ERR(priv)) {
1141
+ err = PTR_ERR(priv);
11511142 goto free_card;
11521143 }
11531144 card->priv = priv;