diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-03-25 20:35:46 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-03-25 20:35:46 -0400 |
commit | d171c23327e2d596ac27d3df4322fc6430b45aa2 (patch) | |
tree | 53f19fbd016147f960238300a7acf9a5a396055b | |
parent | f85c4abdbc24ede9978073375bee12980cf852b2 (diff) |
[Blackfin] arch: fix up gpio code style -- no functional changes
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index a09dc48050b4..b54dad505f83 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -348,11 +348,10 @@ static void portmux_setup(unsigned short per, unsigned short function) | |||
348 | offset = port_mux_lut[y].offset; | 348 | offset = port_mux_lut[y].offset; |
349 | muxreg = bfin_read_PORT_MUX(); | 349 | muxreg = bfin_read_PORT_MUX(); |
350 | 350 | ||
351 | if (offset != 1) { | 351 | if (offset != 1) |
352 | muxreg &= ~(1 << offset); | 352 | muxreg &= ~(1 << offset); |
353 | } else { | 353 | else |
354 | muxreg &= ~(3 << 1); | 354 | muxreg &= ~(3 << 1); |
355 | } | ||
356 | 355 | ||
357 | muxreg |= (function << offset); | 356 | muxreg |= (function << offset); |
358 | bfin_write_PORT_MUX(muxreg); | 357 | bfin_write_PORT_MUX(muxreg); |
@@ -424,11 +423,9 @@ static void default_gpio(unsigned gpio) | |||
424 | 423 | ||
425 | static int __init bfin_gpio_init(void) | 424 | static int __init bfin_gpio_init(void) |
426 | { | 425 | { |
427 | |||
428 | printk(KERN_INFO "Blackfin GPIO Controller\n"); | 426 | printk(KERN_INFO "Blackfin GPIO Controller\n"); |
429 | 427 | ||
430 | return 0; | 428 | return 0; |
431 | |||
432 | } | 429 | } |
433 | arch_initcall(bfin_gpio_init); | 430 | arch_initcall(bfin_gpio_init); |
434 | 431 | ||
@@ -833,20 +830,20 @@ int peripheral_request(unsigned short per, const char *label) | |||
833 | 830 | ||
834 | u16 funct = get_portmux(ident); | 831 | u16 funct = get_portmux(ident); |
835 | 832 | ||
836 | /* | 833 | /* |
837 | * Pin functions like AMC address strobes my | 834 | * Pin functions like AMC address strobes my |
838 | * be requested and used by several drivers | 835 | * be requested and used by several drivers |
839 | */ | 836 | */ |
840 | 837 | ||
841 | if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) { | 838 | if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) { |
842 | 839 | ||
843 | /* | 840 | /* |
844 | * Allow that the identical pin function can | 841 | * Allow that the identical pin function can |
845 | * be requested from the same driver twice | 842 | * be requested from the same driver twice |
846 | */ | 843 | */ |
847 | 844 | ||
848 | if (cmp_label(ident, label) == 0) | 845 | if (cmp_label(ident, label) == 0) |
849 | goto anyway; | 846 | goto anyway; |
850 | 847 | ||
851 | dump_stack(); | 848 | dump_stack(); |
852 | printk(KERN_ERR | 849 | printk(KERN_ERR |
@@ -857,7 +854,7 @@ int peripheral_request(unsigned short per, const char *label) | |||
857 | } | 854 | } |
858 | } | 855 | } |
859 | 856 | ||
860 | anyway: | 857 | anyway: |
861 | reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); | 858 | reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident); |
862 | 859 | ||
863 | portmux_setup(ident, P_FUNCT2MUX(per)); | 860 | portmux_setup(ident, P_FUNCT2MUX(per)); |
@@ -890,33 +887,33 @@ int peripheral_request(unsigned short per, const char *label) | |||
890 | 887 | ||
891 | if (!check_gpio(ident)) { | 888 | if (!check_gpio(ident)) { |
892 | 889 | ||
893 | if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) { | 890 | if (unlikely(reserved_gpio_map[gpio_bank(ident)] & gpio_bit(ident))) { |
894 | dump_stack(); | 891 | dump_stack(); |
895 | printk(KERN_ERR | 892 | printk(KERN_ERR |
896 | "%s: Peripheral %d is already reserved as GPIO by %s !\n", | 893 | "%s: Peripheral %d is already reserved as GPIO by %s !\n", |
897 | __FUNCTION__, ident, get_label(ident)); | 894 | __FUNCTION__, ident, get_label(ident)); |
898 | local_irq_restore(flags); | 895 | local_irq_restore(flags); |
899 | return -EBUSY; | 896 | return -EBUSY; |
900 | } | 897 | } |
901 | 898 | ||
902 | } | 899 | } |
903 | 900 | ||
904 | if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) { | 901 | if (unlikely(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident))) { |
905 | 902 | ||
906 | /* | 903 | /* |
907 | * Pin functions like AMC address strobes my | 904 | * Pin functions like AMC address strobes my |
908 | * be requested and used by several drivers | 905 | * be requested and used by several drivers |
909 | */ | 906 | */ |
910 | 907 | ||
911 | if (!(per & P_MAYSHARE)) { | 908 | if (!(per & P_MAYSHARE)) { |
912 | 909 | ||
913 | /* | 910 | /* |
914 | * Allow that the identical pin function can | 911 | * Allow that the identical pin function can |
915 | * be requested from the same driver twice | 912 | * be requested from the same driver twice |
916 | */ | 913 | */ |
917 | 914 | ||
918 | if (cmp_label(ident, label) == 0) | 915 | if (cmp_label(ident, label) == 0) |
919 | goto anyway; | 916 | goto anyway; |
920 | 917 | ||
921 | dump_stack(); | 918 | dump_stack(); |
922 | printk(KERN_ERR | 919 | printk(KERN_ERR |
@@ -930,7 +927,7 @@ int peripheral_request(unsigned short per, const char *label) | |||
930 | 927 | ||
931 | } | 928 | } |
932 | 929 | ||
933 | anyway: | 930 | anyway: |
934 | portmux_setup(per, P_FUNCT2MUX(per)); | 931 | portmux_setup(per, P_FUNCT2MUX(per)); |
935 | 932 | ||
936 | port_setup(ident, PERIPHERAL_USAGE); | 933 | port_setup(ident, PERIPHERAL_USAGE); |
@@ -954,10 +951,10 @@ int peripheral_request_list(unsigned short per[], const char *label) | |||
954 | ret = peripheral_request(per[cnt], label); | 951 | ret = peripheral_request(per[cnt], label); |
955 | 952 | ||
956 | if (ret < 0) { | 953 | if (ret < 0) { |
957 | for ( ; cnt > 0; cnt--) { | 954 | for ( ; cnt > 0; cnt--) |
958 | peripheral_free(per[cnt - 1]); | 955 | peripheral_free(per[cnt - 1]); |
959 | } | 956 | |
960 | return ret; | 957 | return ret; |
961 | } | 958 | } |
962 | } | 959 | } |
963 | 960 | ||
@@ -981,15 +978,13 @@ void peripheral_free(unsigned short per) | |||
981 | 978 | ||
982 | local_irq_save(flags); | 979 | local_irq_save(flags); |
983 | 980 | ||
984 | if (unlikely(!(reserved_peri_map[gpio_bank(ident)] | 981 | if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) { |
985 | & gpio_bit(ident)))) { | ||
986 | local_irq_restore(flags); | 982 | local_irq_restore(flags); |
987 | return; | 983 | return; |
988 | } | 984 | } |
989 | 985 | ||
990 | if (!(per & P_MAYSHARE)) { | 986 | if (!(per & P_MAYSHARE)) |
991 | port_setup(ident, GPIO_USAGE); | 987 | port_setup(ident, GPIO_USAGE); |
992 | } | ||
993 | 988 | ||
994 | reserved_peri_map[gpio_bank(ident)] &= ~gpio_bit(ident); | 989 | reserved_peri_map[gpio_bank(ident)] &= ~gpio_bit(ident); |
995 | 990 | ||
@@ -1002,11 +997,8 @@ EXPORT_SYMBOL(peripheral_free); | |||
1002 | void peripheral_free_list(unsigned short per[]) | 997 | void peripheral_free_list(unsigned short per[]) |
1003 | { | 998 | { |
1004 | u16 cnt; | 999 | u16 cnt; |
1005 | 1000 | for (cnt = 0; per[cnt] != 0; cnt++) | |
1006 | for (cnt = 0; per[cnt] != 0; cnt++) { | ||
1007 | peripheral_free(per[cnt]); | 1001 | peripheral_free(per[cnt]); |
1008 | } | ||
1009 | |||
1010 | } | 1002 | } |
1011 | EXPORT_SYMBOL(peripheral_free_list); | 1003 | EXPORT_SYMBOL(peripheral_free_list); |
1012 | 1004 | ||