diff options
author | Joe Perches <joe@perches.com> | 2011-05-02 19:49:15 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-11 13:06:02 -0400 |
commit | f3a57fd148a4afd3c38f558c5b44972cb29ea8ba (patch) | |
tree | 7c1d553f33e2ed0d58c4a978ddd6be68ba592eb3 /drivers/net/wireless/libertas/if_spi.c | |
parent | 0e4e06ae5e895864b4a4bca7eec2e3015fddca98 (diff) |
libertas: Use netdev_<level> or dev_<level> where possible
Using the more descriptive logging styles gives a bit
more information about the device being operated on.
Makes the object trivially smaller too.
$ size drivers/net/wireless/libertas/built-in.o.*
187730 2973 38488 229191 37f47 drivers/net/wireless/libertas/built-in.o.new
188195 2973 38488 229656 38118 drivers/net/wireless/libertas/built-in.o.old
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/if_spi.c')
-rw-r--r-- | drivers/net/wireless/libertas/if_spi.c | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index 4d19b5726c15..463352c890d7 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c | |||
@@ -585,6 +585,7 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card, | |||
585 | static int if_spi_prog_main_firmware(struct if_spi_card *card, | 585 | static int if_spi_prog_main_firmware(struct if_spi_card *card, |
586 | const struct firmware *firmware) | 586 | const struct firmware *firmware) |
587 | { | 587 | { |
588 | struct lbs_private *priv = card->priv; | ||
588 | int len, prev_len; | 589 | int len, prev_len; |
589 | int bytes, crc_err = 0, err = 0; | 590 | int bytes, crc_err = 0, err = 0; |
590 | const u8 *fw; | 591 | const u8 *fw; |
@@ -598,8 +599,9 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card, | |||
598 | 599 | ||
599 | err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0); | 600 | err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0); |
600 | if (err) { | 601 | if (err) { |
601 | pr_err("%s: timed out waiting for initial scratch reg = 0\n", | 602 | netdev_err(priv->dev, |
602 | __func__); | 603 | "%s: timed out waiting for initial scratch reg = 0\n", |
604 | __func__); | ||
603 | goto out; | 605 | goto out; |
604 | } | 606 | } |
605 | 607 | ||
@@ -617,7 +619,8 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card, | |||
617 | * If there are no more bytes left, we would normally | 619 | * If there are no more bytes left, we would normally |
618 | * expect to have terminated with len = 0 | 620 | * expect to have terminated with len = 0 |
619 | */ | 621 | */ |
620 | pr_err("Firmware load wants more bytes than we have to offer.\n"); | 622 | netdev_err(priv->dev, |
623 | "Firmware load wants more bytes than we have to offer.\n"); | ||
621 | break; | 624 | break; |
622 | } | 625 | } |
623 | if (crc_err) { | 626 | if (crc_err) { |
@@ -706,12 +709,14 @@ static int if_spi_c2h_cmd(struct if_spi_card *card) | |||
706 | if (err) | 709 | if (err) |
707 | goto out; | 710 | goto out; |
708 | if (!len) { | 711 | if (!len) { |
709 | pr_err("%s: error: card has no data for host\n", __func__); | 712 | netdev_err(priv->dev, "%s: error: card has no data for host\n", |
713 | __func__); | ||
710 | err = -EINVAL; | 714 | err = -EINVAL; |
711 | goto out; | 715 | goto out; |
712 | } else if (len > IF_SPI_CMD_BUF_SIZE) { | 716 | } else if (len > IF_SPI_CMD_BUF_SIZE) { |
713 | pr_err("%s: error: response packet too large: %d bytes, but maximum is %d\n", | 717 | netdev_err(priv->dev, |
714 | __func__, len, IF_SPI_CMD_BUF_SIZE); | 718 | "%s: error: response packet too large: %d bytes, but maximum is %d\n", |
719 | __func__, len, IF_SPI_CMD_BUF_SIZE); | ||
715 | err = -EINVAL; | 720 | err = -EINVAL; |
716 | goto out; | 721 | goto out; |
717 | } | 722 | } |
@@ -732,7 +737,7 @@ static int if_spi_c2h_cmd(struct if_spi_card *card) | |||
732 | 737 | ||
733 | out: | 738 | out: |
734 | if (err) | 739 | if (err) |
735 | pr_err("%s: err=%d\n", __func__, err); | 740 | netdev_err(priv->dev, "%s: err=%d\n", __func__, err); |
736 | lbs_deb_leave(LBS_DEB_SPI); | 741 | lbs_deb_leave(LBS_DEB_SPI); |
737 | return err; | 742 | return err; |
738 | } | 743 | } |
@@ -740,6 +745,7 @@ out: | |||
740 | /* Move data from the card to the host */ | 745 | /* Move data from the card to the host */ |
741 | static int if_spi_c2h_data(struct if_spi_card *card) | 746 | static int if_spi_c2h_data(struct if_spi_card *card) |
742 | { | 747 | { |
748 | struct lbs_private *priv = card->priv; | ||
743 | struct sk_buff *skb; | 749 | struct sk_buff *skb; |
744 | char *data; | 750 | char *data; |
745 | u16 len; | 751 | u16 len; |
@@ -752,12 +758,14 @@ static int if_spi_c2h_data(struct if_spi_card *card) | |||
752 | if (err) | 758 | if (err) |
753 | goto out; | 759 | goto out; |
754 | if (!len) { | 760 | if (!len) { |
755 | pr_err("%s: error: card has no data for host\n", __func__); | 761 | netdev_err(priv->dev, "%s: error: card has no data for host\n", |
762 | __func__); | ||
756 | err = -EINVAL; | 763 | err = -EINVAL; |
757 | goto out; | 764 | goto out; |
758 | } else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { | 765 | } else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { |
759 | pr_err("%s: error: card has %d bytes of data, but our maximum skb size is %zu\n", | 766 | netdev_err(priv->dev, |
760 | __func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); | 767 | "%s: error: card has %d bytes of data, but our maximum skb size is %zu\n", |
768 | __func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); | ||
761 | err = -EINVAL; | 769 | err = -EINVAL; |
762 | goto out; | 770 | goto out; |
763 | } | 771 | } |
@@ -788,7 +796,7 @@ free_skb: | |||
788 | dev_kfree_skb(skb); | 796 | dev_kfree_skb(skb); |
789 | out: | 797 | out: |
790 | if (err) | 798 | if (err) |
791 | pr_err("%s: err=%d\n", __func__, err); | 799 | netdev_err(priv->dev, "%s: err=%d\n", __func__, err); |
792 | lbs_deb_leave(LBS_DEB_SPI); | 800 | lbs_deb_leave(LBS_DEB_SPI); |
793 | return err; | 801 | return err; |
794 | } | 802 | } |
@@ -797,6 +805,7 @@ out: | |||
797 | static void if_spi_h2c(struct if_spi_card *card, | 805 | static void if_spi_h2c(struct if_spi_card *card, |
798 | struct if_spi_packet *packet, int type) | 806 | struct if_spi_packet *packet, int type) |
799 | { | 807 | { |
808 | struct lbs_private *priv = card->priv; | ||
800 | int err = 0; | 809 | int err = 0; |
801 | u16 int_type, port_reg; | 810 | u16 int_type, port_reg; |
802 | 811 | ||
@@ -810,7 +819,8 @@ static void if_spi_h2c(struct if_spi_card *card, | |||
810 | port_reg = IF_SPI_CMD_RDWRPORT_REG; | 819 | port_reg = IF_SPI_CMD_RDWRPORT_REG; |
811 | break; | 820 | break; |
812 | default: | 821 | default: |
813 | pr_err("can't transfer buffer of type %d\n", type); | 822 | netdev_err(priv->dev, "can't transfer buffer of type %d\n", |
823 | type); | ||
814 | err = -EINVAL; | 824 | err = -EINVAL; |
815 | goto out; | 825 | goto out; |
816 | } | 826 | } |
@@ -824,7 +834,7 @@ out: | |||
824 | kfree(packet); | 834 | kfree(packet); |
825 | 835 | ||
826 | if (err) | 836 | if (err) |
827 | pr_err("%s: error %d\n", __func__, err); | 837 | netdev_err(priv->dev, "%s: error %d\n", __func__, err); |
828 | } | 838 | } |
829 | 839 | ||
830 | /* Inform the host about a card event */ | 840 | /* Inform the host about a card event */ |
@@ -848,7 +858,7 @@ static void if_spi_e2h(struct if_spi_card *card) | |||
848 | lbs_queue_event(priv, cause & 0xff); | 858 | lbs_queue_event(priv, cause & 0xff); |
849 | out: | 859 | out: |
850 | if (err) | 860 | if (err) |
851 | pr_err("%s: error %d\n", __func__, err); | 861 | netdev_err(priv->dev, "%s: error %d\n", __func__, err); |
852 | } | 862 | } |
853 | 863 | ||
854 | static void if_spi_host_to_card_worker(struct work_struct *work) | 864 | static void if_spi_host_to_card_worker(struct work_struct *work) |
@@ -858,8 +868,10 @@ static void if_spi_host_to_card_worker(struct work_struct *work) | |||
858 | u16 hiStatus; | 868 | u16 hiStatus; |
859 | unsigned long flags; | 869 | unsigned long flags; |
860 | struct if_spi_packet *packet; | 870 | struct if_spi_packet *packet; |
871 | struct lbs_private *priv; | ||
861 | 872 | ||
862 | card = container_of(work, struct if_spi_card, packet_work); | 873 | card = container_of(work, struct if_spi_card, packet_work); |
874 | priv = card->priv; | ||
863 | 875 | ||
864 | lbs_deb_enter(LBS_DEB_SPI); | 876 | lbs_deb_enter(LBS_DEB_SPI); |
865 | 877 | ||
@@ -870,7 +882,7 @@ static void if_spi_host_to_card_worker(struct work_struct *work) | |||
870 | err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG, | 882 | err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG, |
871 | &hiStatus); | 883 | &hiStatus); |
872 | if (err) { | 884 | if (err) { |
873 | pr_err("I/O error\n"); | 885 | netdev_err(priv->dev, "I/O error\n"); |
874 | goto err; | 886 | goto err; |
875 | } | 887 | } |
876 | 888 | ||
@@ -933,7 +945,7 @@ static void if_spi_host_to_card_worker(struct work_struct *work) | |||
933 | 945 | ||
934 | err: | 946 | err: |
935 | if (err) | 947 | if (err) |
936 | pr_err("%s: got error %d\n", __func__, err); | 948 | netdev_err(priv->dev, "%s: got error %d\n", __func__, err); |
937 | 949 | ||
938 | lbs_deb_leave(LBS_DEB_SPI); | 950 | lbs_deb_leave(LBS_DEB_SPI); |
939 | } | 951 | } |
@@ -956,7 +968,8 @@ static int if_spi_host_to_card(struct lbs_private *priv, | |||
956 | lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb); | 968 | lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb); |
957 | 969 | ||
958 | if (nb == 0) { | 970 | if (nb == 0) { |
959 | pr_err("%s: invalid size requested: %d\n", __func__, nb); | 971 | netdev_err(priv->dev, "%s: invalid size requested: %d\n", |
972 | __func__, nb); | ||
960 | err = -EINVAL; | 973 | err = -EINVAL; |
961 | goto out; | 974 | goto out; |
962 | } | 975 | } |
@@ -984,7 +997,8 @@ static int if_spi_host_to_card(struct lbs_private *priv, | |||
984 | spin_unlock_irqrestore(&card->buffer_lock, flags); | 997 | spin_unlock_irqrestore(&card->buffer_lock, flags); |
985 | break; | 998 | break; |
986 | default: | 999 | default: |
987 | pr_err("can't transfer buffer of type %d\n", type); | 1000 | netdev_err(priv->dev, "can't transfer buffer of type %d\n", |
1001 | type); | ||
988 | err = -EINVAL; | 1002 | err = -EINVAL; |
989 | break; | 1003 | break; |
990 | } | 1004 | } |
@@ -1017,6 +1031,7 @@ static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id) | |||
1017 | 1031 | ||
1018 | static int if_spi_init_card(struct if_spi_card *card) | 1032 | static int if_spi_init_card(struct if_spi_card *card) |
1019 | { | 1033 | { |
1034 | struct lbs_private *priv = card->priv; | ||
1020 | struct spi_device *spi = card->spi; | 1035 | struct spi_device *spi = card->spi; |
1021 | int err, i; | 1036 | int err, i; |
1022 | u32 scratch; | 1037 | u32 scratch; |
@@ -1045,7 +1060,8 @@ static int if_spi_init_card(struct if_spi_card *card) | |||
1045 | break; | 1060 | break; |
1046 | } | 1061 | } |
1047 | if (i == ARRAY_SIZE(fw_table)) { | 1062 | if (i == ARRAY_SIZE(fw_table)) { |
1048 | pr_err("Unsupported chip_id: 0x%02x\n", card->card_id); | 1063 | netdev_err(priv->dev, "Unsupported chip_id: 0x%02x\n", |
1064 | card->card_id); | ||
1049 | err = -ENODEV; | 1065 | err = -ENODEV; |
1050 | goto out; | 1066 | goto out; |
1051 | } | 1067 | } |
@@ -1054,7 +1070,8 @@ static int if_spi_init_card(struct if_spi_card *card) | |||
1054 | card->card_id, &fw_table[0], &helper, | 1070 | card->card_id, &fw_table[0], &helper, |
1055 | &mainfw); | 1071 | &mainfw); |
1056 | if (err) { | 1072 | if (err) { |
1057 | pr_err("failed to find firmware (%d)\n", err); | 1073 | netdev_err(priv->dev, "failed to find firmware (%d)\n", |
1074 | err); | ||
1058 | goto out; | 1075 | goto out; |
1059 | } | 1076 | } |
1060 | 1077 | ||