aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2005-06-20 17:30:36 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-27 23:37:30 -0400
commitad3fee560bc508008b3b2cf6358105c4c7081921 (patch)
tree21dfeb0daf6354cec40e71ee6a5865e28593e9c1 /drivers
parentedfc43f2ec542c17c479d8ec7e4b0cee7b20f578 (diff)
[PATCH] wireless-device-attr-fixes-2
More fixes for greg depredations. Also nuke lots of pointless typecasts. All this new wireless code adds near-infinite amounts of trailing whitespace. Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ipw2200.c122
1 files changed, 68 insertions, 54 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 343838a53271..16cfd907e715 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -642,8 +642,8 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf)
642{ 642{
643 return sprintf(buf, "0x%08X\n", ipw_debug_level); 643 return sprintf(buf, "0x%08X\n", ipw_debug_level);
644} 644}
645static ssize_t store_debug_level(struct device_driver *d, const char *buf, 645static ssize_t store_debug_level(struct device_driver *d,
646 size_t count) 646 const char *buf, size_t count)
647{ 647{
648 char *p = (char *)buf; 648 char *p = (char *)buf;
649 u32 val; 649 u32 val;
@@ -667,23 +667,26 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf,
667static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, 667static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
668 show_debug_level, store_debug_level); 668 show_debug_level, store_debug_level);
669 669
670static ssize_t show_status(struct device *d, char *buf) 670static ssize_t show_status(struct device *d,
671 struct device_attribute *attr, char *buf)
671{ 672{
672 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 673 struct ipw_priv *p = d->driver_data;
673 return sprintf(buf, "0x%08x\n", (int)p->status); 674 return sprintf(buf, "0x%08x\n", (int)p->status);
674} 675}
675static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); 676static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
676 677
677static ssize_t show_cfg(struct device *d, char *buf) 678static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
679 char *buf)
678{ 680{
679 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 681 struct ipw_priv *p = d->driver_data;
680 return sprintf(buf, "0x%08x\n", (int)p->config); 682 return sprintf(buf, "0x%08x\n", (int)p->config);
681} 683}
682static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); 684static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
683 685
684static ssize_t show_nic_type(struct device *d, char *buf) 686static ssize_t show_nic_type(struct device *d,
687 struct device_attribute *attr, char *buf)
685{ 688{
686 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 689 struct ipw_priv *p = d->driver_data;
687 u8 type = p->eeprom[EEPROM_NIC_TYPE]; 690 u8 type = p->eeprom[EEPROM_NIC_TYPE];
688 691
689 switch (type) { 692 switch (type) {
@@ -703,8 +706,8 @@ static ssize_t show_nic_type(struct device *d, char *buf)
703} 706}
704static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); 707static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL);
705 708
706static ssize_t dump_error_log(struct device *d, const char *buf, 709static ssize_t dump_error_log(struct device *d,
707 size_t count) 710 struct device_attribute *attr, const char *buf, size_t count)
708{ 711{
709 char *p = (char *)buf; 712 char *p = (char *)buf;
710 713
@@ -715,8 +718,8 @@ static ssize_t dump_error_log(struct device *d, const char *buf,
715} 718}
716static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); 719static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log);
717 720
718static ssize_t dump_event_log(struct device *d, const char *buf, 721static ssize_t dump_event_log(struct device *d,
719 size_t count) 722 struct device_attribute *attr, const char *buf, size_t count)
720{ 723{
721 char *p = (char *)buf; 724 char *p = (char *)buf;
722 725
@@ -727,10 +730,11 @@ static ssize_t dump_event_log(struct device *d, const char *buf,
727} 730}
728static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); 731static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
729 732
730static ssize_t show_ucode_version(struct device *d, char *buf) 733static ssize_t show_ucode_version(struct device *d,
734 struct device_attribute *attr, char *buf)
731{ 735{
732 u32 len = sizeof(u32), tmp = 0; 736 u32 len = sizeof(u32), tmp = 0;
733 struct ipw_priv *p = (struct ipw_priv*)d->driver_data; 737 struct ipw_priv *p = d->driver_data;
734 738
735 if(ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len)) 739 if(ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len))
736 return 0; 740 return 0;
@@ -739,10 +743,11 @@ static ssize_t show_ucode_version(struct device *d, char *buf)
739} 743}
740static DEVICE_ATTR(ucode_version, S_IWUSR|S_IRUGO, show_ucode_version, NULL); 744static DEVICE_ATTR(ucode_version, S_IWUSR|S_IRUGO, show_ucode_version, NULL);
741 745
742static ssize_t show_rtc(struct device *d, char *buf) 746static ssize_t show_rtc(struct device *d, struct device_attribute *attr,
747 char *buf)
743{ 748{
744 u32 len = sizeof(u32), tmp = 0; 749 u32 len = sizeof(u32), tmp = 0;
745 struct ipw_priv *p = (struct ipw_priv*)d->driver_data; 750 struct ipw_priv *p = d->driver_data;
746 751
747 if(ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len)) 752 if(ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len))
748 return 0; 753 return 0;
@@ -755,35 +760,38 @@ static DEVICE_ATTR(rtc, S_IWUSR|S_IRUGO, show_rtc, NULL);
755 * Add a device attribute to view/control the delay between eeprom 760 * Add a device attribute to view/control the delay between eeprom
756 * operations. 761 * operations.
757 */ 762 */
758static ssize_t show_eeprom_delay(struct device *d, char *buf) 763static ssize_t show_eeprom_delay(struct device *d,
764 struct device_attribute *attr, char *buf)
759{ 765{
760 int n = ((struct ipw_priv*)d->driver_data)->eeprom_delay; 766 int n = ((struct ipw_priv*)d->driver_data)->eeprom_delay;
761 return sprintf(buf, "%i\n", n); 767 return sprintf(buf, "%i\n", n);
762} 768}
763static ssize_t store_eeprom_delay(struct device *d, const char *buf, 769static ssize_t store_eeprom_delay(struct device *d,
764 size_t count) 770 struct device_attribute *attr, const char *buf,
771 size_t count)
765{ 772{
766 struct ipw_priv *p = (struct ipw_priv*)d->driver_data; 773 struct ipw_priv *p = d->driver_data;
767 sscanf(buf, "%i", &p->eeprom_delay); 774 sscanf(buf, "%i", &p->eeprom_delay);
768 return strnlen(buf, count); 775 return strnlen(buf, count);
769} 776}
770static DEVICE_ATTR(eeprom_delay, S_IWUSR|S_IRUGO, 777static DEVICE_ATTR(eeprom_delay, S_IWUSR|S_IRUGO,
771 show_eeprom_delay,store_eeprom_delay); 778 show_eeprom_delay,store_eeprom_delay);
772 779
773static ssize_t show_command_event_reg(struct device *d, char *buf) 780static ssize_t show_command_event_reg(struct device *d,
781 struct device_attribute *attr, char *buf)
774{ 782{
775 u32 reg = 0; 783 u32 reg = 0;
776 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 784 struct ipw_priv *p = d->driver_data;
777 785
778 reg = ipw_read_reg32(p, CX2_INTERNAL_CMD_EVENT); 786 reg = ipw_read_reg32(p, CX2_INTERNAL_CMD_EVENT);
779 return sprintf(buf, "0x%08x\n", reg); 787 return sprintf(buf, "0x%08x\n", reg);
780} 788}
781static ssize_t store_command_event_reg(struct device *d, 789static ssize_t store_command_event_reg(struct device *d,
782 const char *buf, 790 struct device_attribute *attr, const char *buf,
783 size_t count) 791 size_t count)
784{ 792{
785 u32 reg; 793 u32 reg;
786 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 794 struct ipw_priv *p = d->driver_data;
787 795
788 sscanf(buf, "%x", &reg); 796 sscanf(buf, "%x", &reg);
789 ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); 797 ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg);
@@ -792,20 +800,21 @@ static ssize_t store_command_event_reg(struct device *d,
792static DEVICE_ATTR(command_event_reg, S_IWUSR|S_IRUGO, 800static DEVICE_ATTR(command_event_reg, S_IWUSR|S_IRUGO,
793 show_command_event_reg,store_command_event_reg); 801 show_command_event_reg,store_command_event_reg);
794 802
795static ssize_t show_mem_gpio_reg(struct device *d, char *buf) 803static ssize_t show_mem_gpio_reg(struct device *d,
804 struct device_attribute *attr, char *buf)
796{ 805{
797 u32 reg = 0; 806 u32 reg = 0;
798 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 807 struct ipw_priv *p = d->driver_data;
799 808
800 reg = ipw_read_reg32(p, 0x301100); 809 reg = ipw_read_reg32(p, 0x301100);
801 return sprintf(buf, "0x%08x\n", reg); 810 return sprintf(buf, "0x%08x\n", reg);
802} 811}
803static ssize_t store_mem_gpio_reg(struct device *d, 812static ssize_t store_mem_gpio_reg(struct device *d,
804 const char *buf, 813 struct device_attribute *attr, const char *buf,
805 size_t count) 814 size_t count)
806{ 815{
807 u32 reg; 816 u32 reg;
808 struct ipw_priv *p = (struct ipw_priv *)d->driver_data; 817 struct ipw_priv *p = d->driver_data;
809 818
810 sscanf(buf, "%x", &reg); 819 sscanf(buf, "%x", &reg);
811 ipw_write_reg32(p, 0x301100, reg); 820 ipw_write_reg32(p, 0x301100, reg);
@@ -814,10 +823,11 @@ static ssize_t store_mem_gpio_reg(struct device *d,
814static DEVICE_ATTR(mem_gpio_reg, S_IWUSR|S_IRUGO, 823static DEVICE_ATTR(mem_gpio_reg, S_IWUSR|S_IRUGO,
815 show_mem_gpio_reg,store_mem_gpio_reg); 824 show_mem_gpio_reg,store_mem_gpio_reg);
816 825
817static ssize_t show_indirect_dword(struct device *d, char *buf) 826static ssize_t show_indirect_dword(struct device *d,
827 struct device_attribute *attr, char *buf)
818{ 828{
819 u32 reg = 0; 829 u32 reg = 0;
820 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 830 struct ipw_priv *priv = d->driver_data;
821 if (priv->status & STATUS_INDIRECT_DWORD) 831 if (priv->status & STATUS_INDIRECT_DWORD)
822 reg = ipw_read_reg32(priv, priv->indirect_dword); 832 reg = ipw_read_reg32(priv, priv->indirect_dword);
823 else 833 else
@@ -825,11 +835,11 @@ static ssize_t show_indirect_dword(struct device *d, char *buf)
825 835
826 return sprintf(buf, "0x%08x\n", reg); 836 return sprintf(buf, "0x%08x\n", reg);
827} 837}
828static ssize_t store_indirect_dword(struct device *d, 838static ssize_t store_indirect_dword(struct device *d,
829 const char *buf, 839 struct device_attribute *attr, const char *buf,
830 size_t count) 840 size_t count)
831{ 841{
832 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 842 struct ipw_priv *priv = d->driver_data;
833 843
834 sscanf(buf, "%x", &priv->indirect_dword); 844 sscanf(buf, "%x", &priv->indirect_dword);
835 priv->status |= STATUS_INDIRECT_DWORD; 845 priv->status |= STATUS_INDIRECT_DWORD;
@@ -838,10 +848,11 @@ static ssize_t store_indirect_dword(struct device *d,
838static DEVICE_ATTR(indirect_dword, S_IWUSR|S_IRUGO, 848static DEVICE_ATTR(indirect_dword, S_IWUSR|S_IRUGO,
839 show_indirect_dword,store_indirect_dword); 849 show_indirect_dword,store_indirect_dword);
840 850
841static ssize_t show_indirect_byte(struct device *d, char *buf) 851static ssize_t show_indirect_byte(struct device *d,
852 struct device_attribute *attr, char *buf)
842{ 853{
843 u8 reg = 0; 854 u8 reg = 0;
844 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 855 struct ipw_priv *priv = d->driver_data;
845 if (priv->status & STATUS_INDIRECT_BYTE) 856 if (priv->status & STATUS_INDIRECT_BYTE)
846 reg = ipw_read_reg8(priv, priv->indirect_byte); 857 reg = ipw_read_reg8(priv, priv->indirect_byte);
847 else 858 else
@@ -849,11 +860,11 @@ static ssize_t show_indirect_byte(struct device *d, char *buf)
849 860
850 return sprintf(buf, "0x%02x\n", reg); 861 return sprintf(buf, "0x%02x\n", reg);
851} 862}
852static ssize_t store_indirect_byte(struct device *d, 863static ssize_t store_indirect_byte(struct device *d,
853 const char *buf, 864 struct device_attribute *attr, const char *buf,
854 size_t count) 865 size_t count)
855{ 866{
856 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 867 struct ipw_priv *priv = d->driver_data;
857 868
858 sscanf(buf, "%x", &priv->indirect_byte); 869 sscanf(buf, "%x", &priv->indirect_byte);
859 priv->status |= STATUS_INDIRECT_BYTE; 870 priv->status |= STATUS_INDIRECT_BYTE;
@@ -862,10 +873,11 @@ static ssize_t store_indirect_byte(struct device *d,
862static DEVICE_ATTR(indirect_byte, S_IWUSR|S_IRUGO, 873static DEVICE_ATTR(indirect_byte, S_IWUSR|S_IRUGO,
863 show_indirect_byte, store_indirect_byte); 874 show_indirect_byte, store_indirect_byte);
864 875
865static ssize_t show_direct_dword(struct device *d, char *buf) 876static ssize_t show_direct_dword(struct device *d,
877 struct device_attribute *attr, char *buf)
866{ 878{
867 u32 reg = 0; 879 u32 reg = 0;
868 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 880 struct ipw_priv *priv = d->driver_data;
869 881
870 if (priv->status & STATUS_DIRECT_DWORD) 882 if (priv->status & STATUS_DIRECT_DWORD)
871 reg = ipw_read32(priv, priv->direct_dword); 883 reg = ipw_read32(priv, priv->direct_dword);
@@ -874,11 +886,11 @@ static ssize_t show_direct_dword(struct device *d, char *buf)
874 886
875 return sprintf(buf, "0x%08x\n", reg); 887 return sprintf(buf, "0x%08x\n", reg);
876} 888}
877static ssize_t store_direct_dword(struct device *d, 889static ssize_t store_direct_dword(struct device *d,
878 const char *buf, 890 struct device_attribute *attr, const char *buf,
879 size_t count) 891 size_t count)
880{ 892{
881 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 893 struct ipw_priv *priv = d->driver_data;
882 894
883 sscanf(buf, "%x", &priv->direct_dword); 895 sscanf(buf, "%x", &priv->direct_dword);
884 priv->status |= STATUS_DIRECT_DWORD; 896 priv->status |= STATUS_DIRECT_DWORD;
@@ -898,13 +910,14 @@ static inline int rf_kill_active(struct ipw_priv *priv)
898 return (priv->status & STATUS_RF_KILL_HW) ? 1 : 0; 910 return (priv->status & STATUS_RF_KILL_HW) ? 1 : 0;
899} 911}
900 912
901static ssize_t show_rf_kill(struct device *d, char *buf) 913static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
914 char *buf)
902{ 915{
903 /* 0 - RF kill not enabled 916 /* 0 - RF kill not enabled
904 1 - SW based RF kill active (sysfs) 917 1 - SW based RF kill active (sysfs)
905 2 - HW based RF kill active 918 2 - HW based RF kill active
906 3 - Both HW and SW baed RF kill active */ 919 3 - Both HW and SW baed RF kill active */
907 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 920 struct ipw_priv *priv = d->driver_data;
908 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | 921 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) |
909 (rf_kill_active(priv) ? 0x2 : 0x0); 922 (rf_kill_active(priv) ? 0x2 : 0x0);
910 return sprintf(buf, "%i\n", val); 923 return sprintf(buf, "%i\n", val);
@@ -943,9 +956,10 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
943 return 1; 956 return 1;
944} 957}
945 958
946static ssize_t store_rf_kill(struct device *d, const char *buf, size_t count) 959static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr,
960 const char *buf, size_t count)
947{ 961{
948 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 962 struct ipw_priv *priv = d->driver_data;
949 963
950 ipw_radio_kill_sw(priv, buf[0] == '1'); 964 ipw_radio_kill_sw(priv, buf[0] == '1');
951 965