diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 18:20:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 18:20:02 -0400 |
commit | 37d8cb5478651b27779b9a80d024c614c452eae3 (patch) | |
tree | 53fe55f595dea61ba8acd72bd19d2655513b7195 /drivers | |
parent | dc522adbee91dd17fa31f8e8cf72673fe0e8370e (diff) | |
parent | 07da0372dd6ca5517400ce95040861def25930c8 (diff) |
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
i2c-parport: Various cleanups
i2c-i801: Don't depend on other kernel driver config options
i2c-i801: Check for vendor Fujitsu before probing for apanel
i2c-i801: Don't probe for slaves on IDF channels
i2c-i801: SMBus patch for Intel Panther Point DeviceIDs
i2c/writing-clients: Fix foo_driver.id_table
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 61 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport-light.c | 10 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport.c | 30 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport.h | 74 |
5 files changed, 95 insertions, 82 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 326652f673f7..428d098c35ef 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -79,6 +79,7 @@ config I2C_AMD8111 | |||
79 | config I2C_I801 | 79 | config I2C_I801 |
80 | tristate "Intel 82801 (ICH/PCH)" | 80 | tristate "Intel 82801 (ICH/PCH)" |
81 | depends on PCI | 81 | depends on PCI |
82 | select CHECK_SIGNATURE if X86 && DMI | ||
82 | help | 83 | help |
83 | If you say yes to this option, support will be included for the Intel | 84 | If you say yes to this option, support will be included for the Intel |
84 | 801 family of mainboard I2C interfaces. Specifically, the following | 85 | 801 family of mainboard I2C interfaces. Specifically, the following |
@@ -101,6 +102,7 @@ config I2C_I801 | |||
101 | 6 Series (PCH) | 102 | 6 Series (PCH) |
102 | Patsburg (PCH) | 103 | Patsburg (PCH) |
103 | DH89xxCC (PCH) | 104 | DH89xxCC (PCH) |
105 | Panther Point (PCH) | ||
104 | 106 | ||
105 | This driver can also be built as a module. If so, the module | 107 | This driver can also be built as a module. If so, the module |
106 | will be called i2c-i801. | 108 | will be called i2c-i801. |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ec36208c9977..ab26840d0c70 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -50,6 +50,7 @@ | |||
50 | Patsburg (PCH) IDF 0x1d71 32 hard yes yes yes | 50 | Patsburg (PCH) IDF 0x1d71 32 hard yes yes yes |
51 | Patsburg (PCH) IDF 0x1d72 32 hard yes yes yes | 51 | Patsburg (PCH) IDF 0x1d72 32 hard yes yes yes |
52 | DH89xxCC (PCH) 0x2330 32 hard yes yes yes | 52 | DH89xxCC (PCH) 0x2330 32 hard yes yes yes |
53 | Panther Point (PCH) 0x1e22 32 hard yes yes yes | ||
53 | 54 | ||
54 | Features supported by this driver: | 55 | Features supported by this driver: |
55 | Software PEC no | 56 | Software PEC no |
@@ -137,11 +138,11 @@ | |||
137 | /* Older devices have their ID defined in <linux/pci_ids.h> */ | 138 | /* Older devices have their ID defined in <linux/pci_ids.h> */ |
138 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 | 139 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 |
139 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 | 140 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 |
140 | #define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22 | ||
141 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ | 141 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ |
142 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 0x1d70 | 142 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 0x1d70 |
143 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 0x1d71 | 143 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 0x1d71 |
144 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 0x1d72 | 144 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 0x1d72 |
145 | #define PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS 0x1e22 | ||
145 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 | 146 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 |
146 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 | 147 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 |
147 | 148 | ||
@@ -159,6 +160,8 @@ static struct pci_driver i801_driver; | |||
159 | #define FEATURE_BLOCK_BUFFER (1 << 1) | 160 | #define FEATURE_BLOCK_BUFFER (1 << 1) |
160 | #define FEATURE_BLOCK_PROC (1 << 2) | 161 | #define FEATURE_BLOCK_PROC (1 << 2) |
161 | #define FEATURE_I2C_BLOCK_READ (1 << 3) | 162 | #define FEATURE_I2C_BLOCK_READ (1 << 3) |
163 | /* Not really a feature, but it's convenient to handle it as such */ | ||
164 | #define FEATURE_IDF (1 << 15) | ||
162 | 165 | ||
163 | static const char *i801_feature_names[] = { | 166 | static const char *i801_feature_names[] = { |
164 | "SMBus PEC", | 167 | "SMBus PEC", |
@@ -629,12 +632,13 @@ static const struct pci_device_id i801_ids[] = { | |||
629 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1) }, | 632 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1) }, |
630 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2) }, | 633 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2) }, |
631 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) }, | 634 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) }, |
635 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS) }, | ||
632 | { 0, } | 636 | { 0, } |
633 | }; | 637 | }; |
634 | 638 | ||
635 | MODULE_DEVICE_TABLE(pci, i801_ids); | 639 | MODULE_DEVICE_TABLE(pci, i801_ids); |
636 | 640 | ||
637 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | 641 | #if defined CONFIG_X86 && defined CONFIG_DMI |
638 | static unsigned char apanel_addr; | 642 | static unsigned char apanel_addr; |
639 | 643 | ||
640 | /* Scan the system ROM for the signature "FJKEYINF" */ | 644 | /* Scan the system ROM for the signature "FJKEYINF" */ |
@@ -664,11 +668,7 @@ static void __init input_apanel_init(void) | |||
664 | } | 668 | } |
665 | iounmap(bios); | 669 | iounmap(bios); |
666 | } | 670 | } |
667 | #else | ||
668 | static void __init input_apanel_init(void) {} | ||
669 | #endif | ||
670 | 671 | ||
671 | #if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE | ||
672 | struct dmi_onboard_device_info { | 672 | struct dmi_onboard_device_info { |
673 | const char *name; | 673 | const char *name; |
674 | u8 type; | 674 | u8 type; |
@@ -734,7 +734,30 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, | |||
734 | dmi_check_onboard_device(type, name, adap); | 734 | dmi_check_onboard_device(type, name, adap); |
735 | } | 735 | } |
736 | } | 736 | } |
737 | #endif | 737 | |
738 | /* Register optional slaves */ | ||
739 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) | ||
740 | { | ||
741 | /* Only register slaves on main SMBus channel */ | ||
742 | if (priv->features & FEATURE_IDF) | ||
743 | return; | ||
744 | |||
745 | if (apanel_addr) { | ||
746 | struct i2c_board_info info; | ||
747 | |||
748 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
749 | info.addr = apanel_addr; | ||
750 | strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE); | ||
751 | i2c_new_device(&priv->adapter, &info); | ||
752 | } | ||
753 | |||
754 | if (dmi_name_in_vendors("FUJITSU")) | ||
755 | dmi_walk(dmi_check_onboard_devices, &priv->adapter); | ||
756 | } | ||
757 | #else | ||
758 | static void __init input_apanel_init(void) {} | ||
759 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} | ||
760 | #endif /* CONFIG_X86 && CONFIG_DMI */ | ||
738 | 761 | ||
739 | static int __devinit i801_probe(struct pci_dev *dev, | 762 | static int __devinit i801_probe(struct pci_dev *dev, |
740 | const struct pci_device_id *id) | 763 | const struct pci_device_id *id) |
@@ -754,6 +777,11 @@ static int __devinit i801_probe(struct pci_dev *dev, | |||
754 | 777 | ||
755 | priv->pci_dev = dev; | 778 | priv->pci_dev = dev; |
756 | switch (dev->device) { | 779 | switch (dev->device) { |
780 | case PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0: | ||
781 | case PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1: | ||
782 | case PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2: | ||
783 | priv->features |= FEATURE_IDF; | ||
784 | /* fall through */ | ||
757 | default: | 785 | default: |
758 | priv->features |= FEATURE_I2C_BLOCK_READ; | 786 | priv->features |= FEATURE_I2C_BLOCK_READ; |
759 | /* fall through */ | 787 | /* fall through */ |
@@ -839,21 +867,7 @@ static int __devinit i801_probe(struct pci_dev *dev, | |||
839 | goto exit_release; | 867 | goto exit_release; |
840 | } | 868 | } |
841 | 869 | ||
842 | /* Register optional slaves */ | 870 | i801_probe_optional_slaves(priv); |
843 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | ||
844 | if (apanel_addr) { | ||
845 | struct i2c_board_info info; | ||
846 | |||
847 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
848 | info.addr = apanel_addr; | ||
849 | strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE); | ||
850 | i2c_new_device(&priv->adapter, &info); | ||
851 | } | ||
852 | #endif | ||
853 | #if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE | ||
854 | if (dmi_name_in_vendors("FUJITSU")) | ||
855 | dmi_walk(dmi_check_onboard_devices, &priv->adapter); | ||
856 | #endif | ||
857 | 871 | ||
858 | pci_set_drvdata(dev, priv); | 872 | pci_set_drvdata(dev, priv); |
859 | return 0; | 873 | return 0; |
@@ -913,7 +927,8 @@ static struct pci_driver i801_driver = { | |||
913 | 927 | ||
914 | static int __init i2c_i801_init(void) | 928 | static int __init i2c_i801_init(void) |
915 | { | 929 | { |
916 | input_apanel_init(); | 930 | if (dmi_name_in_vendors("FUJITSU")) |
931 | input_apanel_init(); | ||
917 | return pci_register_driver(&i801_driver); | 932 | return pci_register_driver(&i801_driver); |
918 | } | 933 | } |
919 | 934 | ||
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index fc5fbd1012c9..4b95f7a63a3b 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c | |||
@@ -2,13 +2,13 @@ | |||
2 | * i2c-parport-light.c I2C bus over parallel port * | 2 | * i2c-parport-light.c I2C bus over parallel port * |
3 | * ------------------------------------------------------------------------ * | 3 | * ------------------------------------------------------------------------ * |
4 | Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> | 4 | Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> |
5 | 5 | ||
6 | Based on older i2c-velleman.c driver | 6 | Based on older i2c-velleman.c driver |
7 | Copyright (C) 1995-2000 Simon G. Vogl | 7 | Copyright (C) 1995-2000 Simon G. Vogl |
8 | With some changes from: | 8 | With some changes from: |
9 | Frodo Looijaard <frodol@dds.nl> | 9 | Frodo Looijaard <frodol@dds.nl> |
10 | Kyösti Mälkki <kmalkki@cc.hut.fi> | 10 | Kyösti Mälkki <kmalkki@cc.hut.fi> |
11 | 11 | ||
12 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
13 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
14 | the Free Software Foundation; either version 2 of the License, or | 14 | the Free Software Foundation; either version 2 of the License, or |
@@ -114,7 +114,7 @@ static struct i2c_algo_bit_data parport_algo_data = { | |||
114 | .getscl = parport_getscl, | 114 | .getscl = parport_getscl, |
115 | .udelay = 50, | 115 | .udelay = 50, |
116 | .timeout = HZ, | 116 | .timeout = HZ, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | /* ----- Driver registration ---------------------------------------------- */ | 119 | /* ----- Driver registration ---------------------------------------------- */ |
120 | 120 | ||
@@ -132,7 +132,7 @@ static struct i2c_smbus_alert_setup alert_data = { | |||
132 | static struct i2c_client *ara; | 132 | static struct i2c_client *ara; |
133 | static struct lineop parport_ctrl_irq = { | 133 | static struct lineop parport_ctrl_irq = { |
134 | .val = (1 << 4), | 134 | .val = (1 << 4), |
135 | .port = CTRL, | 135 | .port = PORT_CTRL, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static int __devinit i2c_parport_probe(struct platform_device *pdev) | 138 | static int __devinit i2c_parport_probe(struct platform_device *pdev) |
@@ -245,7 +245,7 @@ static int __init i2c_parport_init(void) | |||
245 | if (irq != 0) | 245 | if (irq != 0) |
246 | pr_info(DRVNAME ": using irq %d\n", irq); | 246 | pr_info(DRVNAME ": using irq %d\n", irq); |
247 | 247 | ||
248 | if (!adapter_parm[type].getscl.val) | 248 | if (!adapter_parm[type].getscl.val) |
249 | parport_algo_data.getscl = NULL; | 249 | parport_algo_data.getscl = NULL; |
250 | 250 | ||
251 | /* Sets global pdev as a side effect */ | 251 | /* Sets global pdev as a side effect */ |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 2dbba163b102..24565687ac9b 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -2,13 +2,13 @@ | |||
2 | * i2c-parport.c I2C bus over parallel port * | 2 | * i2c-parport.c I2C bus over parallel port * |
3 | * ------------------------------------------------------------------------ * | 3 | * ------------------------------------------------------------------------ * |
4 | Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org> | 4 | Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org> |
5 | 5 | ||
6 | Based on older i2c-philips-par.c driver | 6 | Based on older i2c-philips-par.c driver |
7 | Copyright (C) 1995-2000 Simon G. Vogl | 7 | Copyright (C) 1995-2000 Simon G. Vogl |
8 | With some changes from: | 8 | With some changes from: |
9 | Frodo Looijaard <frodol@dds.nl> | 9 | Frodo Looijaard <frodol@dds.nl> |
10 | Kyösti Mälkki <kmalkki@cc.hut.fi> | 10 | Kyösti Mälkki <kmalkki@cc.hut.fi> |
11 | 11 | ||
12 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
13 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
14 | the Free Software Foundation; either version 2 of the License, or | 14 | the Free Software Foundation; either version 2 of the License, or |
@@ -78,13 +78,13 @@ static unsigned char port_read_control(struct parport *p) | |||
78 | return parport_read_control(p); | 78 | return parport_read_control(p); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void (*port_write[])(struct parport *, unsigned char) = { | 81 | static void (* const port_write[])(struct parport *, unsigned char) = { |
82 | port_write_data, | 82 | port_write_data, |
83 | NULL, | 83 | NULL, |
84 | port_write_control, | 84 | port_write_control, |
85 | }; | 85 | }; |
86 | 86 | ||
87 | static unsigned char (*port_read[])(struct parport *) = { | 87 | static unsigned char (* const port_read[])(struct parport *) = { |
88 | port_read_data, | 88 | port_read_data, |
89 | port_read_status, | 89 | port_read_status, |
90 | port_read_control, | 90 | port_read_control, |
@@ -147,7 +147,7 @@ static const struct i2c_algo_bit_data parport_algo_data = { | |||
147 | .getscl = parport_getscl, | 147 | .getscl = parport_getscl, |
148 | .udelay = 10, /* ~50 kbps */ | 148 | .udelay = 10, /* ~50 kbps */ |
149 | .timeout = HZ, | 149 | .timeout = HZ, |
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* ----- I2c and parallel port call-back functions and structures --------- */ | 152 | /* ----- I2c and parallel port call-back functions and structures --------- */ |
153 | 153 | ||
@@ -164,10 +164,10 @@ void i2c_parport_irq(void *data) | |||
164 | "SMBus alert received but no ARA client!\n"); | 164 | "SMBus alert received but no ARA client!\n"); |
165 | } | 165 | } |
166 | 166 | ||
167 | static void i2c_parport_attach (struct parport *port) | 167 | static void i2c_parport_attach(struct parport *port) |
168 | { | 168 | { |
169 | struct i2c_par *adapter; | 169 | struct i2c_par *adapter; |
170 | 170 | ||
171 | adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); | 171 | adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); |
172 | if (adapter == NULL) { | 172 | if (adapter == NULL) { |
173 | printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); | 173 | printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); |
@@ -180,7 +180,7 @@ static void i2c_parport_attach (struct parport *port) | |||
180 | NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter); | 180 | NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter); |
181 | if (!adapter->pdev) { | 181 | if (!adapter->pdev) { |
182 | printk(KERN_ERR "i2c-parport: Unable to register with parport\n"); | 182 | printk(KERN_ERR "i2c-parport: Unable to register with parport\n"); |
183 | goto ERROR0; | 183 | goto err_free; |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Fill the rest of the structure */ | 186 | /* Fill the rest of the structure */ |
@@ -200,7 +200,7 @@ static void i2c_parport_attach (struct parport *port) | |||
200 | 200 | ||
201 | if (parport_claim_or_block(adapter->pdev) < 0) { | 201 | if (parport_claim_or_block(adapter->pdev) < 0) { |
202 | printk(KERN_ERR "i2c-parport: Could not claim parallel port\n"); | 202 | printk(KERN_ERR "i2c-parport: Could not claim parallel port\n"); |
203 | goto ERROR1; | 203 | goto err_unregister; |
204 | } | 204 | } |
205 | 205 | ||
206 | /* Reset hardware to a sane state (SCL and SDA high) */ | 206 | /* Reset hardware to a sane state (SCL and SDA high) */ |
@@ -215,7 +215,7 @@ static void i2c_parport_attach (struct parport *port) | |||
215 | 215 | ||
216 | if (i2c_bit_add_bus(&adapter->adapter) < 0) { | 216 | if (i2c_bit_add_bus(&adapter->adapter) < 0) { |
217 | printk(KERN_ERR "i2c-parport: Unable to register with I2C\n"); | 217 | printk(KERN_ERR "i2c-parport: Unable to register with I2C\n"); |
218 | goto ERROR1; | 218 | goto err_unregister; |
219 | } | 219 | } |
220 | 220 | ||
221 | /* Setup SMBus alert if supported */ | 221 | /* Setup SMBus alert if supported */ |
@@ -234,16 +234,16 @@ static void i2c_parport_attach (struct parport *port) | |||
234 | mutex_lock(&adapter_list_lock); | 234 | mutex_lock(&adapter_list_lock); |
235 | list_add_tail(&adapter->node, &adapter_list); | 235 | list_add_tail(&adapter->node, &adapter_list); |
236 | mutex_unlock(&adapter_list_lock); | 236 | mutex_unlock(&adapter_list_lock); |
237 | return; | 237 | return; |
238 | 238 | ||
239 | ERROR1: | 239 | err_unregister: |
240 | parport_release(adapter->pdev); | 240 | parport_release(adapter->pdev); |
241 | parport_unregister_device(adapter->pdev); | 241 | parport_unregister_device(adapter->pdev); |
242 | ERROR0: | 242 | err_free: |
243 | kfree(adapter); | 243 | kfree(adapter); |
244 | } | 244 | } |
245 | 245 | ||
246 | static void i2c_parport_detach (struct parport *port) | 246 | static void i2c_parport_detach(struct parport *port) |
247 | { | 247 | { |
248 | struct i2c_par *adapter, *_n; | 248 | struct i2c_par *adapter, *_n; |
249 | 249 | ||
@@ -260,7 +260,7 @@ static void i2c_parport_detach (struct parport *port) | |||
260 | /* Un-init if needed (power off...) */ | 260 | /* Un-init if needed (power off...) */ |
261 | if (adapter_parm[type].init.val) | 261 | if (adapter_parm[type].init.val) |
262 | line_set(port, 0, &adapter_parm[type].init); | 262 | line_set(port, 0, &adapter_parm[type].init); |
263 | 263 | ||
264 | parport_release(adapter->pdev); | 264 | parport_release(adapter->pdev); |
265 | parport_unregister_device(adapter->pdev); | 265 | parport_unregister_device(adapter->pdev); |
266 | list_del(&adapter->node); | 266 | list_del(&adapter->node); |
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index a9f66816546c..3fe652302ea7 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * i2c-parport.h I2C bus over parallel port * | 2 | * i2c-parport.h I2C bus over parallel port * |
3 | * ------------------------------------------------------------------------ * | 3 | * ------------------------------------------------------------------------ * |
4 | Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> | 4 | Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
@@ -18,13 +18,9 @@ | |||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | * ------------------------------------------------------------------------ */ | 19 | * ------------------------------------------------------------------------ */ |
20 | 20 | ||
21 | #ifdef DATA | 21 | #define PORT_DATA 0 |
22 | #undef DATA | 22 | #define PORT_STAT 1 |
23 | #endif | 23 | #define PORT_CTRL 2 |
24 | |||
25 | #define DATA 0 | ||
26 | #define STAT 1 | ||
27 | #define CTRL 2 | ||
28 | 24 | ||
29 | struct lineop { | 25 | struct lineop { |
30 | u8 val; | 26 | u8 val; |
@@ -41,61 +37,61 @@ struct adapter_parm { | |||
41 | unsigned int smbus_alert:1; | 37 | unsigned int smbus_alert:1; |
42 | }; | 38 | }; |
43 | 39 | ||
44 | static struct adapter_parm adapter_parm[] = { | 40 | static const struct adapter_parm adapter_parm[] = { |
45 | /* type 0: Philips adapter */ | 41 | /* type 0: Philips adapter */ |
46 | { | 42 | { |
47 | .setsda = { 0x80, DATA, 1 }, | 43 | .setsda = { 0x80, PORT_DATA, 1 }, |
48 | .setscl = { 0x08, CTRL, 0 }, | 44 | .setscl = { 0x08, PORT_CTRL, 0 }, |
49 | .getsda = { 0x80, STAT, 0 }, | 45 | .getsda = { 0x80, PORT_STAT, 0 }, |
50 | .getscl = { 0x08, STAT, 0 }, | 46 | .getscl = { 0x08, PORT_STAT, 0 }, |
51 | }, | 47 | }, |
52 | /* type 1: home brew teletext adapter */ | 48 | /* type 1: home brew teletext adapter */ |
53 | { | 49 | { |
54 | .setsda = { 0x02, DATA, 0 }, | 50 | .setsda = { 0x02, PORT_DATA, 0 }, |
55 | .setscl = { 0x01, DATA, 0 }, | 51 | .setscl = { 0x01, PORT_DATA, 0 }, |
56 | .getsda = { 0x80, STAT, 1 }, | 52 | .getsda = { 0x80, PORT_STAT, 1 }, |
57 | }, | 53 | }, |
58 | /* type 2: Velleman K8000 adapter */ | 54 | /* type 2: Velleman K8000 adapter */ |
59 | { | 55 | { |
60 | .setsda = { 0x02, CTRL, 1 }, | 56 | .setsda = { 0x02, PORT_CTRL, 1 }, |
61 | .setscl = { 0x08, CTRL, 1 }, | 57 | .setscl = { 0x08, PORT_CTRL, 1 }, |
62 | .getsda = { 0x10, STAT, 0 }, | 58 | .getsda = { 0x10, PORT_STAT, 0 }, |
63 | }, | 59 | }, |
64 | /* type 3: ELV adapter */ | 60 | /* type 3: ELV adapter */ |
65 | { | 61 | { |
66 | .setsda = { 0x02, DATA, 1 }, | 62 | .setsda = { 0x02, PORT_DATA, 1 }, |
67 | .setscl = { 0x01, DATA, 1 }, | 63 | .setscl = { 0x01, PORT_DATA, 1 }, |
68 | .getsda = { 0x40, STAT, 1 }, | 64 | .getsda = { 0x40, PORT_STAT, 1 }, |
69 | .getscl = { 0x08, STAT, 1 }, | 65 | .getscl = { 0x08, PORT_STAT, 1 }, |
70 | }, | 66 | }, |
71 | /* type 4: ADM1032 evaluation board */ | 67 | /* type 4: ADM1032 evaluation board */ |
72 | { | 68 | { |
73 | .setsda = { 0x02, DATA, 1 }, | 69 | .setsda = { 0x02, PORT_DATA, 1 }, |
74 | .setscl = { 0x01, DATA, 1 }, | 70 | .setscl = { 0x01, PORT_DATA, 1 }, |
75 | .getsda = { 0x10, STAT, 1 }, | 71 | .getsda = { 0x10, PORT_STAT, 1 }, |
76 | .init = { 0xf0, DATA, 0 }, | 72 | .init = { 0xf0, PORT_DATA, 0 }, |
77 | .smbus_alert = 1, | 73 | .smbus_alert = 1, |
78 | }, | 74 | }, |
79 | /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ | 75 | /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ |
80 | { | 76 | { |
81 | .setsda = { 0x02, DATA, 1 }, | 77 | .setsda = { 0x02, PORT_DATA, 1 }, |
82 | .setscl = { 0x01, DATA, 1 }, | 78 | .setscl = { 0x01, PORT_DATA, 1 }, |
83 | .getsda = { 0x10, STAT, 1 }, | 79 | .getsda = { 0x10, PORT_STAT, 1 }, |
84 | }, | 80 | }, |
85 | /* type 6: Barco LPT->DVI (K5800236) adapter */ | 81 | /* type 6: Barco LPT->DVI (K5800236) adapter */ |
86 | { | 82 | { |
87 | .setsda = { 0x02, DATA, 1 }, | 83 | .setsda = { 0x02, PORT_DATA, 1 }, |
88 | .setscl = { 0x01, DATA, 1 }, | 84 | .setscl = { 0x01, PORT_DATA, 1 }, |
89 | .getsda = { 0x20, STAT, 0 }, | 85 | .getsda = { 0x20, PORT_STAT, 0 }, |
90 | .getscl = { 0x40, STAT, 0 }, | 86 | .getscl = { 0x40, PORT_STAT, 0 }, |
91 | .init = { 0xfc, DATA, 0 }, | 87 | .init = { 0xfc, PORT_DATA, 0 }, |
92 | }, | 88 | }, |
93 | /* type 7: One For All JP1 parallel port adapter */ | 89 | /* type 7: One For All JP1 parallel port adapter */ |
94 | { | 90 | { |
95 | .setsda = { 0x01, DATA, 0 }, | 91 | .setsda = { 0x01, PORT_DATA, 0 }, |
96 | .setscl = { 0x02, DATA, 0 }, | 92 | .setscl = { 0x02, PORT_DATA, 0 }, |
97 | .getsda = { 0x80, STAT, 1 }, | 93 | .getsda = { 0x80, PORT_STAT, 1 }, |
98 | .init = { 0x04, DATA, 1 }, | 94 | .init = { 0x04, PORT_DATA, 1 }, |
99 | }, | 95 | }, |
100 | }; | 96 | }; |
101 | 97 | ||