aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/tps65010.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-18 17:16:04 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:21:51 -0500
commit5c085d369c2c4f18942ec8951466e186366d5c78 (patch)
tree22ca525700049a402281a0503b07db0645075f58 /drivers/i2c/chips/tps65010.c
parent7656032b904b936eca65a41afa1f2b3603195657 (diff)
[PATCH] i2c: Semaphore to mutex conversions, part 2
semaphore to mutex conversion. the conversion was generated via scripts, and the result was validated automatically via a script as well. build tested. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/chips/tps65010.c')
-rw-r--r--drivers/i2c/chips/tps65010.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index 1af3dfbb8086..179b1e022d80 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -32,6 +32,7 @@
32#include <linux/suspend.h> 32#include <linux/suspend.h>
33#include <linux/debugfs.h> 33#include <linux/debugfs.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/mutex.h>
35 36
36#include <asm/irq.h> 37#include <asm/irq.h>
37#include <asm/mach-types.h> 38#include <asm/mach-types.h>
@@ -81,7 +82,7 @@ enum tps_model {
81 82
82struct tps65010 { 83struct tps65010 {
83 struct i2c_client client; 84 struct i2c_client client;
84 struct semaphore lock; 85 struct mutex lock;
85 int irq; 86 int irq;
86 struct work_struct work; 87 struct work_struct work;
87 struct dentry *file; 88 struct dentry *file;
@@ -218,7 +219,7 @@ static int dbg_show(struct seq_file *s, void *_)
218 seq_printf(s, "driver %s\nversion %s\nchip %s\n\n", 219 seq_printf(s, "driver %s\nversion %s\nchip %s\n\n",
219 DRIVER_NAME, DRIVER_VERSION, chip); 220 DRIVER_NAME, DRIVER_VERSION, chip);
220 221
221 down(&tps->lock); 222 mutex_lock(&tps->lock);
222 223
223 /* FIXME how can we tell whether a battery is present? 224 /* FIXME how can we tell whether a battery is present?
224 * likely involves a charge gauging chip (like BQ26501). 225 * likely involves a charge gauging chip (like BQ26501).
@@ -300,7 +301,7 @@ static int dbg_show(struct seq_file *s, void *_)
300 (v2 & (1 << (4 + i))) ? "rising" : "falling"); 301 (v2 & (1 << (4 + i))) ? "rising" : "falling");
301 } 302 }
302 303
303 up(&tps->lock); 304 mutex_unlock(&tps->lock);
304 return 0; 305 return 0;
305} 306}
306 307
@@ -416,7 +417,7 @@ static void tps65010_work(void *_tps)
416{ 417{
417 struct tps65010 *tps = _tps; 418 struct tps65010 *tps = _tps;
418 419
419 down(&tps->lock); 420 mutex_lock(&tps->lock);
420 421
421 tps65010_interrupt(tps); 422 tps65010_interrupt(tps);
422 423
@@ -444,7 +445,7 @@ static void tps65010_work(void *_tps)
444 if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags)) 445 if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags))
445 enable_irq(tps->irq); 446 enable_irq(tps->irq);
446 447
447 up(&tps->lock); 448 mutex_unlock(&tps->lock);
448} 449}
449 450
450static irqreturn_t tps65010_irq(int irq, void *_tps, struct pt_regs *regs) 451static irqreturn_t tps65010_irq(int irq, void *_tps, struct pt_regs *regs)
@@ -505,7 +506,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
505 if (!tps) 506 if (!tps)
506 return 0; 507 return 0;
507 508
508 init_MUTEX(&tps->lock); 509 mutex_init(&tps->lock);
509 INIT_WORK(&tps->work, tps65010_work, tps); 510 INIT_WORK(&tps->work, tps65010_work, tps);
510 tps->irq = -1; 511 tps->irq = -1;
511 tps->client.addr = address; 512 tps->client.addr = address;
@@ -695,7 +696,7 @@ int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
695 if ((gpio < GPIO1) || (gpio > GPIO4)) 696 if ((gpio < GPIO1) || (gpio > GPIO4))
696 return -EINVAL; 697 return -EINVAL;
697 698
698 down(&the_tps->lock); 699 mutex_lock(&the_tps->lock);
699 700
700 defgpio = i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO); 701 defgpio = i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO);
701 702
@@ -720,7 +721,7 @@ int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
720 gpio, value ? "high" : "low", 721 gpio, value ? "high" : "low",
721 i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO)); 722 i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO));
722 723
723 up(&the_tps->lock); 724 mutex_unlock(&the_tps->lock);
724 return status; 725 return status;
725} 726}
726EXPORT_SYMBOL(tps65010_set_gpio_out_value); 727EXPORT_SYMBOL(tps65010_set_gpio_out_value);
@@ -745,7 +746,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
745 led = LED2; 746 led = LED2;
746 } 747 }
747 748
748 down(&the_tps->lock); 749 mutex_lock(&the_tps->lock);
749 750
750 pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, 751 pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led,
751 i2c_smbus_read_byte_data(&the_tps->client, 752 i2c_smbus_read_byte_data(&the_tps->client,
@@ -771,7 +772,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
771 default: 772 default:
772 printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n", 773 printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n",
773 DRIVER_NAME); 774 DRIVER_NAME);
774 up(&the_tps->lock); 775 mutex_unlock(&the_tps->lock);
775 return -EINVAL; 776 return -EINVAL;
776 } 777 }
777 778
@@ -781,7 +782,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
781 if (status != 0) { 782 if (status != 0) {
782 printk(KERN_ERR "%s: Failed to write led%i_on register\n", 783 printk(KERN_ERR "%s: Failed to write led%i_on register\n",
783 DRIVER_NAME, led); 784 DRIVER_NAME, led);
784 up(&the_tps->lock); 785 mutex_unlock(&the_tps->lock);
785 return status; 786 return status;
786 } 787 }
787 788
@@ -794,7 +795,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
794 if (status != 0) { 795 if (status != 0) {
795 printk(KERN_ERR "%s: Failed to write led%i_per register\n", 796 printk(KERN_ERR "%s: Failed to write led%i_per register\n",
796 DRIVER_NAME, led); 797 DRIVER_NAME, led);
797 up(&the_tps->lock); 798 mutex_unlock(&the_tps->lock);
798 return status; 799 return status;
799 } 800 }
800 801
@@ -802,7 +803,7 @@ int tps65010_set_led(unsigned led, unsigned mode)
802 i2c_smbus_read_byte_data(&the_tps->client, 803 i2c_smbus_read_byte_data(&the_tps->client,
803 TPS_LED1_PER + offs)); 804 TPS_LED1_PER + offs));
804 805
805 up(&the_tps->lock); 806 mutex_unlock(&the_tps->lock);
806 807
807 return status; 808 return status;
808} 809}
@@ -820,7 +821,7 @@ int tps65010_set_vib(unsigned value)
820 if (!the_tps) 821 if (!the_tps)
821 return -ENODEV; 822 return -ENODEV;
822 823
823 down(&the_tps->lock); 824 mutex_lock(&the_tps->lock);
824 825
825 vdcdc2 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC2); 826 vdcdc2 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC2);
826 vdcdc2 &= ~(1 << 1); 827 vdcdc2 &= ~(1 << 1);
@@ -831,7 +832,7 @@ int tps65010_set_vib(unsigned value)
831 832
832 pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off"); 833 pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off");
833 834
834 up(&the_tps->lock); 835 mutex_unlock(&the_tps->lock);
835 return status; 836 return status;
836} 837}
837EXPORT_SYMBOL(tps65010_set_vib); 838EXPORT_SYMBOL(tps65010_set_vib);
@@ -848,7 +849,7 @@ int tps65010_set_low_pwr(unsigned mode)
848 if (!the_tps) 849 if (!the_tps)
849 return -ENODEV; 850 return -ENODEV;
850 851
851 down(&the_tps->lock); 852 mutex_lock(&the_tps->lock);
852 853
853 pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME, 854 pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME,
854 mode ? "enable" : "disable", 855 mode ? "enable" : "disable",
@@ -876,7 +877,7 @@ int tps65010_set_low_pwr(unsigned mode)
876 pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, 877 pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
877 i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); 878 i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
878 879
879 up(&the_tps->lock); 880 mutex_unlock(&the_tps->lock);
880 881
881 return status; 882 return status;
882} 883}
@@ -894,7 +895,7 @@ int tps65010_config_vregs1(unsigned value)
894 if (!the_tps) 895 if (!the_tps)
895 return -ENODEV; 896 return -ENODEV;
896 897
897 down(&the_tps->lock); 898 mutex_lock(&the_tps->lock);
898 899
899 pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, 900 pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
900 i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); 901 i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
@@ -909,7 +910,7 @@ int tps65010_config_vregs1(unsigned value)
909 pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, 910 pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
910 i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); 911 i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
911 912
912 up(&the_tps->lock); 913 mutex_unlock(&the_tps->lock);
913 914
914 return status; 915 return status;
915} 916}
@@ -931,7 +932,7 @@ int tps65013_set_low_pwr(unsigned mode)
931 if (!the_tps || the_tps->por) 932 if (!the_tps || the_tps->por)
932 return -ENODEV; 933 return -ENODEV;
933 934
934 down(&the_tps->lock); 935 mutex_lock(&the_tps->lock);
935 936
936 pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n", 937 pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n",
937 DRIVER_NAME, 938 DRIVER_NAME,
@@ -959,7 +960,7 @@ int tps65013_set_low_pwr(unsigned mode)
959 if (status != 0) { 960 if (status != 0) {
960 printk(KERN_ERR "%s: Failed to write chconfig register\n", 961 printk(KERN_ERR "%s: Failed to write chconfig register\n",
961 DRIVER_NAME); 962 DRIVER_NAME);
962 up(&the_tps->lock); 963 mutex_unlock(&the_tps->lock);
963 return status; 964 return status;
964 } 965 }
965 966
@@ -977,7 +978,7 @@ int tps65013_set_low_pwr(unsigned mode)
977 pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, 978 pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
978 i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); 979 i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
979 980
980 up(&the_tps->lock); 981 mutex_unlock(&the_tps->lock);
981 982
982 return status; 983 return status;
983} 984}