diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 18:25:08 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 18:25:08 -0500 |
| commit | 0feb9bfcfa3f9bf67a4a1e3f2608700ad73f92ed (patch) | |
| tree | 22c71657387b42787bc070502899a881ed909f39 | |
| parent | d8d8f6a4fd635dcc9e4f946394c1fbde85eeab66 (diff) | |
| parent | ccf18968b1bbc2fb117190a1984ac2a826dac228 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
124 files changed, 1550 insertions, 747 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 8ae8dad8e150..9474501dd6cc 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -71,15 +71,6 @@ Who: Mauro Carvalho Chehab <mchehab@brturbo.com.br> | |||
| 71 | 71 | ||
| 72 | --------------------------- | 72 | --------------------------- |
| 73 | 73 | ||
| 74 | What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid | ||
| 75 | When: November 2005 | ||
| 76 | Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c | ||
| 77 | Why: Match the other drivers' name for the same function, duplicate names | ||
| 78 | will be available until removal of old names. | ||
| 79 | Who: Grant Coady <gcoady@gmail.com> | ||
| 80 | |||
| 81 | --------------------------- | ||
| 82 | |||
| 83 | What: remove EXPORT_SYMBOL(panic_timeout) | 74 | What: remove EXPORT_SYMBOL(panic_timeout) |
| 84 | When: April 2006 | 75 | When: April 2006 |
| 85 | Files: kernel/panic.c | 76 | Files: kernel/panic.c |
diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf index 78f37c2d602e..5d23776e9907 100644 --- a/Documentation/hwmon/w83627hf +++ b/Documentation/hwmon/w83627hf | |||
| @@ -54,13 +54,16 @@ If you really want i2c accesses for these Super I/O chips, | |||
| 54 | use the w83781d driver. However this is not the preferred method | 54 | use the w83781d driver. However this is not the preferred method |
| 55 | now that this ISA driver has been developed. | 55 | now that this ISA driver has been developed. |
| 56 | 56 | ||
| 57 | Technically, the w83627thf does not support a VID reading. However, it's | 57 | The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the |
| 58 | possible or even likely that your mainboard maker has routed these signals | 58 | same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a |
| 59 | to a specific set of general purpose IO pins (the Asus P4C800-E is one such | 59 | VID reading. However the two chips have the identical 128 pin package. So, |
| 60 | board). The w83627thf driver now interprets these as VID. If the VID on | 60 | it is possible or even likely for a w83627thf to have the VID signals routed |
| 61 | your board doesn't work, first see doc/vid in the lm_sensors package. If | 61 | to these pins despite their not being labeled for that purpose. Therefore, |
| 62 | that still doesn't help, email us at lm-sensors@lm-sensors.org. | 62 | the w83627thf driver interprets these as VID. If the VID on your board |
| 63 | doesn't work, first see doc/vid in the lm_sensors package[1]. If that still | ||
| 64 | doesn't help, you may just ignore the bogus VID reading with no harm done. | ||
| 63 | 65 | ||
| 64 | For further information on this driver see the w83781d driver | 66 | For further information on this driver see the w83781d driver documentation. |
| 65 | documentation. | 67 | |
| 68 | [1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid | ||
| 66 | 69 | ||
diff --git a/Documentation/i2c/busses/i2c-nforce2 b/Documentation/i2c/busses/i2c-nforce2 index e379e182e64f..d751282d9b2a 100644 --- a/Documentation/i2c/busses/i2c-nforce2 +++ b/Documentation/i2c/busses/i2c-nforce2 | |||
| @@ -5,7 +5,8 @@ Supported adapters: | |||
| 5 | * nForce2 Ultra 400 MCP 10de:0084 | 5 | * nForce2 Ultra 400 MCP 10de:0084 |
| 6 | * nForce3 Pro150 MCP 10de:00D4 | 6 | * nForce3 Pro150 MCP 10de:00D4 |
| 7 | * nForce3 250Gb MCP 10de:00E4 | 7 | * nForce3 250Gb MCP 10de:00E4 |
| 8 | * nForce4 MCP 10de:0052 | 8 | * nForce4 MCP 10de:0052 |
| 9 | * nForce4 MCP-04 10de:0034 | ||
| 9 | 10 | ||
| 10 | Datasheet: not publically available, but seems to be similar to the | 11 | Datasheet: not publically available, but seems to be similar to the |
| 11 | AMD-8111 SMBus 2.0 adapter. | 12 | AMD-8111 SMBus 2.0 adapter. |
diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport index 9f1d0082da18..d9f23c0763f1 100644 --- a/Documentation/i2c/busses/i2c-parport +++ b/Documentation/i2c/busses/i2c-parport | |||
| @@ -17,6 +17,7 @@ It currently supports the following devices: | |||
| 17 | * Velleman K8000 adapter | 17 | * Velleman K8000 adapter |
| 18 | * ELV adapter | 18 | * ELV adapter |
| 19 | * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) | 19 | * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) |
| 20 | * Barco LPT->DVI (K5800236) adapter | ||
| 20 | 21 | ||
| 21 | These devices use different pinout configurations, so you have to tell | 22 | These devices use different pinout configurations, so you have to tell |
| 22 | the driver what you have, using the type module parameter. There is no | 23 | the driver what you have, using the type module parameter. There is no |
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 184fac2377aa..f03c2a02f806 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | Revision 5, 2005-07-29 | 1 | Revision 6, 2005-11-20 |
| 2 | Jean Delvare <khali@linux-fr.org> | 2 | Jean Delvare <khali@linux-fr.org> |
| 3 | Greg KH <greg@kroah.com> | 3 | Greg KH <greg@kroah.com> |
| 4 | 4 | ||
| 5 | This is a guide on how to convert I2C chip drivers from Linux 2.4 to | 5 | This is a guide on how to convert I2C chip drivers from Linux 2.4 to |
| 6 | Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. | 6 | Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. |
| 7 | Then I converted a driver myself (lm83) and updated this document. | 7 | Then I converted a driver myself (lm83) and updated this document. |
| 8 | Note that this guide is strongly oriented towards hardware monitoring | ||
| 9 | drivers. Many points are still valid for other type of drivers, but | ||
| 10 | others may be irrelevant. | ||
| 8 | 11 | ||
| 9 | There are two sets of points below. The first set concerns technical | 12 | There are two sets of points below. The first set concerns technical |
| 10 | changes. The second set concerns coding policy. Both are mandatory. | 13 | changes. The second set concerns coding policy. Both are mandatory. |
| @@ -22,16 +25,20 @@ Technical changes: | |||
| 22 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 23 | #include <linux/init.h> | 26 | #include <linux/init.h> |
| 24 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <linux/jiffies.h> | ||
| 25 | #include <linux/i2c.h> | 29 | #include <linux/i2c.h> |
| 30 | #include <linux/i2c-isa.h> /* for ISA drivers */ | ||
| 26 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ | 31 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ |
| 27 | #include <linux/hwmon-sysfs.h> | 32 | #include <linux/hwmon-sysfs.h> |
| 28 | #include <linux/hwmon-vid.h> /* if you need VRM support */ | 33 | #include <linux/hwmon-vid.h> /* if you need VRM support */ |
| 34 | #include <linux/err.h> /* for class registration */ | ||
| 29 | #include <asm/io.h> /* if you have I/O operations */ | 35 | #include <asm/io.h> /* if you have I/O operations */ |
| 30 | Please respect this inclusion order. Some extra headers may be | 36 | Please respect this inclusion order. Some extra headers may be |
| 31 | required for a given driver (e.g. "lm75.h"). | 37 | required for a given driver (e.g. "lm75.h"). |
| 32 | 38 | ||
| 33 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses | 39 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses |
| 34 | are no more handled by the i2c core. | 40 | are no more handled by the i2c core. Address ranges are no more |
| 41 | supported either, define each individual address separately. | ||
| 35 | SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. | 42 | SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. |
| 36 | 43 | ||
| 37 | * [Client data] Get rid of sysctl_id. Try using standard names for | 44 | * [Client data] Get rid of sysctl_id. Try using standard names for |
| @@ -48,23 +55,23 @@ Technical changes: | |||
| 48 | int kind); | 55 | int kind); |
| 49 | static void lm75_init_client(struct i2c_client *client); | 56 | static void lm75_init_client(struct i2c_client *client); |
| 50 | static int lm75_detach_client(struct i2c_client *client); | 57 | static int lm75_detach_client(struct i2c_client *client); |
| 51 | static void lm75_update_client(struct i2c_client *client); | 58 | static struct lm75_data lm75_update_device(struct device *dev); |
| 52 | 59 | ||
| 53 | * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table | 60 | * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table |
| 54 | and functions). Instead, you have to define show and set functions for | 61 | and functions). Instead, you have to define show and set functions for |
| 55 | each sysfs file. Only define set for writable values. Take a look at an | 62 | each sysfs file. Only define set for writable values. Take a look at an |
| 56 | existing 2.6 driver for details (lm78 for example). Don't forget | 63 | existing 2.6 driver for details (it87 for example). Don't forget |
| 57 | to define the attributes for each file (this is that step that | 64 | to define the attributes for each file (this is that step that |
| 58 | links callback functions). Use the file names specified in | 65 | links callback functions). Use the file names specified in |
| 59 | Documentation/i2c/sysfs-interface for the individual files. Also | 66 | Documentation/hwmon/sysfs-interface for the individual files. Also |
| 60 | convert the units these files read and write to the specified ones. | 67 | convert the units these files read and write to the specified ones. |
| 61 | If you need to add a new type of file, please discuss it on the | 68 | If you need to add a new type of file, please discuss it on the |
| 62 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a | 69 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a |
| 63 | patch to the Documentation/i2c/sysfs-interface file. | 70 | patch to the Documentation/hwmon/sysfs-interface file. |
| 64 | 71 | ||
| 65 | * [Attach] For I2C drivers, the attach function should make sure | 72 | * [Attach] For I2C drivers, the attach function should make sure |
| 66 | that the adapter's class has I2C_CLASS_HWMON, using the | 73 | that the adapter's class has I2C_CLASS_HWMON (or whatever class is |
| 67 | following construct: | 74 | suitable for your driver), using the following construct: |
| 68 | if (!(adapter->class & I2C_CLASS_HWMON)) | 75 | if (!(adapter->class & I2C_CLASS_HWMON)) |
| 69 | return 0; | 76 | return 0; |
| 70 | ISA-only drivers of course don't need this. | 77 | ISA-only drivers of course don't need this. |
| @@ -72,63 +79,72 @@ Technical changes: | |||
| 72 | 79 | ||
| 73 | * [Detect] As mentioned earlier, the flags parameter is gone. | 80 | * [Detect] As mentioned earlier, the flags parameter is gone. |
| 74 | The type_name and client_name strings are replaced by a single | 81 | The type_name and client_name strings are replaced by a single |
| 75 | name string, which will be filled with a lowercase, short string | 82 | name string, which will be filled with a lowercase, short string. |
| 76 | (typically the driver name, e.g. "lm75"). | ||
| 77 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's | 83 | In i2c-only drivers, drop the i2c_is_isa_adapter check, it's |
| 78 | useless. Same for isa-only drivers, as the test would always be | 84 | useless. Same for isa-only drivers, as the test would always be |
| 79 | true. Only hybrid drivers (which are quite rare) still need it. | 85 | true. Only hybrid drivers (which are quite rare) still need it. |
| 80 | The errorN labels are reduced to the number needed. If that number | 86 | The labels used for error paths are reduced to the number needed. |
| 81 | is 2 (i2c-only drivers), it is advised that the labels are named | 87 | It is advised that the labels are given descriptive names such as |
| 82 | exit and exit_free. For i2c+isa drivers, labels should be named | 88 | exit and exit_free. Don't forget to properly set err before |
| 83 | ERROR0, ERROR1 and ERROR2. Don't forget to properly set err before | ||
| 84 | jumping to error labels. By the way, labels should be left-aligned. | 89 | jumping to error labels. By the way, labels should be left-aligned. |
| 85 | Use kzalloc instead of kmalloc. | 90 | Use kzalloc instead of kmalloc. |
| 86 | Use i2c_set_clientdata to set the client data (as opposed to | 91 | Use i2c_set_clientdata to set the client data (as opposed to |
| 87 | a direct access to client->data). | 92 | a direct access to client->data). |
| 88 | Use strlcpy instead of strcpy to copy the client name. | 93 | Use strlcpy instead of strcpy or snprintf to copy the client name. |
| 89 | Replace the sysctl directory registration by calls to | 94 | Replace the sysctl directory registration by calls to |
| 90 | device_create_file. Move the driver initialization before any | 95 | device_create_file. Move the driver initialization before any |
| 91 | sysfs file creation. | 96 | sysfs file creation. |
| 97 | Register the client with the hwmon class (using hwmon_device_register) | ||
| 98 | if applicable. | ||
| 92 | Drop client->id. | 99 | Drop client->id. |
| 93 | Drop any 24RF08 corruption prevention you find, as this is now done | 100 | Drop any 24RF08 corruption prevention you find, as this is now done |
| 94 | at the i2c-core level, and doing it twice voids it. | 101 | at the i2c-core level, and doing it twice voids it. |
| 102 | Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now. | ||
| 95 | 103 | ||
| 96 | * [Init] Limits must not be set by the driver (can be done later in | 104 | * [Init] Limits must not be set by the driver (can be done later in |
| 97 | user-space). Chip should not be reset default (although a module | 105 | user-space). Chip should not be reset default (although a module |
| 98 | parameter may be used to force is), and initialization should be | 106 | parameter may be used to force it), and initialization should be |
| 99 | limited to the strictly necessary steps. | 107 | limited to the strictly necessary steps. |
| 100 | 108 | ||
| 101 | * [Detach] Get rid of data, remove the call to | 109 | * [Detach] Remove the call to i2c_deregister_entry. Do not log an |
| 102 | i2c_deregister_entry. Do not log an error message if | 110 | error message if i2c_detach_client fails, as i2c-core will now do |
| 103 | i2c_detach_client fails, as i2c-core will now do it for you. | 111 | it for you. |
| 104 | 112 | Unregister from the hwmon class if applicable. | |
| 105 | * [Update] Don't access client->data directly, use | 113 | |
| 106 | i2c_get_clientdata(client) instead. | 114 | * [Update] The function prototype changed, it is now |
| 107 | 115 | passed a device structure, which you have to convert to a client | |
| 108 | * [Interface] Init function should not print anything. Make sure | 116 | using to_i2c_client(dev). The update function should return a |
| 109 | there is a MODULE_LICENSE() line, at the bottom of the file | 117 | pointer to the client data. |
| 110 | (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order). | 118 | Don't access client->data directly, use i2c_get_clientdata(client) |
| 119 | instead. | ||
| 120 | Use time_after() instead of direct jiffies comparison. | ||
| 121 | |||
| 122 | * [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom | ||
| 123 | of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this | ||
| 124 | order). | ||
| 125 | |||
| 126 | * [Driver] The flags field of the i2c_driver structure is gone. | ||
| 127 | I2C_DF_NOTIFY is now the default behavior. | ||
| 128 | The i2c_driver structure has a driver member, which is itself a | ||
| 129 | structure, those name member should be initialized to a driver name | ||
| 130 | string. i2c_driver itself has no name member anymore. | ||
| 111 | 131 | ||
| 112 | Coding policy: | 132 | Coding policy: |
| 113 | 133 | ||
| 114 | * [Copyright] Use (C), not (c), for copyright. | 134 | * [Copyright] Use (C), not (c), for copyright. |
| 115 | 135 | ||
| 116 | * [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you | 136 | * [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you |
| 117 | can. Calls to printk/pr_debug for debugging purposes are replaced | 137 | can. Calls to printk for debugging purposes are replaced by calls to |
| 118 | by calls to dev_dbg. Here is an example on how to call it (taken | 138 | dev_dbg where possible, else to pr_debug. Here is an example of how |
| 119 | from lm75_detect): | 139 | to call it (taken from lm75_detect): |
| 120 | dev_dbg(&client->dev, "Starting lm75 update\n"); | 140 | dev_dbg(&client->dev, "Starting lm75 update\n"); |
| 121 | Replace other printk calls with the dev_info, dev_err or dev_warn | 141 | Replace other printk calls with the dev_info, dev_err or dev_warn |
| 122 | function, as appropriate. | 142 | function, as appropriate. |
| 123 | 143 | ||
| 124 | * [Constants] Constants defines (registers, conversions, initial | 144 | * [Constants] Constants defines (registers, conversions) should be |
| 125 | values) should be aligned. This greatly improves readability. | 145 | aligned. This greatly improves readability. |
| 126 | Same goes for variables declarations. Alignments are achieved by the | 146 | Alignments are achieved by the means of tabs, not spaces. Remember |
| 127 | means of tabs, not spaces. Remember that tabs are set to 8 in the | 147 | that tabs are set to 8 in the Linux kernel code. |
| 128 | Linux kernel code. | ||
| 129 | |||
| 130 | * [Structure definition] The name field should be standardized. All | ||
| 131 | lowercase and as simple as the driver name itself (e.g. "lm75"). | ||
| 132 | 148 | ||
| 133 | * [Layout] Avoid extra empty lines between comments and what they | 149 | * [Layout] Avoid extra empty lines between comments and what they |
| 134 | comment. Respect the coding style (see Documentation/CodingStyle), | 150 | comment. Respect the coding style (see Documentation/CodingStyle), |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index d19993cc0604..3a057c8e5507 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
| @@ -25,9 +25,9 @@ routines, a client structure specific information like the actual I2C | |||
| 25 | address. | 25 | address. |
| 26 | 26 | ||
| 27 | static struct i2c_driver foo_driver = { | 27 | static struct i2c_driver foo_driver = { |
| 28 | .owner = THIS_MODULE, | 28 | .driver = { |
| 29 | .name = "Foo version 2.3 driver", | 29 | .name = "foo", |
| 30 | .flags = I2C_DF_NOTIFY, | 30 | }, |
| 31 | .attach_adapter = &foo_attach_adapter, | 31 | .attach_adapter = &foo_attach_adapter, |
| 32 | .detach_client = &foo_detach_client, | 32 | .detach_client = &foo_detach_client, |
| 33 | .command = &foo_command /* may be NULL */ | 33 | .command = &foo_command /* may be NULL */ |
| @@ -36,10 +36,6 @@ static struct i2c_driver foo_driver = { | |||
| 36 | The name field must match the driver name, including the case. It must not | 36 | The name field must match the driver name, including the case. It must not |
| 37 | contain spaces, and may be up to 31 characters long. | 37 | contain spaces, and may be up to 31 characters long. |
| 38 | 38 | ||
| 39 | Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This | ||
| 40 | means that your driver will be notified when new adapters are found. | ||
| 41 | This is almost always what you want. | ||
| 42 | |||
| 43 | All other fields are for call-back functions which will be explained | 39 | All other fields are for call-back functions which will be explained |
| 44 | below. | 40 | below. |
| 45 | 41 | ||
| @@ -496,17 +492,13 @@ Note that some functions are marked by `__init', and some data structures | |||
| 496 | by `__init_data'. Hose functions and structures can be removed after | 492 | by `__init_data'. Hose functions and structures can be removed after |
| 497 | kernel booting (or module loading) is completed. | 493 | kernel booting (or module loading) is completed. |
| 498 | 494 | ||
| 495 | |||
| 499 | Command function | 496 | Command function |
| 500 | ================ | 497 | ================ |
| 501 | 498 | ||
| 502 | A generic ioctl-like function call back is supported. You will seldom | 499 | A generic ioctl-like function call back is supported. You will seldom |
| 503 | need this. You may even set it to NULL. | 500 | need this, and its use is deprecated anyway, so newer design should not |
| 504 | 501 | use it. Set it to NULL. | |
| 505 | /* No commands defined */ | ||
| 506 | int foo_command(struct i2c_client *client, unsigned int cmd, void *arg) | ||
| 507 | { | ||
| 508 | return 0; | ||
| 509 | } | ||
| 510 | 502 | ||
| 511 | 503 | ||
| 512 | Sending and receiving | 504 | Sending and receiving |
diff --git a/MAINTAINERS b/MAINTAINERS index 08e2dcf36f74..bce7123d49d9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2916,6 +2916,12 @@ W: http://linuxtv.org | |||
| 2916 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git | 2916 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git |
| 2917 | S: Maintained | 2917 | S: Maintained |
| 2918 | 2918 | ||
| 2919 | VT8231 HARDWARE MONITOR DRIVER | ||
| 2920 | P: Roger Lucas | ||
| 2921 | M: roger@planbit.co.uk | ||
| 2922 | L: lm-sensors@lm-sensors.org | ||
| 2923 | S: Maintained | ||
| 2924 | |||
| 2919 | W1 DALLAS'S 1-WIRE BUS | 2925 | W1 DALLAS'S 1-WIRE BUS |
| 2920 | P: Evgeniy Polyakov | 2926 | P: Evgeniy Polyakov |
| 2921 | M: johnpol@2ka.mipt.ru | 2927 | M: johnpol@2ka.mipt.ru |
diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c index f6d73cc01f78..1b398742ab56 100644 --- a/arch/arm/mach-pxa/akita-ioexp.c +++ b/arch/arm/mach-pxa/akita-ioexp.c | |||
| @@ -124,17 +124,16 @@ static int max7310_detach_client(struct i2c_client *client) | |||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static struct i2c_driver max7310_i2c_driver = { | 126 | static struct i2c_driver max7310_i2c_driver = { |
| 127 | .owner = THIS_MODULE, | 127 | .driver = { |
| 128 | .name = "akita-max7310", | 128 | .name = "akita-max7310", |
| 129 | }, | ||
| 129 | .id = I2C_DRIVERID_AKITAIOEXP, | 130 | .id = I2C_DRIVERID_AKITAIOEXP, |
| 130 | .flags = I2C_DF_NOTIFY, | ||
| 131 | .attach_adapter = max7310_attach_adapter, | 131 | .attach_adapter = max7310_attach_adapter, |
| 132 | .detach_client = max7310_detach_client, | 132 | .detach_client = max7310_detach_client, |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | static struct i2c_client max7310_template = { | 135 | static struct i2c_client max7310_template = { |
| 136 | name: "akita-max7310", | 136 | name: "akita-max7310", |
| 137 | flags: I2C_CLIENT_ALLOW_USE, | ||
| 138 | driver: &max7310_i2c_driver, | 137 | driver: &max7310_i2c_driver, |
| 139 | }; | 138 | }; |
| 140 | 139 | ||
diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c index e26f007a1417..9b49f316ae92 100644 --- a/drivers/acorn/char/pcf8583.c +++ b/drivers/acorn/char/pcf8583.c | |||
| @@ -257,9 +257,10 @@ pcf8583_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static struct i2c_driver pcf8583_driver = { | 259 | static struct i2c_driver pcf8583_driver = { |
| 260 | .name = "PCF8583", | 260 | .driver = { |
| 261 | .name = "PCF8583", | ||
| 262 | }, | ||
| 261 | .id = I2C_DRIVERID_PCF8583, | 263 | .id = I2C_DRIVERID_PCF8583, |
| 262 | .flags = I2C_DF_NOTIFY, | ||
| 263 | .attach_adapter = pcf8583_probe, | 264 | .attach_adapter = pcf8583_probe, |
| 264 | .detach_client = pcf8583_detach, | 265 | .detach_client = pcf8583_detach, |
| 265 | .command = pcf8583_command | 266 | .command = pcf8583_command |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index db358cfa7cbf..c58295914365 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -350,6 +350,18 @@ config SENSORS_VIA686A | |||
| 350 | This driver can also be built as a module. If so, the module | 350 | This driver can also be built as a module. If so, the module |
| 351 | will be called via686a. | 351 | will be called via686a. |
| 352 | 352 | ||
| 353 | config SENSORS_VT8231 | ||
| 354 | tristate "VT8231" | ||
| 355 | depends on HWMON && I2C && PCI && EXPERIMENTAL | ||
| 356 | select HWMON_VID | ||
| 357 | select I2C_ISA | ||
| 358 | help | ||
| 359 | If you say yes here then you get support for the integrated sensors | ||
| 360 | in the VIA VT8231 device. | ||
| 361 | |||
| 362 | This driver can also be built as a module. If so, the module | ||
| 363 | will be called vt8231. | ||
| 364 | |||
| 353 | config SENSORS_W83781D | 365 | config SENSORS_W83781D |
| 354 | tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" | 366 | tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" |
| 355 | depends on HWMON && I2C | 367 | depends on HWMON && I2C |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index f7d6a2f61ee7..06d4a1d14105 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
| @@ -40,6 +40,7 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o | |||
| 40 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o | 40 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o |
| 41 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o | 41 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o |
| 42 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o | 42 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o |
| 43 | obj-$(CONFIG_SENSORS_VT8231) += vt8231.o | ||
| 43 | obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o | 44 | obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o |
| 44 | obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o | 45 | obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o |
| 45 | 46 | ||
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 8102876c7c3f..665612729cb9 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
| @@ -126,10 +126,10 @@ static int read_only; | |||
| 126 | 126 | ||
| 127 | /* This is the driver that will be inserted */ | 127 | /* This is the driver that will be inserted */ |
| 128 | static struct i2c_driver adm1021_driver = { | 128 | static struct i2c_driver adm1021_driver = { |
| 129 | .owner = THIS_MODULE, | 129 | .driver = { |
| 130 | .name = "adm1021", | 130 | .name = "adm1021", |
| 131 | }, | ||
| 131 | .id = I2C_DRIVERID_ADM1021, | 132 | .id = I2C_DRIVERID_ADM1021, |
| 132 | .flags = I2C_DF_NOTIFY, | ||
| 133 | .attach_adapter = adm1021_attach_adapter, | 133 | .attach_adapter = adm1021_attach_adapter, |
| 134 | .detach_client = adm1021_detach_client, | 134 | .detach_client = adm1021_detach_client, |
| 135 | }; | 135 | }; |
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index 3ec12421694f..9331c56d2ba6 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c | |||
| @@ -118,10 +118,10 @@ static struct adm1025_data *adm1025_update_device(struct device *dev); | |||
| 118 | */ | 118 | */ |
| 119 | 119 | ||
| 120 | static struct i2c_driver adm1025_driver = { | 120 | static struct i2c_driver adm1025_driver = { |
| 121 | .owner = THIS_MODULE, | 121 | .driver = { |
| 122 | .name = "adm1025", | 122 | .name = "adm1025", |
| 123 | }, | ||
| 123 | .id = I2C_DRIVERID_ADM1025, | 124 | .id = I2C_DRIVERID_ADM1025, |
| 124 | .flags = I2C_DF_NOTIFY, | ||
| 125 | .attach_adapter = adm1025_attach_adapter, | 125 | .attach_adapter = adm1025_attach_adapter, |
| 126 | .detach_client = adm1025_detach_client, | 126 | .detach_client = adm1025_detach_client, |
| 127 | }; | 127 | }; |
| @@ -287,8 +287,6 @@ static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char | |||
| 287 | struct adm1025_data *data = adm1025_update_device(dev); | 287 | struct adm1025_data *data = adm1025_update_device(dev); |
| 288 | return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); | 288 | return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); |
| 289 | } | 289 | } |
| 290 | /* in1_ref is deprecated in favour of cpu0_vid, remove after 2005-11-11 */ | ||
| 291 | static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); | ||
| 292 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 290 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
| 293 | 291 | ||
| 294 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) | 292 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -444,8 +442,6 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 444 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | 442 | device_create_file(&new_client->dev, &dev_attr_temp1_max); |
| 445 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | 443 | device_create_file(&new_client->dev, &dev_attr_temp2_max); |
| 446 | device_create_file(&new_client->dev, &dev_attr_alarms); | 444 | device_create_file(&new_client->dev, &dev_attr_alarms); |
| 447 | /* in1_ref is deprecated, remove after 2005-11-11 */ | ||
| 448 | device_create_file(&new_client->dev, &dev_attr_in1_ref); | ||
| 449 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); | 445 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); |
| 450 | device_create_file(&new_client->dev, &dev_attr_vrm); | 446 | device_create_file(&new_client->dev, &dev_attr_vrm); |
| 451 | 447 | ||
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index e0f56549d1d8..fefe6e74fd02 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
| @@ -308,9 +308,9 @@ static void adm1026_init_client(struct i2c_client *client); | |||
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | static struct i2c_driver adm1026_driver = { | 310 | static struct i2c_driver adm1026_driver = { |
| 311 | .owner = THIS_MODULE, | 311 | .driver = { |
| 312 | .name = "adm1026", | 312 | .name = "adm1026", |
| 313 | .flags = I2C_DF_NOTIFY, | 313 | }, |
| 314 | .attach_adapter = adm1026_attach_adapter, | 314 | .attach_adapter = adm1026_attach_adapter, |
| 315 | .detach_client = adm1026_detach_client, | 315 | .detach_client = adm1026_detach_client, |
| 316 | }; | 316 | }; |
| @@ -1227,8 +1227,6 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, c | |||
| 1227 | struct adm1026_data *data = adm1026_update_device(dev); | 1227 | struct adm1026_data *data = adm1026_update_device(dev); |
| 1228 | return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); | 1228 | return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); |
| 1229 | } | 1229 | } |
| 1230 | /* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */ | ||
| 1231 | static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); | ||
| 1232 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); | 1230 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); |
| 1233 | 1231 | ||
| 1234 | static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) | 1232 | static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -1673,8 +1671,6 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address, | |||
| 1673 | device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); | 1671 | device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); |
| 1674 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); | 1672 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); |
| 1675 | device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); | 1673 | device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); |
| 1676 | /* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */ | ||
| 1677 | device_create_file(&new_client->dev, &dev_attr_vid); | ||
| 1678 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); | 1674 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); |
| 1679 | device_create_file(&new_client->dev, &dev_attr_vrm); | 1675 | device_create_file(&new_client->dev, &dev_attr_vrm); |
| 1680 | device_create_file(&new_client->dev, &dev_attr_alarms); | 1676 | device_create_file(&new_client->dev, &dev_attr_alarms); |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 7c545d5eee45..d06397966081 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
| @@ -105,9 +105,9 @@ static struct adm1031_data *adm1031_update_device(struct device *dev); | |||
| 105 | 105 | ||
| 106 | /* This is the driver that will be inserted */ | 106 | /* This is the driver that will be inserted */ |
| 107 | static struct i2c_driver adm1031_driver = { | 107 | static struct i2c_driver adm1031_driver = { |
| 108 | .owner = THIS_MODULE, | 108 | .driver = { |
| 109 | .name = "adm1031", | 109 | .name = "adm1031", |
| 110 | .flags = I2C_DF_NOTIFY, | 110 | }, |
| 111 | .attach_adapter = adm1031_attach_adapter, | 111 | .attach_adapter = adm1031_attach_adapter, |
| 112 | .detach_client = adm1031_detach_client, | 112 | .detach_client = adm1031_detach_client, |
| 113 | }; | 113 | }; |
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index 11dc95f8a17e..5ddc22fea4a3 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c | |||
| @@ -137,10 +137,10 @@ static struct adm9240_data *adm9240_update_device(struct device *dev); | |||
| 137 | 137 | ||
| 138 | /* driver data */ | 138 | /* driver data */ |
| 139 | static struct i2c_driver adm9240_driver = { | 139 | static struct i2c_driver adm9240_driver = { |
| 140 | .owner = THIS_MODULE, | 140 | .driver = { |
| 141 | .name = "adm9240", | 141 | .name = "adm9240", |
| 142 | }, | ||
| 142 | .id = I2C_DRIVERID_ADM9240, | 143 | .id = I2C_DRIVERID_ADM9240, |
| 143 | .flags = I2C_DF_NOTIFY, | ||
| 144 | .attach_adapter = adm9240_attach_adapter, | 144 | .attach_adapter = adm9240_attach_adapter, |
| 145 | .detach_client = adm9240_detach_client, | 145 | .detach_client = adm9240_detach_client, |
| 146 | }; | 146 | }; |
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 52c469722a65..ae9de63cf2e0 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
| @@ -217,10 +217,10 @@ static struct asb100_data *asb100_update_device(struct device *dev); | |||
| 217 | static void asb100_init_client(struct i2c_client *client); | 217 | static void asb100_init_client(struct i2c_client *client); |
| 218 | 218 | ||
| 219 | static struct i2c_driver asb100_driver = { | 219 | static struct i2c_driver asb100_driver = { |
| 220 | .owner = THIS_MODULE, | 220 | .driver = { |
| 221 | .name = "asb100", | 221 | .name = "asb100", |
| 222 | }, | ||
| 222 | .id = I2C_DRIVERID_ASB100, | 223 | .id = I2C_DRIVERID_ASB100, |
| 223 | .flags = I2C_DF_NOTIFY, | ||
| 224 | .attach_adapter = asb100_attach_adapter, | 224 | .attach_adapter = asb100_attach_adapter, |
| 225 | .detach_client = asb100_detach_client, | 225 | .detach_client = asb100_detach_client, |
| 226 | }; | 226 | }; |
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 53324f56404e..b0c490073c8e 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
| @@ -50,9 +50,9 @@ static struct atxp1_data * atxp1_update_device(struct device *dev); | |||
| 50 | static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind); | 50 | static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind); |
| 51 | 51 | ||
| 52 | static struct i2c_driver atxp1_driver = { | 52 | static struct i2c_driver atxp1_driver = { |
| 53 | .owner = THIS_MODULE, | 53 | .driver = { |
| 54 | .name = "atxp1", | 54 | .name = "atxp1", |
| 55 | .flags = I2C_DF_NOTIFY, | 55 | }, |
| 56 | .attach_adapter = atxp1_attach_adapter, | 56 | .attach_adapter = atxp1_attach_adapter, |
| 57 | .detach_client = atxp1_detach_client, | 57 | .detach_client = atxp1_detach_client, |
| 58 | }; | 58 | }; |
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 34f71b7c7f37..203f9c7abb20 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
| @@ -89,10 +89,10 @@ static struct ds1621_data *ds1621_update_client(struct device *dev); | |||
| 89 | 89 | ||
| 90 | /* This is the driver that will be inserted */ | 90 | /* This is the driver that will be inserted */ |
| 91 | static struct i2c_driver ds1621_driver = { | 91 | static struct i2c_driver ds1621_driver = { |
| 92 | .owner = THIS_MODULE, | 92 | .driver = { |
| 93 | .name = "ds1621", | 93 | .name = "ds1621", |
| 94 | }, | ||
| 94 | .id = I2C_DRIVERID_DS1621, | 95 | .id = I2C_DRIVERID_DS1621, |
| 95 | .flags = I2C_DF_NOTIFY, | ||
| 96 | .attach_adapter = ds1621_attach_adapter, | 96 | .attach_adapter = ds1621_attach_adapter, |
| 97 | .detach_client = ds1621_detach_client, | 97 | .detach_client = ds1621_detach_client, |
| 98 | }; | 98 | }; |
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index a02e1c34c757..25409181d1eb 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c | |||
| @@ -118,10 +118,10 @@ static int fscher_write_value(struct i2c_client *client, u8 reg, u8 value); | |||
| 118 | */ | 118 | */ |
| 119 | 119 | ||
| 120 | static struct i2c_driver fscher_driver = { | 120 | static struct i2c_driver fscher_driver = { |
| 121 | .owner = THIS_MODULE, | 121 | .driver = { |
| 122 | .name = "fscher", | 122 | .name = "fscher", |
| 123 | }, | ||
| 123 | .id = I2C_DRIVERID_FSCHER, | 124 | .id = I2C_DRIVERID_FSCHER, |
| 124 | .flags = I2C_DF_NOTIFY, | ||
| 125 | .attach_adapter = fscher_attach_adapter, | 125 | .attach_adapter = fscher_attach_adapter, |
| 126 | .detach_client = fscher_detach_client, | 126 | .detach_client = fscher_detach_client, |
| 127 | }; | 127 | }; |
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 64e4edc64f8d..6d0146b57020 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c | |||
| @@ -100,10 +100,10 @@ static void reset_fan_alarm(struct i2c_client *client, int nr); | |||
| 100 | * Driver data (common to all clients) | 100 | * Driver data (common to all clients) |
| 101 | */ | 101 | */ |
| 102 | static struct i2c_driver fscpos_driver = { | 102 | static struct i2c_driver fscpos_driver = { |
| 103 | .owner = THIS_MODULE, | 103 | .driver = { |
| 104 | .name = "fscpos", | 104 | .name = "fscpos", |
| 105 | }, | ||
| 105 | .id = I2C_DRIVERID_FSCPOS, | 106 | .id = I2C_DRIVERID_FSCPOS, |
| 106 | .flags = I2C_DF_NOTIFY, | ||
| 107 | .attach_adapter = fscpos_attach_adapter, | 107 | .attach_adapter = fscpos_attach_adapter, |
| 108 | .detach_client = fscpos_detach_client, | 108 | .detach_client = fscpos_detach_client, |
| 109 | }; | 109 | }; |
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 2f178dbe3d87..9e685e3a3bc9 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
| @@ -151,10 +151,10 @@ static struct gl518_data *gl518_update_device(struct device *dev); | |||
| 151 | 151 | ||
| 152 | /* This is the driver that will be inserted */ | 152 | /* This is the driver that will be inserted */ |
| 153 | static struct i2c_driver gl518_driver = { | 153 | static struct i2c_driver gl518_driver = { |
| 154 | .owner = THIS_MODULE, | 154 | .driver = { |
| 155 | .name = "gl518sm", | 155 | .name = "gl518sm", |
| 156 | }, | ||
| 156 | .id = I2C_DRIVERID_GL518, | 157 | .id = I2C_DRIVERID_GL518, |
| 157 | .flags = I2C_DF_NOTIFY, | ||
| 158 | .attach_adapter = gl518_attach_adapter, | 158 | .attach_adapter = gl518_attach_adapter, |
| 159 | .detach_client = gl518_detach_client, | 159 | .detach_client = gl518_detach_client, |
| 160 | }; | 160 | }; |
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index c39ba1239426..baee60e44b52 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c | |||
| @@ -109,10 +109,10 @@ static struct gl520_data *gl520_update_device(struct device *dev); | |||
| 109 | 109 | ||
| 110 | /* Driver data */ | 110 | /* Driver data */ |
| 111 | static struct i2c_driver gl520_driver = { | 111 | static struct i2c_driver gl520_driver = { |
| 112 | .owner = THIS_MODULE, | 112 | .driver = { |
| 113 | .name = "gl520sm", | 113 | .name = "gl520sm", |
| 114 | }, | ||
| 114 | .id = I2C_DRIVERID_GL520, | 115 | .id = I2C_DRIVERID_GL520, |
| 115 | .flags = I2C_DF_NOTIFY, | ||
| 116 | .attach_adapter = gl520_attach_adapter, | 116 | .attach_adapter = gl520_attach_adapter, |
| 117 | .detach_client = gl520_detach_client, | 117 | .detach_client = gl520_detach_client, |
| 118 | }; | 118 | }; |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index 312769ad4dab..e497274916ce 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
| @@ -49,20 +49,22 @@ | |||
| 49 | . . . . | 49 | . . . . |
| 50 | 11110 = 0.800 V | 50 | 11110 = 0.800 V |
| 51 | 11111 = 0.000 V (off) | 51 | 11111 = 0.000 V (off) |
| 52 | |||
| 53 | The 17 specification is in fact Intel Mobile Voltage Positioning - | ||
| 54 | (IMVP-II). You can find more information in the datasheet of Max1718 | ||
| 55 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452 | ||
| 56 | |||
| 52 | */ | 57 | */ |
| 53 | 58 | ||
| 54 | /* vrm is the VRM/VRD document version multiplied by 10. | 59 | /* vrm is the VRM/VRD document version multiplied by 10. |
| 55 | val is the 4-, 5- or 6-bit VID code. | 60 | val is the 4-, 5- or 6-bit VID code. |
| 56 | Returned value is in mV to avoid floating point in the kernel. */ | 61 | Returned value is in mV to avoid floating point in the kernel. */ |
| 57 | int vid_from_reg(int val, int vrm) | 62 | int vid_from_reg(int val, u8 vrm) |
| 58 | { | 63 | { |
| 59 | int vid; | 64 | int vid; |
| 60 | 65 | ||
| 61 | switch(vrm) { | 66 | switch(vrm) { |
| 62 | 67 | ||
| 63 | case 0: | ||
| 64 | return 0; | ||
| 65 | |||
| 66 | case 100: /* VRD 10.0 */ | 68 | case 100: /* VRD 10.0 */ |
| 67 | if((val & 0x1f) == 0x1f) | 69 | if((val & 0x1f) == 0x1f) |
| 68 | return 0; | 70 | return 0; |
| @@ -91,10 +93,16 @@ int vid_from_reg(int val, int vrm) | |||
| 91 | case 84: /* VRM 8.4 */ | 93 | case 84: /* VRM 8.4 */ |
| 92 | val &= 0x0f; | 94 | val &= 0x0f; |
| 93 | /* fall through */ | 95 | /* fall through */ |
| 94 | default: /* VRM 8.2 */ | 96 | case 82: /* VRM 8.2 */ |
| 95 | return(val == 0x1f ? 0 : | 97 | return(val == 0x1f ? 0 : |
| 96 | val & 0x10 ? 5100 - (val) * 100 : | 98 | val & 0x10 ? 5100 - (val) * 100 : |
| 97 | 2050 - (val) * 50); | 99 | 2050 - (val) * 50); |
| 100 | case 17: /* Intel IMVP-II */ | ||
| 101 | return(val & 0x10 ? 975 - (val & 0xF) * 25 : | ||
| 102 | 1750 - val * 50); | ||
| 103 | default: /* report 0 for unknown */ | ||
| 104 | printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); | ||
| 105 | return 0; | ||
| 98 | } | 106 | } |
| 99 | } | 107 | } |
| 100 | 108 | ||
| @@ -108,30 +116,36 @@ struct vrm_model { | |||
| 108 | u8 vendor; | 116 | u8 vendor; |
| 109 | u8 eff_family; | 117 | u8 eff_family; |
| 110 | u8 eff_model; | 118 | u8 eff_model; |
| 111 | int vrm_type; | 119 | u8 eff_stepping; |
| 120 | u8 vrm_type; | ||
| 112 | }; | 121 | }; |
| 113 | 122 | ||
| 114 | #define ANY 0xFF | 123 | #define ANY 0xFF |
| 115 | 124 | ||
| 116 | #ifdef CONFIG_X86 | 125 | #ifdef CONFIG_X86 |
| 117 | 126 | ||
| 127 | /* the stepping parameter is highest acceptable stepping for current line */ | ||
| 128 | |||
| 118 | static struct vrm_model vrm_models[] = { | 129 | static struct vrm_model vrm_models[] = { |
| 119 | {X86_VENDOR_AMD, 0x6, ANY, 90}, /* Athlon Duron etc */ | 130 | {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ |
| 120 | {X86_VENDOR_AMD, 0xF, ANY, 24}, /* Athlon 64, Opteron */ | 131 | {X86_VENDOR_AMD, 0xF, ANY, ANY, 24}, /* Athlon 64, Opteron and above VRM 24 */ |
| 121 | {X86_VENDOR_INTEL, 0x6, 0x9, 85}, /* 0.13um too */ | 132 | {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 85}, /* 0.13um too */ |
| 122 | {X86_VENDOR_INTEL, 0x6, 0xB, 85}, /* Tualatin */ | 133 | {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ |
| 123 | {X86_VENDOR_INTEL, 0x6, ANY, 82}, /* any P6 */ | 134 | {X86_VENDOR_INTEL, 0x6, ANY, ANY, 82}, /* any P6 */ |
| 124 | {X86_VENDOR_INTEL, 0x7, ANY, 0}, /* Itanium */ | 135 | {X86_VENDOR_INTEL, 0x7, ANY, ANY, 0}, /* Itanium */ |
| 125 | {X86_VENDOR_INTEL, 0xF, 0x0, 90}, /* P4 */ | 136 | {X86_VENDOR_INTEL, 0xF, 0x0, ANY, 90}, /* P4 */ |
| 126 | {X86_VENDOR_INTEL, 0xF, 0x1, 90}, /* P4 Willamette */ | 137 | {X86_VENDOR_INTEL, 0xF, 0x1, ANY, 90}, /* P4 Willamette */ |
| 127 | {X86_VENDOR_INTEL, 0xF, 0x2, 90}, /* P4 Northwood */ | 138 | {X86_VENDOR_INTEL, 0xF, 0x2, ANY, 90}, /* P4 Northwood */ |
| 128 | {X86_VENDOR_INTEL, 0xF, 0x3, 100}, /* P4 Prescott */ | 139 | {X86_VENDOR_INTEL, 0xF, ANY, ANY, 100}, /* Prescott and above assume VRD 10 */ |
| 129 | {X86_VENDOR_INTEL, 0xF, 0x4, 100}, /* P4 Prescott */ | 140 | {X86_VENDOR_INTEL, 0x10, ANY, ANY, 0}, /* Itanium 2 */ |
| 130 | {X86_VENDOR_INTEL, 0x10,ANY, 0}, /* Itanium 2 */ | 141 | {X86_VENDOR_CENTAUR, 0x6, 0x7, ANY, 85}, /* Eden ESP/Ezra */ |
| 131 | {X86_VENDOR_UNKNOWN, ANY, ANY, 0} /* stop here */ | 142 | {X86_VENDOR_CENTAUR, 0x6, 0x8, 0x7, 85}, /* Ezra T */ |
| 143 | {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nemiah */ | ||
| 144 | {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M */ | ||
| 145 | {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ | ||
| 132 | }; | 146 | }; |
| 133 | 147 | ||
| 134 | static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor) | 148 | static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) |
| 135 | { | 149 | { |
| 136 | int i = 0; | 150 | int i = 0; |
| 137 | 151 | ||
| @@ -139,7 +153,8 @@ static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor) | |||
| 139 | if (vrm_models[i].vendor==vendor) | 153 | if (vrm_models[i].vendor==vendor) |
| 140 | if ((vrm_models[i].eff_family==eff_family) | 154 | if ((vrm_models[i].eff_family==eff_family) |
| 141 | && ((vrm_models[i].eff_model==eff_model) || | 155 | && ((vrm_models[i].eff_model==eff_model) || |
| 142 | (vrm_models[i].eff_model==ANY))) | 156 | (vrm_models[i].eff_model==ANY)) && |
| 157 | (eff_stepping <= vrm_models[i].eff_stepping)) | ||
| 143 | return vrm_models[i].vrm_type; | 158 | return vrm_models[i].vrm_type; |
| 144 | i++; | 159 | i++; |
| 145 | } | 160 | } |
| @@ -147,12 +162,11 @@ static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor) | |||
| 147 | return 0; | 162 | return 0; |
| 148 | } | 163 | } |
| 149 | 164 | ||
| 150 | int vid_which_vrm(void) | 165 | u8 vid_which_vrm(void) |
| 151 | { | 166 | { |
| 152 | struct cpuinfo_x86 *c = cpu_data; | 167 | struct cpuinfo_x86 *c = cpu_data; |
| 153 | u32 eax; | 168 | u32 eax; |
| 154 | u8 eff_family, eff_model; | 169 | u8 eff_family, eff_model, eff_stepping, vrm_ret; |
| 155 | int vrm_ret; | ||
| 156 | 170 | ||
| 157 | if (c->x86 < 6) /* Any CPU with family lower than 6 */ | 171 | if (c->x86 < 6) /* Any CPU with family lower than 6 */ |
| 158 | return 0; /* doesn't have VID and/or CPUID */ | 172 | return 0; /* doesn't have VID and/or CPUID */ |
| @@ -160,20 +174,21 @@ int vid_which_vrm(void) | |||
| 160 | eax = cpuid_eax(1); | 174 | eax = cpuid_eax(1); |
| 161 | eff_family = ((eax & 0x00000F00)>>8); | 175 | eff_family = ((eax & 0x00000F00)>>8); |
| 162 | eff_model = ((eax & 0x000000F0)>>4); | 176 | eff_model = ((eax & 0x000000F0)>>4); |
| 177 | eff_stepping = eax & 0xF; | ||
| 163 | if (eff_family == 0xF) { /* use extended model & family */ | 178 | if (eff_family == 0xF) { /* use extended model & family */ |
| 164 | eff_family += ((eax & 0x00F00000)>>20); | 179 | eff_family += ((eax & 0x00F00000)>>20); |
| 165 | eff_model += ((eax & 0x000F0000)>>16)<<4; | 180 | eff_model += ((eax & 0x000F0000)>>16)<<4; |
| 166 | } | 181 | } |
| 167 | vrm_ret = find_vrm(eff_family,eff_model,c->x86_vendor); | 182 | vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor); |
| 168 | if (vrm_ret == 0) | 183 | if (vrm_ret == 0) |
| 169 | printk(KERN_INFO "hwmon-vid: Unknown VRM version of your " | 184 | printk(KERN_INFO "hwmon-vid: Unknown VRM version of your " |
| 170 | "x86 CPU\n"); | 185 | "x86 CPU\n"); |
| 171 | return vrm_ret; | 186 | return vrm_ret; |
| 172 | } | 187 | } |
| 173 | 188 | ||
| 174 | /* and now something completely different for the non-x86 world */ | 189 | /* and now for something completely different for the non-x86 world */ |
| 175 | #else | 190 | #else |
| 176 | int vid_which_vrm(void) | 191 | u8 vid_which_vrm(void) |
| 177 | { | 192 | { |
| 178 | printk(KERN_INFO "hwmon-vid: Unknown VRM version of your CPU\n"); | 193 | printk(KERN_INFO "hwmon-vid: Unknown VRM version of your CPU\n"); |
| 179 | return 0; | 194 | return 0; |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index a61f5d00f10a..0da7c9c508c3 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
| @@ -213,7 +213,7 @@ struct it87_data { | |||
| 213 | u8 sensor; /* Register value */ | 213 | u8 sensor; /* Register value */ |
| 214 | u8 fan_div[3]; /* Register encoding, shifted right */ | 214 | u8 fan_div[3]; /* Register encoding, shifted right */ |
| 215 | u8 vid; /* Register encoding, combined */ | 215 | u8 vid; /* Register encoding, combined */ |
| 216 | int vrm; | 216 | u8 vrm; |
| 217 | u32 alarms; /* Register encoding, combined */ | 217 | u32 alarms; /* Register encoding, combined */ |
| 218 | u8 fan_main_ctrl; /* Register value */ | 218 | u8 fan_main_ctrl; /* Register value */ |
| 219 | u8 manual_pwm_ctl[3]; /* manual PWM value set by user */ | 219 | u8 manual_pwm_ctl[3]; /* manual PWM value set by user */ |
| @@ -234,17 +234,18 @@ static void it87_init_client(struct i2c_client *client, struct it87_data *data); | |||
| 234 | 234 | ||
| 235 | 235 | ||
| 236 | static struct i2c_driver it87_driver = { | 236 | static struct i2c_driver it87_driver = { |
| 237 | .owner = THIS_MODULE, | 237 | .driver = { |
| 238 | .name = "it87", | 238 | .name = "it87", |
| 239 | }, | ||
| 239 | .id = I2C_DRIVERID_IT87, | 240 | .id = I2C_DRIVERID_IT87, |
| 240 | .flags = I2C_DF_NOTIFY, | ||
| 241 | .attach_adapter = it87_attach_adapter, | 241 | .attach_adapter = it87_attach_adapter, |
| 242 | .detach_client = it87_detach_client, | 242 | .detach_client = it87_detach_client, |
| 243 | }; | 243 | }; |
| 244 | 244 | ||
| 245 | static struct i2c_driver it87_isa_driver = { | 245 | static struct i2c_driver it87_isa_driver = { |
| 246 | .owner = THIS_MODULE, | 246 | .driver = { |
| 247 | .name = "it87-isa", | 247 | .name = "it87-isa", |
| 248 | }, | ||
| 248 | .attach_adapter = it87_isa_attach_adapter, | 249 | .attach_adapter = it87_isa_attach_adapter, |
| 249 | .detach_client = it87_detach_client, | 250 | .detach_client = it87_detach_client, |
| 250 | }; | 251 | }; |
| @@ -668,7 +669,7 @@ static ssize_t | |||
| 668 | show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) | 669 | show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
| 669 | { | 670 | { |
| 670 | struct it87_data *data = it87_update_device(dev); | 671 | struct it87_data *data = it87_update_device(dev); |
| 671 | return sprintf(buf, "%ld\n", (long) data->vrm); | 672 | return sprintf(buf, "%u\n", data->vrm); |
| 672 | } | 673 | } |
| 673 | static ssize_t | 674 | static ssize_t |
| 674 | store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 675 | store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
| @@ -761,7 +762,8 @@ static int it87_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 761 | 762 | ||
| 762 | /* Reserve the ISA region */ | 763 | /* Reserve the ISA region */ |
| 763 | if (is_isa) | 764 | if (is_isa) |
| 764 | if (!request_region(address, IT87_EXTENT, it87_isa_driver.name)) | 765 | if (!request_region(address, IT87_EXTENT, |
| 766 | it87_isa_driver.driver.name)) | ||
| 765 | goto ERROR0; | 767 | goto ERROR0; |
| 766 | 768 | ||
| 767 | /* For now, we presume we have a valid client. We create the | 769 | /* For now, we presume we have a valid client. We create the |
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 954ec2497249..6b1aa7ef552e 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
| @@ -139,9 +139,9 @@ static void lm63_init_client(struct i2c_client *client); | |||
| 139 | */ | 139 | */ |
| 140 | 140 | ||
| 141 | static struct i2c_driver lm63_driver = { | 141 | static struct i2c_driver lm63_driver = { |
| 142 | .owner = THIS_MODULE, | 142 | .driver = { |
| 143 | .name = "lm63", | 143 | .name = "lm63", |
| 144 | .flags = I2C_DF_NOTIFY, | 144 | }, |
| 145 | .attach_adapter = lm63_attach_adapter, | 145 | .attach_adapter = lm63_attach_adapter, |
| 146 | .detach_client = lm63_detach_client, | 146 | .detach_client = lm63_detach_client, |
| 147 | }; | 147 | }; |
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index d70f4c8fc1e6..74ca2c8c61c3 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
| @@ -66,10 +66,10 @@ static struct lm75_data *lm75_update_device(struct device *dev); | |||
| 66 | 66 | ||
| 67 | /* This is the driver that will be inserted */ | 67 | /* This is the driver that will be inserted */ |
| 68 | static struct i2c_driver lm75_driver = { | 68 | static struct i2c_driver lm75_driver = { |
| 69 | .owner = THIS_MODULE, | 69 | .driver = { |
| 70 | .name = "lm75", | 70 | .name = "lm75", |
| 71 | }, | ||
| 71 | .id = I2C_DRIVERID_LM75, | 72 | .id = I2C_DRIVERID_LM75, |
| 72 | .flags = I2C_DF_NOTIFY, | ||
| 73 | .attach_adapter = lm75_attach_adapter, | 73 | .attach_adapter = lm75_attach_adapter, |
| 74 | .detach_client = lm75_detach_client, | 74 | .detach_client = lm75_detach_client, |
| 75 | }; | 75 | }; |
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 9380fda7dcd1..a2f420d01fb7 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c | |||
| @@ -74,9 +74,9 @@ static struct lm77_data *lm77_update_device(struct device *dev); | |||
| 74 | 74 | ||
| 75 | /* This is the driver that will be inserted */ | 75 | /* This is the driver that will be inserted */ |
| 76 | static struct i2c_driver lm77_driver = { | 76 | static struct i2c_driver lm77_driver = { |
| 77 | .owner = THIS_MODULE, | 77 | .driver = { |
| 78 | .name = "lm77", | 78 | .name = "lm77", |
| 79 | .flags = I2C_DF_NOTIFY, | 79 | }, |
| 80 | .attach_adapter = lm77_attach_adapter, | 80 | .attach_adapter = lm77_attach_adapter, |
| 81 | .detach_client = lm77_detach_client, | 81 | .detach_client = lm77_detach_client, |
| 82 | }; | 82 | }; |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 78cdd506439f..e404001e20da 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
| @@ -164,17 +164,18 @@ static void lm78_init_client(struct i2c_client *client); | |||
| 164 | 164 | ||
| 165 | 165 | ||
| 166 | static struct i2c_driver lm78_driver = { | 166 | static struct i2c_driver lm78_driver = { |
| 167 | .owner = THIS_MODULE, | 167 | .driver = { |
| 168 | .name = "lm78", | 168 | .name = "lm78", |
| 169 | }, | ||
| 169 | .id = I2C_DRIVERID_LM78, | 170 | .id = I2C_DRIVERID_LM78, |
| 170 | .flags = I2C_DF_NOTIFY, | ||
| 171 | .attach_adapter = lm78_attach_adapter, | 171 | .attach_adapter = lm78_attach_adapter, |
| 172 | .detach_client = lm78_detach_client, | 172 | .detach_client = lm78_detach_client, |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | static struct i2c_driver lm78_isa_driver = { | 175 | static struct i2c_driver lm78_isa_driver = { |
| 176 | .owner = THIS_MODULE, | 176 | .driver = { |
| 177 | .name = "lm78-isa", | 177 | .name = "lm78-isa", |
| 178 | }, | ||
| 178 | .attach_adapter = lm78_isa_attach_adapter, | 179 | .attach_adapter = lm78_isa_attach_adapter, |
| 179 | .detach_client = lm78_detach_client, | 180 | .detach_client = lm78_detach_client, |
| 180 | }; | 181 | }; |
| @@ -497,7 +498,7 @@ static int lm78_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 497 | /* Reserve the ISA region */ | 498 | /* Reserve the ISA region */ |
| 498 | if (is_isa) | 499 | if (is_isa) |
| 499 | if (!request_region(address, LM78_EXTENT, | 500 | if (!request_region(address, LM78_EXTENT, |
| 500 | lm78_isa_driver.name)) { | 501 | lm78_isa_driver.driver.name)) { |
| 501 | err = -EBUSY; | 502 | err = -EBUSY; |
| 502 | goto ERROR0; | 503 | goto ERROR0; |
| 503 | } | 504 | } |
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index c359fdea211e..c9a7cdea7bd7 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c | |||
| @@ -143,10 +143,10 @@ static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value); | |||
| 143 | */ | 143 | */ |
| 144 | 144 | ||
| 145 | static struct i2c_driver lm80_driver = { | 145 | static struct i2c_driver lm80_driver = { |
| 146 | .owner = THIS_MODULE, | 146 | .driver = { |
| 147 | .name = "lm80", | 147 | .name = "lm80", |
| 148 | }, | ||
| 148 | .id = I2C_DRIVERID_LM80, | 149 | .id = I2C_DRIVERID_LM80, |
| 149 | .flags = I2C_DF_NOTIFY, | ||
| 150 | .attach_adapter = lm80_attach_adapter, | 150 | .attach_adapter = lm80_attach_adapter, |
| 151 | .detach_client = lm80_detach_client, | 151 | .detach_client = lm80_detach_client, |
| 152 | }; | 152 | }; |
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 9a70611a9f69..26dfa9e216c2 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c | |||
| @@ -124,10 +124,10 @@ static struct lm83_data *lm83_update_device(struct device *dev); | |||
| 124 | */ | 124 | */ |
| 125 | 125 | ||
| 126 | static struct i2c_driver lm83_driver = { | 126 | static struct i2c_driver lm83_driver = { |
| 127 | .owner = THIS_MODULE, | 127 | .driver = { |
| 128 | .name = "lm83", | 128 | .name = "lm83", |
| 129 | }, | ||
| 129 | .id = I2C_DRIVERID_LM83, | 130 | .id = I2C_DRIVERID_LM83, |
| 130 | .flags = I2C_DF_NOTIFY, | ||
| 131 | .attach_adapter = lm83_attach_adapter, | 131 | .attach_adapter = lm83_attach_adapter, |
| 132 | .detach_client = lm83_detach_client, | 132 | .detach_client = lm83_detach_client, |
| 133 | }; | 133 | }; |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index d1070ed2bee6..7389a0127547 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
| @@ -380,10 +380,10 @@ static void lm85_init_client(struct i2c_client *client); | |||
| 380 | 380 | ||
| 381 | 381 | ||
| 382 | static struct i2c_driver lm85_driver = { | 382 | static struct i2c_driver lm85_driver = { |
| 383 | .owner = THIS_MODULE, | 383 | .driver = { |
| 384 | .name = "lm85", | 384 | .name = "lm85", |
| 385 | }, | ||
| 385 | .id = I2C_DRIVERID_LM85, | 386 | .id = I2C_DRIVERID_LM85, |
| 386 | .flags = I2C_DF_NOTIFY, | ||
| 387 | .attach_adapter = lm85_attach_adapter, | 387 | .attach_adapter = lm85_attach_adapter, |
| 388 | .detach_client = lm85_detach_client, | 388 | .detach_client = lm85_detach_client, |
| 389 | }; | 389 | }; |
| @@ -443,7 +443,17 @@ show_fan_offset(4); | |||
| 443 | static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) | 443 | static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) |
| 444 | { | 444 | { |
| 445 | struct lm85_data *data = lm85_update_device(dev); | 445 | struct lm85_data *data = lm85_update_device(dev); |
| 446 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); | 446 | int vid; |
| 447 | |||
| 448 | if (data->type == adt7463 && (data->vid & 0x80)) { | ||
| 449 | /* 6-pin VID (VRM 10) */ | ||
| 450 | vid = vid_from_reg(data->vid & 0x3f, data->vrm); | ||
| 451 | } else { | ||
| 452 | /* 5-pin VID (VRM 9) */ | ||
| 453 | vid = vid_from_reg(data->vid & 0x1f, data->vrm); | ||
| 454 | } | ||
| 455 | |||
| 456 | return sprintf(buf, "%d\n", vid); | ||
| 447 | } | 457 | } |
| 448 | 458 | ||
| 449 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); | 459 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); |
| @@ -1176,17 +1186,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, | |||
| 1176 | device_create_file(&new_client->dev, &dev_attr_in1_input); | 1186 | device_create_file(&new_client->dev, &dev_attr_in1_input); |
| 1177 | device_create_file(&new_client->dev, &dev_attr_in2_input); | 1187 | device_create_file(&new_client->dev, &dev_attr_in2_input); |
| 1178 | device_create_file(&new_client->dev, &dev_attr_in3_input); | 1188 | device_create_file(&new_client->dev, &dev_attr_in3_input); |
| 1179 | device_create_file(&new_client->dev, &dev_attr_in4_input); | ||
| 1180 | device_create_file(&new_client->dev, &dev_attr_in0_min); | 1189 | device_create_file(&new_client->dev, &dev_attr_in0_min); |
| 1181 | device_create_file(&new_client->dev, &dev_attr_in1_min); | 1190 | device_create_file(&new_client->dev, &dev_attr_in1_min); |
| 1182 | device_create_file(&new_client->dev, &dev_attr_in2_min); | 1191 | device_create_file(&new_client->dev, &dev_attr_in2_min); |
| 1183 | device_create_file(&new_client->dev, &dev_attr_in3_min); | 1192 | device_create_file(&new_client->dev, &dev_attr_in3_min); |
| 1184 | device_create_file(&new_client->dev, &dev_attr_in4_min); | ||
| 1185 | device_create_file(&new_client->dev, &dev_attr_in0_max); | 1193 | device_create_file(&new_client->dev, &dev_attr_in0_max); |
| 1186 | device_create_file(&new_client->dev, &dev_attr_in1_max); | 1194 | device_create_file(&new_client->dev, &dev_attr_in1_max); |
| 1187 | device_create_file(&new_client->dev, &dev_attr_in2_max); | 1195 | device_create_file(&new_client->dev, &dev_attr_in2_max); |
| 1188 | device_create_file(&new_client->dev, &dev_attr_in3_max); | 1196 | device_create_file(&new_client->dev, &dev_attr_in3_max); |
| 1189 | device_create_file(&new_client->dev, &dev_attr_in4_max); | ||
| 1190 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | 1197 | device_create_file(&new_client->dev, &dev_attr_temp1_input); |
| 1191 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | 1198 | device_create_file(&new_client->dev, &dev_attr_temp2_input); |
| 1192 | device_create_file(&new_client->dev, &dev_attr_temp3_input); | 1199 | device_create_file(&new_client->dev, &dev_attr_temp3_input); |
| @@ -1224,6 +1231,15 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, | |||
| 1224 | device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit); | 1231 | device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit); |
| 1225 | device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit); | 1232 | device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit); |
| 1226 | 1233 | ||
| 1234 | /* The ADT7463 has an optional VRM 10 mode where pin 21 is used | ||
| 1235 | as a sixth digital VID input rather than an analog input. */ | ||
| 1236 | data->vid = lm85_read_value(new_client, LM85_REG_VID); | ||
| 1237 | if (!(kind == adt7463 && (data->vid & 0x80))) { | ||
| 1238 | device_create_file(&new_client->dev, &dev_attr_in4_input); | ||
| 1239 | device_create_file(&new_client->dev, &dev_attr_in4_min); | ||
| 1240 | device_create_file(&new_client->dev, &dev_attr_in4_max); | ||
| 1241 | } | ||
| 1242 | |||
| 1227 | return 0; | 1243 | return 0; |
| 1228 | 1244 | ||
| 1229 | /* Error out and cleanup code */ | 1245 | /* Error out and cleanup code */ |
| @@ -1382,11 +1398,18 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
| 1382 | irrelevant. So it is left in 4*/ | 1398 | irrelevant. So it is left in 4*/ |
| 1383 | data->adc_scale = (data->type == emc6d102 ) ? 16 : 4; | 1399 | data->adc_scale = (data->type == emc6d102 ) ? 16 : 4; |
| 1384 | 1400 | ||
| 1385 | for (i = 0; i <= 4; ++i) { | 1401 | data->vid = lm85_read_value(client, LM85_REG_VID); |
| 1402 | |||
| 1403 | for (i = 0; i <= 3; ++i) { | ||
| 1386 | data->in[i] = | 1404 | data->in[i] = |
| 1387 | lm85_read_value(client, LM85_REG_IN(i)); | 1405 | lm85_read_value(client, LM85_REG_IN(i)); |
| 1388 | } | 1406 | } |
| 1389 | 1407 | ||
| 1408 | if (!(data->type == adt7463 && (data->vid & 0x80))) { | ||
| 1409 | data->in[4] = lm85_read_value(client, | ||
| 1410 | LM85_REG_IN(4)); | ||
| 1411 | } | ||
| 1412 | |||
| 1390 | for (i = 0; i <= 3; ++i) { | 1413 | for (i = 0; i <= 3; ++i) { |
| 1391 | data->fan[i] = | 1414 | data->fan[i] = |
| 1392 | lm85_read_value(client, LM85_REG_FAN(i)); | 1415 | lm85_read_value(client, LM85_REG_FAN(i)); |
| @@ -1450,13 +1473,20 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
| 1450 | /* Things that don't change often */ | 1473 | /* Things that don't change often */ |
| 1451 | dev_dbg(&client->dev, "Reading config values\n"); | 1474 | dev_dbg(&client->dev, "Reading config values\n"); |
| 1452 | 1475 | ||
| 1453 | for (i = 0; i <= 4; ++i) { | 1476 | for (i = 0; i <= 3; ++i) { |
| 1454 | data->in_min[i] = | 1477 | data->in_min[i] = |
| 1455 | lm85_read_value(client, LM85_REG_IN_MIN(i)); | 1478 | lm85_read_value(client, LM85_REG_IN_MIN(i)); |
| 1456 | data->in_max[i] = | 1479 | data->in_max[i] = |
| 1457 | lm85_read_value(client, LM85_REG_IN_MAX(i)); | 1480 | lm85_read_value(client, LM85_REG_IN_MAX(i)); |
| 1458 | } | 1481 | } |
| 1459 | 1482 | ||
| 1483 | if (!(data->type == adt7463 && (data->vid & 0x80))) { | ||
| 1484 | data->in_min[4] = lm85_read_value(client, | ||
| 1485 | LM85_REG_IN_MIN(4)); | ||
| 1486 | data->in_max[4] = lm85_read_value(client, | ||
| 1487 | LM85_REG_IN_MAX(4)); | ||
| 1488 | } | ||
| 1489 | |||
| 1460 | if ( data->type == emc6d100 ) { | 1490 | if ( data->type == emc6d100 ) { |
| 1461 | for (i = 5; i <= 7; ++i) { | 1491 | for (i = 5; i <= 7; ++i) { |
| 1462 | data->in_min[i] = | 1492 | data->in_min[i] = |
| @@ -1478,8 +1508,6 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
| 1478 | lm85_read_value(client, LM85_REG_TEMP_MAX(i)); | 1508 | lm85_read_value(client, LM85_REG_TEMP_MAX(i)); |
| 1479 | } | 1509 | } |
| 1480 | 1510 | ||
| 1481 | data->vid = lm85_read_value(client, LM85_REG_VID); | ||
| 1482 | |||
| 1483 | for (i = 0; i <= 2; ++i) { | 1511 | for (i = 0; i <= 2; ++i) { |
| 1484 | int val ; | 1512 | int val ; |
| 1485 | data->autofan[i].config = | 1513 | data->autofan[i].config = |
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index eeec18177861..6ba34c302d8d 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c | |||
| @@ -161,10 +161,10 @@ static struct lm87_data *lm87_update_device(struct device *dev); | |||
| 161 | */ | 161 | */ |
| 162 | 162 | ||
| 163 | static struct i2c_driver lm87_driver = { | 163 | static struct i2c_driver lm87_driver = { |
| 164 | .owner = THIS_MODULE, | 164 | .driver = { |
| 165 | .name = "lm87", | 165 | .name = "lm87", |
| 166 | }, | ||
| 166 | .id = I2C_DRIVERID_LM87, | 167 | .id = I2C_DRIVERID_LM87, |
| 167 | .flags = I2C_DF_NOTIFY, | ||
| 168 | .attach_adapter = lm87_attach_adapter, | 168 | .attach_adapter = lm87_attach_adapter, |
| 169 | .detach_client = lm87_detach_client, | 169 | .detach_client = lm87_detach_client, |
| 170 | }; | 170 | }; |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 83cf2e1b09f5..5679464447cc 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
| @@ -186,10 +186,10 @@ static struct lm90_data *lm90_update_device(struct device *dev); | |||
| 186 | */ | 186 | */ |
| 187 | 187 | ||
| 188 | static struct i2c_driver lm90_driver = { | 188 | static struct i2c_driver lm90_driver = { |
| 189 | .owner = THIS_MODULE, | 189 | .driver = { |
| 190 | .name = "lm90", | 190 | .name = "lm90", |
| 191 | }, | ||
| 191 | .id = I2C_DRIVERID_LM90, | 192 | .id = I2C_DRIVERID_LM90, |
| 192 | .flags = I2C_DF_NOTIFY, | ||
| 193 | .attach_adapter = lm90_attach_adapter, | 193 | .attach_adapter = lm90_attach_adapter, |
| 194 | .detach_client = lm90_detach_client, | 194 | .detach_client = lm90_detach_client, |
| 195 | }; | 195 | }; |
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index 7a4b3701ed1a..b0c4cb730a7e 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c | |||
| @@ -410,10 +410,10 @@ static int lm92_detach_client(struct i2c_client *client) | |||
| 410 | */ | 410 | */ |
| 411 | 411 | ||
| 412 | static struct i2c_driver lm92_driver = { | 412 | static struct i2c_driver lm92_driver = { |
| 413 | .owner = THIS_MODULE, | 413 | .driver = { |
| 414 | .name = "lm92", | 414 | .name = "lm92", |
| 415 | }, | ||
| 415 | .id = I2C_DRIVERID_LM92, | 416 | .id = I2C_DRIVERID_LM92, |
| 416 | .flags = I2C_DF_NOTIFY, | ||
| 417 | .attach_adapter = lm92_attach_adapter, | 417 | .attach_adapter = lm92_attach_adapter, |
| 418 | .detach_client = lm92_detach_client, | 418 | .detach_client = lm92_detach_client, |
| 419 | }; | 419 | }; |
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 69e7e125683b..3abe330b22ce 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
| @@ -90,9 +90,9 @@ static struct max1619_data *max1619_update_device(struct device *dev); | |||
| 90 | */ | 90 | */ |
| 91 | 91 | ||
| 92 | static struct i2c_driver max1619_driver = { | 92 | static struct i2c_driver max1619_driver = { |
| 93 | .owner = THIS_MODULE, | 93 | .driver = { |
| 94 | .name = "max1619", | 94 | .name = "max1619", |
| 95 | .flags = I2C_DF_NOTIFY, | 95 | }, |
| 96 | .attach_adapter = max1619_attach_adapter, | 96 | .attach_adapter = max1619_attach_adapter, |
| 97 | .detach_client = max1619_detach_client, | 97 | .detach_client = max1619_detach_client, |
| 98 | }; | 98 | }; |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 17f745a23d04..f161e88e3bb6 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
| @@ -236,8 +236,9 @@ static struct pc87360_data *pc87360_update_device(struct device *dev); | |||
| 236 | */ | 236 | */ |
| 237 | 237 | ||
| 238 | static struct i2c_driver pc87360_driver = { | 238 | static struct i2c_driver pc87360_driver = { |
| 239 | .owner = THIS_MODULE, | 239 | .driver = { |
| 240 | .name = "pc87360", | 240 | .name = "pc87360", |
| 241 | }, | ||
| 241 | .attach_adapter = pc87360_detect, | 242 | .attach_adapter = pc87360_detect, |
| 242 | .detach_client = pc87360_detach_client, | 243 | .detach_client = pc87360_detach_client, |
| 243 | }; | 244 | }; |
| @@ -798,7 +799,7 @@ static int pc87360_detect(struct i2c_adapter *adapter) | |||
| 798 | for (i = 0; i < 3; i++) { | 799 | for (i = 0; i < 3; i++) { |
| 799 | if (((data->address[i] = extra_isa[i])) | 800 | if (((data->address[i] = extra_isa[i])) |
| 800 | && !request_region(extra_isa[i], PC87360_EXTENT, | 801 | && !request_region(extra_isa[i], PC87360_EXTENT, |
| 801 | pc87360_driver.name)) { | 802 | pc87360_driver.driver.name)) { |
| 802 | dev_err(&new_client->dev, "Region 0x%x-0x%x already " | 803 | dev_err(&new_client->dev, "Region 0x%x-0x%x already " |
| 803 | "in use!\n", extra_isa[i], | 804 | "in use!\n", extra_isa[i], |
| 804 | extra_isa[i]+PC87360_EXTENT-1); | 805 | extra_isa[i]+PC87360_EXTENT-1); |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 9c6cadec1087..8be5189d9bd9 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
| @@ -198,8 +198,9 @@ static struct sis5595_data *sis5595_update_device(struct device *dev); | |||
| 198 | static void sis5595_init_client(struct i2c_client *client); | 198 | static void sis5595_init_client(struct i2c_client *client); |
| 199 | 199 | ||
| 200 | static struct i2c_driver sis5595_driver = { | 200 | static struct i2c_driver sis5595_driver = { |
| 201 | .owner = THIS_MODULE, | 201 | .driver = { |
| 202 | .name = "sis5595", | 202 | .name = "sis5595", |
| 203 | }, | ||
| 203 | .attach_adapter = sis5595_detect, | 204 | .attach_adapter = sis5595_detect, |
| 204 | .detach_client = sis5595_detach_client, | 205 | .detach_client = sis5595_detach_client, |
| 205 | }; | 206 | }; |
| @@ -484,7 +485,8 @@ static int sis5595_detect(struct i2c_adapter *adapter) | |||
| 484 | if (force_addr) | 485 | if (force_addr) |
| 485 | address = force_addr & ~(SIS5595_EXTENT - 1); | 486 | address = force_addr & ~(SIS5595_EXTENT - 1); |
| 486 | /* Reserve the ISA region */ | 487 | /* Reserve the ISA region */ |
| 487 | if (!request_region(address, SIS5595_EXTENT, sis5595_driver.name)) { | 488 | if (!request_region(address, SIS5595_EXTENT, |
| 489 | sis5595_driver.driver.name)) { | ||
| 488 | err = -EBUSY; | 490 | err = -EBUSY; |
| 489 | goto exit; | 491 | goto exit; |
| 490 | } | 492 | } |
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 2a3e21b5b6b4..8663bbbe97f5 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
| @@ -226,8 +226,9 @@ static int smsc47b397_detach_client(struct i2c_client *client) | |||
| 226 | static int smsc47b397_detect(struct i2c_adapter *adapter); | 226 | static int smsc47b397_detect(struct i2c_adapter *adapter); |
| 227 | 227 | ||
| 228 | static struct i2c_driver smsc47b397_driver = { | 228 | static struct i2c_driver smsc47b397_driver = { |
| 229 | .owner = THIS_MODULE, | 229 | .driver = { |
| 230 | .name = "smsc47b397", | 230 | .name = "smsc47b397", |
| 231 | }, | ||
| 231 | .attach_adapter = smsc47b397_detect, | 232 | .attach_adapter = smsc47b397_detect, |
| 232 | .detach_client = smsc47b397_detach_client, | 233 | .detach_client = smsc47b397_detach_client, |
| 233 | }; | 234 | }; |
| @@ -238,7 +239,8 @@ static int smsc47b397_detect(struct i2c_adapter *adapter) | |||
| 238 | struct smsc47b397_data *data; | 239 | struct smsc47b397_data *data; |
| 239 | int err = 0; | 240 | int err = 0; |
| 240 | 241 | ||
| 241 | if (!request_region(address, SMSC_EXTENT, smsc47b397_driver.name)) { | 242 | if (!request_region(address, SMSC_EXTENT, |
| 243 | smsc47b397_driver.driver.name)) { | ||
| 242 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", | 244 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", |
| 243 | address); | 245 | address); |
| 244 | return -EBUSY; | 246 | return -EBUSY; |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 5905c1af88f2..d1e3ec0fe4df 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
| @@ -126,8 +126,9 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | |||
| 126 | 126 | ||
| 127 | 127 | ||
| 128 | static struct i2c_driver smsc47m1_driver = { | 128 | static struct i2c_driver smsc47m1_driver = { |
| 129 | .owner = THIS_MODULE, | 129 | .driver = { |
| 130 | .name = "smsc47m1", | 130 | .name = "smsc47m1", |
| 131 | }, | ||
| 131 | .attach_adapter = smsc47m1_detect, | 132 | .attach_adapter = smsc47m1_detect, |
| 132 | .detach_client = smsc47m1_detach_client, | 133 | .detach_client = smsc47m1_detach_client, |
| 133 | }; | 134 | }; |
| @@ -394,7 +395,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter) | |||
| 394 | int err = 0; | 395 | int err = 0; |
| 395 | int fan1, fan2, pwm1, pwm2; | 396 | int fan1, fan2, pwm1, pwm2; |
| 396 | 397 | ||
| 397 | if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) { | 398 | if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.driver.name)) { |
| 398 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); | 399 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); |
| 399 | return -EBUSY; | 400 | return -EBUSY; |
| 400 | } | 401 | } |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 6f696f897176..cb01848729b5 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
| @@ -572,8 +572,9 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | |||
| 572 | /* The driver. I choose to use type i2c_driver, as at is identical to both | 572 | /* The driver. I choose to use type i2c_driver, as at is identical to both |
| 573 | smbus_driver and isa_driver, and clients could be of either kind */ | 573 | smbus_driver and isa_driver, and clients could be of either kind */ |
| 574 | static struct i2c_driver via686a_driver = { | 574 | static struct i2c_driver via686a_driver = { |
| 575 | .owner = THIS_MODULE, | 575 | .driver = { |
| 576 | .name = "via686a", | 576 | .name = "via686a", |
| 577 | }, | ||
| 577 | .attach_adapter = via686a_detect, | 578 | .attach_adapter = via686a_detect, |
| 578 | .detach_client = via686a_detach_client, | 579 | .detach_client = via686a_detach_client, |
| 579 | }; | 580 | }; |
| @@ -615,7 +616,8 @@ static int via686a_detect(struct i2c_adapter *adapter) | |||
| 615 | } | 616 | } |
| 616 | 617 | ||
| 617 | /* Reserve the ISA region */ | 618 | /* Reserve the ISA region */ |
| 618 | if (!request_region(address, VIA686A_EXTENT, via686a_driver.name)) { | 619 | if (!request_region(address, VIA686A_EXTENT, |
| 620 | via686a_driver.driver.name)) { | ||
| 619 | dev_err(&adapter->dev, "region 0x%x already in use!\n", | 621 | dev_err(&adapter->dev, "region 0x%x already in use!\n", |
| 620 | address); | 622 | address); |
| 621 | return -ENODEV; | 623 | return -ENODEV; |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c new file mode 100644 index 000000000000..d00a726d0239 --- /dev/null +++ b/drivers/hwmon/vt8231.c | |||
| @@ -0,0 +1,862 @@ | |||
| 1 | /* | ||
| 2 | vt8231.c - Part of lm_sensors, Linux kernel modules | ||
| 3 | for hardware monitoring | ||
| 4 | |||
| 5 | Copyright (c) 2005 Roger Lucas <roger@planbit.co.uk> | ||
| 6 | Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> | ||
| 7 | Aaron M. Marsh <amarsh@sdf.lonestar.org> | ||
| 8 | |||
| 9 | This program is free software; you can redistribute it and/or modify | ||
| 10 | it under the terms of the GNU General Public License as published by | ||
| 11 | the Free Software Foundation; either version 2 of the License, or | ||
| 12 | (at your option) any later version. | ||
| 13 | |||
| 14 | This program is distributed in the hope that it will be useful, | ||
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | GNU General Public License for more details. | ||
| 18 | |||
| 19 | You should have received a copy of the GNU General Public License | ||
| 20 | along with this program; if not, write to the Free Software | ||
| 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* Supports VIA VT8231 South Bridge embedded sensors | ||
| 25 | */ | ||
| 26 | |||
| 27 | #include <linux/module.h> | ||
| 28 | #include <linux/init.h> | ||
| 29 | #include <linux/slab.h> | ||
| 30 | #include <linux/pci.h> | ||
| 31 | #include <linux/jiffies.h> | ||
| 32 | #include <linux/i2c.h> | ||
| 33 | #include <linux/i2c-isa.h> | ||
| 34 | #include <linux/hwmon.h> | ||
| 35 | #include <linux/hwmon-sysfs.h> | ||
| 36 | #include <linux/hwmon-vid.h> | ||
| 37 | #include <linux/err.h> | ||
| 38 | #include <asm/io.h> | ||
| 39 | |||
| 40 | static int force_addr; | ||
| 41 | module_param(force_addr, int, 0); | ||
| 42 | MODULE_PARM_DESC(force_addr, "Initialize the base address of the sensors"); | ||
| 43 | |||
| 44 | /* Device address | ||
| 45 | Note that we can't determine the ISA address until we have initialized | ||
| 46 | our module */ | ||
| 47 | static unsigned short isa_address; | ||
| 48 | |||
| 49 | #define VT8231_EXTENT 0x80 | ||
| 50 | #define VT8231_BASE_REG 0x70 | ||
| 51 | #define VT8231_ENABLE_REG 0x74 | ||
| 52 | |||
| 53 | /* The VT8231 registers | ||
| 54 | |||
| 55 | The reset value for the input channel configuration is used (Reg 0x4A=0x07) | ||
| 56 | which sets the selected inputs marked with '*' below if multiple options are | ||
| 57 | possible: | ||
| 58 | |||
| 59 | Voltage Mode Temperature Mode | ||
| 60 | Sensor Linux Id Linux Id VIA Id | ||
| 61 | -------- -------- -------- ------ | ||
| 62 | CPU Diode N/A temp1 0 | ||
| 63 | UIC1 in0 temp2 * 1 | ||
| 64 | UIC2 in1 * temp3 2 | ||
| 65 | UIC3 in2 * temp4 3 | ||
| 66 | UIC4 in3 * temp5 4 | ||
| 67 | UIC5 in4 * temp6 5 | ||
| 68 | 3.3V in5 N/A | ||
| 69 | |||
| 70 | Note that the BIOS may set the configuration register to a different value | ||
| 71 | to match the motherboard configuration. | ||
| 72 | */ | ||
| 73 | |||
| 74 | /* fans numbered 0-1 */ | ||
| 75 | #define VT8231_REG_FAN_MIN(nr) (0x3b + (nr)) | ||
| 76 | #define VT8231_REG_FAN(nr) (0x29 + (nr)) | ||
| 77 | |||
| 78 | /* Voltage inputs numbered 0-5 */ | ||
| 79 | |||
| 80 | static const u8 regvolt[] = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 }; | ||
| 81 | static const u8 regvoltmax[] = { 0x3d, 0x2b, 0x2d, 0x2f, 0x31, 0x33 }; | ||
| 82 | static const u8 regvoltmin[] = { 0x3e, 0x2c, 0x2e, 0x30, 0x32, 0x34 }; | ||
| 83 | |||
| 84 | /* Temperatures are numbered 1-6 according to the Linux kernel specification. | ||
| 85 | ** | ||
| 86 | ** In the VIA datasheet, however, the temperatures are numbered from zero. | ||
| 87 | ** Since it is important that this driver can easily be compared to the VIA | ||
| 88 | ** datasheet, we will use the VIA numbering within this driver and map the | ||
| 89 | ** kernel sysfs device name to the VIA number in the sysfs callback. | ||
| 90 | */ | ||
| 91 | |||
| 92 | #define VT8231_REG_TEMP_LOW01 0x49 | ||
| 93 | #define VT8231_REG_TEMP_LOW25 0x4d | ||
| 94 | |||
| 95 | static const u8 regtemp[] = { 0x1f, 0x21, 0x22, 0x23, 0x24, 0x25 }; | ||
| 96 | static const u8 regtempmax[] = { 0x39, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 }; | ||
| 97 | static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 }; | ||
| 98 | |||
| 99 | #define TEMP_FROM_REG(reg) (((253 * 4 - (reg)) * 550 + 105) / 210) | ||
| 100 | #define TEMP_MAXMIN_FROM_REG(reg) (((253 - (reg)) * 2200 + 105) / 210) | ||
| 101 | #define TEMP_MAXMIN_TO_REG(val) (253 - ((val) * 210 + 1100) / 2200) | ||
| 102 | |||
| 103 | #define VT8231_REG_CONFIG 0x40 | ||
| 104 | #define VT8231_REG_ALARM1 0x41 | ||
| 105 | #define VT8231_REG_ALARM2 0x42 | ||
| 106 | #define VT8231_REG_FANDIV 0x47 | ||
| 107 | #define VT8231_REG_UCH_CONFIG 0x4a | ||
| 108 | #define VT8231_REG_TEMP1_CONFIG 0x4b | ||
| 109 | #define VT8231_REG_TEMP2_CONFIG 0x4c | ||
| 110 | |||
| 111 | /* temps 0-5 as numbered in VIA datasheet - see later for mapping to Linux | ||
| 112 | ** numbering | ||
| 113 | */ | ||
| 114 | #define ISTEMP(i, ch_config) ((i) == 0 ? 1 : \ | ||
| 115 | ((ch_config) >> ((i)+1)) & 0x01) | ||
| 116 | /* voltages 0-5 */ | ||
| 117 | #define ISVOLT(i, ch_config) ((i) == 5 ? 1 : \ | ||
| 118 | !(((ch_config) >> ((i)+2)) & 0x01)) | ||
| 119 | |||
| 120 | #define DIV_FROM_REG(val) (1 << (val)) | ||
| 121 | |||
| 122 | /* NB The values returned here are NOT temperatures. The calibration curves | ||
| 123 | ** for the thermistor curves are board-specific and must go in the | ||
| 124 | ** sensors.conf file. Temperature sensors are actually ten bits, but the | ||
| 125 | ** VIA datasheet only considers the 8 MSBs obtained from the regtemp[] | ||
| 126 | ** register. The temperature value returned should have a magnitude of 3, | ||
| 127 | ** so we use the VIA scaling as the "true" scaling and use the remaining 2 | ||
| 128 | ** LSBs as fractional precision. | ||
| 129 | ** | ||
| 130 | ** All the on-chip hardware temperature comparisons for the alarms are only | ||
| 131 | ** 8-bits wide, and compare against the 8 MSBs of the temperature. The bits | ||
| 132 | ** in the registers VT8231_REG_TEMP_LOW01 and VT8231_REG_TEMP_LOW25 are | ||
| 133 | ** ignored. | ||
| 134 | */ | ||
| 135 | |||
| 136 | /******** FAN RPM CONVERSIONS ******** | ||
| 137 | ** This chip saturates back at 0, not at 255 like many the other chips. | ||
| 138 | ** So, 0 means 0 RPM | ||
| 139 | */ | ||
| 140 | static inline u8 FAN_TO_REG(long rpm, int div) | ||
| 141 | { | ||
| 142 | if (rpm == 0) | ||
| 143 | return 0; | ||
| 144 | return SENSORS_LIMIT(1310720 / (rpm * div), 1, 255); | ||
| 145 | } | ||
| 146 | |||
| 147 | #define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : 1310720 / ((val) * (div))) | ||
| 148 | |||
| 149 | struct vt8231_data { | ||
| 150 | struct i2c_client client; | ||
| 151 | struct semaphore update_lock; | ||
| 152 | struct class_device *class_dev; | ||
| 153 | char valid; /* !=0 if following fields are valid */ | ||
| 154 | unsigned long last_updated; /* In jiffies */ | ||
| 155 | |||
| 156 | u8 in[6]; /* Register value */ | ||
| 157 | u8 in_max[6]; /* Register value */ | ||
| 158 | u8 in_min[6]; /* Register value */ | ||
| 159 | u16 temp[6]; /* Register value 10 bit, right aligned */ | ||
| 160 | u8 temp_max[6]; /* Register value */ | ||
| 161 | u8 temp_min[6]; /* Register value */ | ||
| 162 | u8 fan[2]; /* Register value */ | ||
| 163 | u8 fan_min[2]; /* Register value */ | ||
| 164 | u8 fan_div[2]; /* Register encoding, shifted right */ | ||
| 165 | u16 alarms; /* Register encoding */ | ||
| 166 | u8 uch_config; | ||
| 167 | }; | ||
| 168 | |||
| 169 | static struct pci_dev *s_bridge; | ||
| 170 | static int vt8231_detect(struct i2c_adapter *adapter); | ||
| 171 | static int vt8231_detach_client(struct i2c_client *client); | ||
| 172 | static struct vt8231_data *vt8231_update_device(struct device *dev); | ||
| 173 | static void vt8231_init_client(struct i2c_client *client); | ||
| 174 | |||
| 175 | static inline int vt8231_read_value(struct i2c_client *client, u8 reg) | ||
| 176 | { | ||
| 177 | return inb_p(client->addr + reg); | ||
| 178 | } | ||
| 179 | |||
| 180 | static inline void vt8231_write_value(struct i2c_client *client, u8 reg, | ||
| 181 | u8 value) | ||
| 182 | { | ||
| 183 | outb_p(value, client->addr + reg); | ||
| 184 | } | ||
| 185 | |||
| 186 | /* following are the sysfs callback functions */ | ||
| 187 | static ssize_t show_in(struct device *dev, struct device_attribute *attr, | ||
| 188 | char *buf) | ||
| 189 | { | ||
| 190 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 191 | int nr = sensor_attr->index; | ||
| 192 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 193 | |||
| 194 | return sprintf(buf, "%d\n", ((data->in[nr] - 3) * 10000) / 958); | ||
| 195 | } | ||
| 196 | |||
| 197 | static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, | ||
| 198 | char *buf) | ||
| 199 | { | ||
| 200 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 201 | int nr = sensor_attr->index; | ||
| 202 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 203 | |||
| 204 | return sprintf(buf, "%d\n", ((data->in_min[nr] - 3) * 10000) / 958); | ||
| 205 | } | ||
| 206 | |||
| 207 | static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, | ||
| 208 | char *buf) | ||
| 209 | { | ||
| 210 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 211 | int nr = sensor_attr->index; | ||
| 212 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 213 | |||
| 214 | return sprintf(buf, "%d\n", (((data->in_max[nr] - 3) * 10000) / 958)); | ||
| 215 | } | ||
| 216 | |||
| 217 | static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, | ||
| 218 | const char *buf, size_t count) | ||
| 219 | { | ||
| 220 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 221 | int nr = sensor_attr->index; | ||
| 222 | struct i2c_client *client = to_i2c_client(dev); | ||
| 223 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 224 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
| 225 | |||
| 226 | down(&data->update_lock); | ||
| 227 | data->in_min[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255); | ||
| 228 | vt8231_write_value(client, regvoltmin[nr], data->in_min[nr]); | ||
| 229 | up(&data->update_lock); | ||
| 230 | return count; | ||
| 231 | } | ||
| 232 | |||
| 233 | static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, | ||
| 234 | const char *buf, size_t count) | ||
| 235 | { | ||
| 236 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 237 | int nr = sensor_attr->index; | ||
| 238 | struct i2c_client *client = to_i2c_client(dev); | ||
| 239 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 240 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
| 241 | |||
| 242 | down(&data->update_lock); | ||
| 243 | data->in_max[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255); | ||
| 244 | vt8231_write_value(client, regvoltmax[nr], data->in_max[nr]); | ||
| 245 | up(&data->update_lock); | ||
| 246 | return count; | ||
| 247 | } | ||
| 248 | |||
| 249 | /* Special case for input 5 as this has 3.3V scaling built into the chip */ | ||
| 250 | static ssize_t show_in5(struct device *dev, struct device_attribute *attr, | ||
| 251 | char *buf) | ||
| 252 | { | ||
| 253 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 254 | |||
| 255 | return sprintf(buf, "%d\n", | ||
| 256 | (((data->in[5] - 3) * 10000 * 54) / (958 * 34))); | ||
| 257 | } | ||
| 258 | |||
| 259 | static ssize_t show_in5_min(struct device *dev, struct device_attribute *attr, | ||
| 260 | char *buf) | ||
| 261 | { | ||
| 262 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 263 | |||
| 264 | return sprintf(buf, "%d\n", | ||
| 265 | (((data->in_min[5] - 3) * 10000 * 54) / (958 * 34))); | ||
| 266 | } | ||
| 267 | |||
| 268 | static ssize_t show_in5_max(struct device *dev, struct device_attribute *attr, | ||
| 269 | char *buf) | ||
| 270 | { | ||
| 271 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 272 | |||
| 273 | return sprintf(buf, "%d\n", | ||
| 274 | (((data->in_max[5] - 3) * 10000 * 54) / (958 * 34))); | ||
| 275 | } | ||
| 276 | |||
| 277 | static ssize_t set_in5_min(struct device *dev, struct device_attribute *attr, | ||
| 278 | const char *buf, size_t count) | ||
| 279 | { | ||
| 280 | struct i2c_client *client = to_i2c_client(dev); | ||
| 281 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 282 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
| 283 | |||
| 284 | down(&data->update_lock); | ||
| 285 | data->in_min[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3, | ||
| 286 | 0, 255); | ||
| 287 | vt8231_write_value(client, regvoltmin[5], data->in_min[5]); | ||
| 288 | up(&data->update_lock); | ||
| 289 | return count; | ||
| 290 | } | ||
| 291 | |||
| 292 | static ssize_t set_in5_max(struct device *dev, struct device_attribute *attr, | ||
| 293 | const char *buf, size_t count) | ||
| 294 | { | ||
| 295 | struct i2c_client *client = to_i2c_client(dev); | ||
| 296 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 297 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
| 298 | |||
| 299 | down(&data->update_lock); | ||
| 300 | data->in_max[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3, | ||
| 301 | 0, 255); | ||
| 302 | vt8231_write_value(client, regvoltmax[5], data->in_max[5]); | ||
| 303 | up(&data->update_lock); | ||
| 304 | return count; | ||
| 305 | } | ||
| 306 | |||
| 307 | #define define_voltage_sysfs(offset) \ | ||
| 308 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | ||
| 309 | show_in, NULL, offset); \ | ||
| 310 | static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ | ||
| 311 | show_in_min, set_in_min, offset); \ | ||
| 312 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ | ||
| 313 | show_in_max, set_in_max, offset) | ||
| 314 | |||
| 315 | define_voltage_sysfs(0); | ||
| 316 | define_voltage_sysfs(1); | ||
| 317 | define_voltage_sysfs(2); | ||
| 318 | define_voltage_sysfs(3); | ||
| 319 | define_voltage_sysfs(4); | ||
| 320 | |||
| 321 | static DEVICE_ATTR(in5_input, S_IRUGO, show_in5, NULL); | ||
| 322 | static DEVICE_ATTR(in5_min, S_IRUGO | S_IWUSR, show_in5_min, set_in5_min); | ||
| 323 | static DEVICE_ATTR(in5_max, S_IRUGO | S_IWUSR, show_in5_max, set_in5_max); | ||
| 324 | |||
| 325 | /* Temperatures */ | ||
| 326 | static ssize_t show_temp0(struct device *dev, struct device_attribute *attr, | ||
| 327 | char *buf) | ||
| 328 | { | ||
| 329 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 330 | return sprintf(buf, "%d\n", data->temp[0] * 250); | ||
| 331 | } | ||
| 332 | |||
| 333 | static ssize_t show_temp0_max(struct device *dev, struct device_attribute *attr, | ||
| 334 | char *buf) | ||
| 335 | { | ||
| 336 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 337 | return sprintf(buf, "%d\n", data->temp_max[0] * 1000); | ||
| 338 | } | ||
| 339 | |||
| 340 | static ssize_t show_temp0_min(struct device *dev, struct device_attribute *attr, | ||
| 341 | char *buf) | ||
| 342 | { | ||
| 343 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 344 | return sprintf(buf, "%d\n", data->temp_min[0] * 1000); | ||
| 345 | } | ||
| 346 | |||
| 347 | static ssize_t set_temp0_max(struct device *dev, struct device_attribute *attr, | ||
| 348 | const char *buf, size_t count) | ||
| 349 | { | ||
| 350 | struct i2c_client *client = to_i2c_client(dev); | ||
| 351 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 352 | int val = simple_strtol(buf, NULL, 10); | ||
| 353 | |||
| 354 | down(&data->update_lock); | ||
| 355 | data->temp_max[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255); | ||
| 356 | vt8231_write_value(client, regtempmax[0], data->temp_max[0]); | ||
| 357 | up(&data->update_lock); | ||
| 358 | return count; | ||
| 359 | } | ||
| 360 | static ssize_t set_temp0_min(struct device *dev, struct device_attribute *attr, | ||
| 361 | const char *buf, size_t count) | ||
| 362 | { | ||
| 363 | struct i2c_client *client = to_i2c_client(dev); | ||
| 364 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 365 | int val = simple_strtol(buf, NULL, 10); | ||
| 366 | |||
| 367 | down(&data->update_lock); | ||
| 368 | data->temp_min[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255); | ||
| 369 | vt8231_write_value(client, regtempmin[0], data->temp_min[0]); | ||
| 370 | up(&data->update_lock); | ||
| 371 | return count; | ||
| 372 | } | ||
| 373 | |||
| 374 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | ||
| 375 | char *buf) | ||
| 376 | { | ||
| 377 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 378 | int nr = sensor_attr->index; | ||
| 379 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 380 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); | ||
| 381 | } | ||
| 382 | |||
| 383 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, | ||
| 384 | char *buf) | ||
| 385 | { | ||
| 386 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 387 | int nr = sensor_attr->index; | ||
| 388 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 389 | return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_max[nr])); | ||
| 390 | } | ||
| 391 | |||
| 392 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, | ||
| 393 | char *buf) | ||
| 394 | { | ||
| 395 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 396 | int nr = sensor_attr->index; | ||
| 397 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 398 | return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_min[nr])); | ||
| 399 | } | ||
| 400 | |||
| 401 | static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | ||
| 402 | const char *buf, size_t count) | ||
| 403 | { | ||
| 404 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 405 | int nr = sensor_attr->index; | ||
| 406 | struct i2c_client *client = to_i2c_client(dev); | ||
| 407 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 408 | int val = simple_strtol(buf, NULL, 10); | ||
| 409 | |||
| 410 | down(&data->update_lock); | ||
| 411 | data->temp_max[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255); | ||
| 412 | vt8231_write_value(client, regtempmax[nr], data->temp_max[nr]); | ||
| 413 | up(&data->update_lock); | ||
| 414 | return count; | ||
| 415 | } | ||
| 416 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | ||
| 417 | const char *buf, size_t count) | ||
| 418 | { | ||
| 419 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 420 | int nr = sensor_attr->index; | ||
| 421 | struct i2c_client *client = to_i2c_client(dev); | ||
| 422 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 423 | int val = simple_strtol(buf, NULL, 10); | ||
| 424 | |||
| 425 | down(&data->update_lock); | ||
| 426 | data->temp_min[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255); | ||
| 427 | vt8231_write_value(client, regtempmin[nr], data->temp_min[nr]); | ||
| 428 | up(&data->update_lock); | ||
| 429 | return count; | ||
| 430 | } | ||
| 431 | |||
| 432 | /* Note that these map the Linux temperature sensor numbering (1-6) to the VIA | ||
| 433 | ** temperature sensor numbering (0-5) | ||
| 434 | */ | ||
| 435 | #define define_temperature_sysfs(offset) \ | ||
| 436 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | ||
| 437 | show_temp, NULL, offset - 1); \ | ||
| 438 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ | ||
| 439 | show_temp_max, set_temp_max, offset - 1); \ | ||
| 440 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ | ||
| 441 | show_temp_min, set_temp_min, offset - 1) | ||
| 442 | |||
| 443 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp0, NULL); | ||
| 444 | static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp0_max, set_temp0_max); | ||
| 445 | static DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, show_temp0_min, set_temp0_min); | ||
| 446 | |||
| 447 | define_temperature_sysfs(2); | ||
| 448 | define_temperature_sysfs(3); | ||
| 449 | define_temperature_sysfs(4); | ||
| 450 | define_temperature_sysfs(5); | ||
| 451 | define_temperature_sysfs(6); | ||
| 452 | |||
| 453 | #define CFG_INFO_TEMP(id) { &sensor_dev_attr_temp##id##_input.dev_attr, \ | ||
| 454 | &sensor_dev_attr_temp##id##_min.dev_attr, \ | ||
| 455 | &sensor_dev_attr_temp##id##_max.dev_attr } | ||
| 456 | #define CFG_INFO_VOLT(id) { &sensor_dev_attr_in##id##_input.dev_attr, \ | ||
| 457 | &sensor_dev_attr_in##id##_min.dev_attr, \ | ||
| 458 | &sensor_dev_attr_in##id##_max.dev_attr } | ||
| 459 | |||
| 460 | struct str_device_attr_table { | ||
| 461 | struct device_attribute *input; | ||
| 462 | struct device_attribute *min; | ||
| 463 | struct device_attribute *max; | ||
| 464 | }; | ||
| 465 | |||
| 466 | static struct str_device_attr_table cfg_info_temp[] = { | ||
| 467 | { &dev_attr_temp1_input, &dev_attr_temp1_min, &dev_attr_temp1_max }, | ||
| 468 | CFG_INFO_TEMP(2), | ||
| 469 | CFG_INFO_TEMP(3), | ||
| 470 | CFG_INFO_TEMP(4), | ||
| 471 | CFG_INFO_TEMP(5), | ||
| 472 | CFG_INFO_TEMP(6) | ||
| 473 | }; | ||
| 474 | |||
| 475 | static struct str_device_attr_table cfg_info_volt[] = { | ||
| 476 | CFG_INFO_VOLT(0), | ||
| 477 | CFG_INFO_VOLT(1), | ||
| 478 | CFG_INFO_VOLT(2), | ||
| 479 | CFG_INFO_VOLT(3), | ||
| 480 | CFG_INFO_VOLT(4), | ||
| 481 | { &dev_attr_in5_input, &dev_attr_in5_min, &dev_attr_in5_max } | ||
| 482 | }; | ||
| 483 | |||
| 484 | /* Fans */ | ||
| 485 | static ssize_t show_fan(struct device *dev, struct device_attribute *attr, | ||
| 486 | char *buf) | ||
| 487 | { | ||
| 488 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 489 | int nr = sensor_attr->index; | ||
| 490 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 491 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr], | ||
| 492 | DIV_FROM_REG(data->fan_div[nr]))); | ||
| 493 | } | ||
| 494 | |||
| 495 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, | ||
| 496 | char *buf) | ||
| 497 | { | ||
| 498 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 499 | int nr = sensor_attr->index; | ||
| 500 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 501 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr], | ||
| 502 | DIV_FROM_REG(data->fan_div[nr]))); | ||
| 503 | } | ||
| 504 | |||
| 505 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, | ||
| 506 | char *buf) | ||
| 507 | { | ||
| 508 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 509 | int nr = sensor_attr->index; | ||
| 510 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 511 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr])); | ||
| 512 | } | ||
| 513 | |||
| 514 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | ||
| 515 | const char *buf, size_t count) | ||
| 516 | { | ||
| 517 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 518 | int nr = sensor_attr->index; | ||
| 519 | struct i2c_client *client = to_i2c_client(dev); | ||
| 520 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 521 | int val = simple_strtoul(buf, NULL, 10); | ||
| 522 | |||
| 523 | down(&data->update_lock); | ||
| 524 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | ||
| 525 | vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]); | ||
| 526 | up(&data->update_lock); | ||
| 527 | return count; | ||
| 528 | } | ||
| 529 | |||
| 530 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | ||
| 531 | const char *buf, size_t count) | ||
| 532 | { | ||
| 533 | struct i2c_client *client = to_i2c_client(dev); | ||
| 534 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 535 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
| 536 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
| 537 | int nr = sensor_attr->index; | ||
| 538 | int old = vt8231_read_value(client, VT8231_REG_FANDIV); | ||
| 539 | long min = FAN_FROM_REG(data->fan_min[nr], | ||
| 540 | DIV_FROM_REG(data->fan_div[nr])); | ||
| 541 | |||
| 542 | down(&data->update_lock); | ||
| 543 | switch (val) { | ||
| 544 | case 1: data->fan_div[nr] = 0; break; | ||
| 545 | case 2: data->fan_div[nr] = 1; break; | ||
| 546 | case 4: data->fan_div[nr] = 2; break; | ||
| 547 | case 8: data->fan_div[nr] = 3; break; | ||
| 548 | default: | ||
| 549 | dev_err(&client->dev, "fan_div value %ld not supported." | ||
| 550 | "Choose one of 1, 2, 4 or 8!\n", val); | ||
| 551 | up(&data->update_lock); | ||
| 552 | return -EINVAL; | ||
| 553 | } | ||
| 554 | |||
| 555 | /* Correct the fan minimum speed */ | ||
| 556 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); | ||
| 557 | vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]); | ||
| 558 | |||
| 559 | old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4); | ||
| 560 | vt8231_write_value(client, VT8231_REG_FANDIV, old); | ||
| 561 | up(&data->update_lock); | ||
| 562 | return count; | ||
| 563 | } | ||
| 564 | |||
| 565 | |||
| 566 | #define define_fan_sysfs(offset) \ | ||
| 567 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ | ||
| 568 | show_fan, NULL, offset - 1); \ | ||
| 569 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | ||
| 570 | show_fan_div, set_fan_div, offset - 1); \ | ||
| 571 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | ||
| 572 | show_fan_min, set_fan_min, offset - 1) | ||
| 573 | |||
| 574 | define_fan_sysfs(1); | ||
| 575 | define_fan_sysfs(2); | ||
| 576 | |||
| 577 | /* Alarms */ | ||
| 578 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, | ||
| 579 | char *buf) | ||
| 580 | { | ||
| 581 | struct vt8231_data *data = vt8231_update_device(dev); | ||
| 582 | return sprintf(buf, "%d\n", data->alarms); | ||
| 583 | } | ||
| 584 | |||
| 585 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | ||
| 586 | |||
| 587 | static struct i2c_driver vt8231_driver = { | ||
| 588 | .driver = { | ||
| 589 | .name = "vt8231", | ||
| 590 | }, | ||
| 591 | .attach_adapter = vt8231_detect, | ||
| 592 | .detach_client = vt8231_detach_client, | ||
| 593 | }; | ||
| 594 | |||
| 595 | static struct pci_device_id vt8231_pci_ids[] = { | ||
| 596 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, | ||
| 597 | { 0, } | ||
| 598 | }; | ||
| 599 | |||
| 600 | MODULE_DEVICE_TABLE(pci, vt8231_pci_ids); | ||
| 601 | |||
| 602 | static int __devinit vt8231_pci_probe(struct pci_dev *dev, | ||
| 603 | const struct pci_device_id *id); | ||
| 604 | |||
| 605 | static struct pci_driver vt8231_pci_driver = { | ||
| 606 | .name = "vt8231", | ||
| 607 | .id_table = vt8231_pci_ids, | ||
| 608 | .probe = vt8231_pci_probe, | ||
| 609 | }; | ||
| 610 | |||
| 611 | int vt8231_detect(struct i2c_adapter *adapter) | ||
| 612 | { | ||
| 613 | struct i2c_client *client; | ||
| 614 | struct vt8231_data *data; | ||
| 615 | int err = 0, i; | ||
| 616 | u16 val; | ||
| 617 | |||
| 618 | /* 8231 requires multiple of 256 */ | ||
| 619 | if (force_addr) { | ||
| 620 | isa_address = force_addr & 0xFF00; | ||
| 621 | dev_warn(&adapter->dev, "forcing ISA address 0x%04X\n", | ||
| 622 | isa_address); | ||
| 623 | if (PCIBIOS_SUCCESSFUL != pci_write_config_word(s_bridge, | ||
| 624 | VT8231_BASE_REG, isa_address)) | ||
| 625 | return -ENODEV; | ||
| 626 | } | ||
| 627 | |||
| 628 | if (PCIBIOS_SUCCESSFUL != | ||
| 629 | pci_read_config_word(s_bridge, VT8231_ENABLE_REG, &val)) | ||
| 630 | return -ENODEV; | ||
| 631 | |||
| 632 | if (!(val & 0x0001)) { | ||
| 633 | dev_warn(&adapter->dev, "enabling sensors\n"); | ||
| 634 | if (PCIBIOS_SUCCESSFUL != | ||
| 635 | pci_write_config_word(s_bridge, VT8231_ENABLE_REG, | ||
| 636 | val | 0x0001)) | ||
| 637 | return -ENODEV; | ||
| 638 | } | ||
| 639 | |||
| 640 | /* Reserve the ISA region */ | ||
| 641 | if (!request_region(isa_address, VT8231_EXTENT, | ||
| 642 | vt8231_pci_driver.name)) { | ||
| 643 | dev_err(&adapter->dev, "region 0x%x already in use!\n", | ||
| 644 | isa_address); | ||
| 645 | return -ENODEV; | ||
| 646 | } | ||
| 647 | |||
| 648 | if (!(data = kzalloc(sizeof(struct vt8231_data), GFP_KERNEL))) { | ||
| 649 | err = -ENOMEM; | ||
| 650 | goto exit_release; | ||
| 651 | } | ||
| 652 | |||
| 653 | client = &data->client; | ||
| 654 | i2c_set_clientdata(client, data); | ||
| 655 | client->addr = isa_address; | ||
| 656 | client->adapter = adapter; | ||
| 657 | client->driver = &vt8231_driver; | ||
| 658 | client->dev.parent = &adapter->dev; | ||
| 659 | |||
| 660 | /* Fill in the remaining client fields and put into the global list */ | ||
| 661 | strlcpy(client->name, "vt8231", I2C_NAME_SIZE); | ||
| 662 | |||
| 663 | init_MUTEX(&data->update_lock); | ||
| 664 | |||
| 665 | /* Tell the I2C layer a new client has arrived */ | ||
| 666 | if ((err = i2c_attach_client(client))) | ||
| 667 | goto exit_free; | ||
| 668 | |||
| 669 | vt8231_init_client(client); | ||
| 670 | |||
| 671 | /* Register sysfs hooks */ | ||
| 672 | data->class_dev = hwmon_device_register(&client->dev); | ||
| 673 | if (IS_ERR(data->class_dev)) { | ||
| 674 | err = PTR_ERR(data->class_dev); | ||
| 675 | goto exit_detach; | ||
| 676 | } | ||
| 677 | |||
| 678 | /* Must update device information to find out the config field */ | ||
| 679 | data->uch_config = vt8231_read_value(client, VT8231_REG_UCH_CONFIG); | ||
| 680 | |||
| 681 | for (i = 0; i < ARRAY_SIZE(cfg_info_temp); i++) { | ||
| 682 | if (ISTEMP(i, data->uch_config)) { | ||
| 683 | device_create_file(&client->dev, | ||
| 684 | cfg_info_temp[i].input); | ||
| 685 | device_create_file(&client->dev, cfg_info_temp[i].max); | ||
| 686 | device_create_file(&client->dev, cfg_info_temp[i].min); | ||
| 687 | } | ||
| 688 | } | ||
| 689 | |||
| 690 | for (i = 0; i < ARRAY_SIZE(cfg_info_volt); i++) { | ||
| 691 | if (ISVOLT(i, data->uch_config)) { | ||
| 692 | device_create_file(&client->dev, | ||
| 693 | cfg_info_volt[i].input); | ||
| 694 | device_create_file(&client->dev, cfg_info_volt[i].max); | ||
| 695 | device_create_file(&client->dev, cfg_info_volt[i].min); | ||
| 696 | } | ||
| 697 | } | ||
| 698 | |||
| 699 | device_create_file(&client->dev, &sensor_dev_attr_fan1_input.dev_attr); | ||
| 700 | device_create_file(&client->dev, &sensor_dev_attr_fan2_input.dev_attr); | ||
| 701 | device_create_file(&client->dev, &sensor_dev_attr_fan1_min.dev_attr); | ||
| 702 | device_create_file(&client->dev, &sensor_dev_attr_fan2_min.dev_attr); | ||
| 703 | device_create_file(&client->dev, &sensor_dev_attr_fan1_div.dev_attr); | ||
| 704 | device_create_file(&client->dev, &sensor_dev_attr_fan2_div.dev_attr); | ||
| 705 | |||
| 706 | device_create_file(&client->dev, &dev_attr_alarms); | ||
| 707 | return 0; | ||
| 708 | |||
| 709 | exit_detach: | ||
| 710 | i2c_detach_client(client); | ||
| 711 | exit_free: | ||
| 712 | kfree(data); | ||
| 713 | exit_release: | ||
| 714 | release_region(isa_address, VT8231_EXTENT); | ||
| 715 | return err; | ||
| 716 | } | ||
| 717 | |||
| 718 | static int vt8231_detach_client(struct i2c_client *client) | ||
| 719 | { | ||
| 720 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 721 | int err; | ||
| 722 | |||
| 723 | hwmon_device_unregister(data->class_dev); | ||
| 724 | |||
| 725 | if ((err = i2c_detach_client(client))) { | ||
| 726 | return err; | ||
| 727 | } | ||
| 728 | |||
| 729 | release_region(client->addr, VT8231_EXTENT); | ||
| 730 | kfree(data); | ||
| 731 | |||
| 732 | return 0; | ||
| 733 | } | ||
| 734 | |||
| 735 | static void vt8231_init_client(struct i2c_client *client) | ||
| 736 | { | ||
| 737 | vt8231_write_value(client, VT8231_REG_TEMP1_CONFIG, 0); | ||
| 738 | vt8231_write_value(client, VT8231_REG_TEMP2_CONFIG, 0); | ||
| 739 | } | ||
| 740 | |||
| 741 | static struct vt8231_data *vt8231_update_device(struct device *dev) | ||
| 742 | { | ||
| 743 | struct i2c_client *client = to_i2c_client(dev); | ||
| 744 | struct vt8231_data *data = i2c_get_clientdata(client); | ||
| 745 | int i; | ||
| 746 | u16 low; | ||
| 747 | |||
| 748 | down(&data->update_lock); | ||
| 749 | |||
| 750 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) | ||
| 751 | || !data->valid) { | ||
| 752 | for (i = 0; i < 6; i++) { | ||
| 753 | if (ISVOLT(i, data->uch_config)) { | ||
| 754 | data->in[i] = vt8231_read_value(client, | ||
| 755 | regvolt[i]); | ||
| 756 | data->in_min[i] = vt8231_read_value(client, | ||
| 757 | regvoltmin[i]); | ||
| 758 | data->in_max[i] = vt8231_read_value(client, | ||
| 759 | regvoltmax[i]); | ||
| 760 | } | ||
| 761 | } | ||
| 762 | for (i = 0; i < 2; i++) { | ||
| 763 | data->fan[i] = vt8231_read_value(client, | ||
| 764 | VT8231_REG_FAN(i)); | ||
| 765 | data->fan_min[i] = vt8231_read_value(client, | ||
| 766 | VT8231_REG_FAN_MIN(i)); | ||
| 767 | } | ||
| 768 | |||
| 769 | low = vt8231_read_value(client, VT8231_REG_TEMP_LOW01); | ||
| 770 | low = (low >> 6) | ((low & 0x30) >> 2) | ||
| 771 | | (vt8231_read_value(client, VT8231_REG_TEMP_LOW25) << 4); | ||
| 772 | for (i = 0; i < 6; i++) { | ||
| 773 | if (ISTEMP(i, data->uch_config)) { | ||
| 774 | data->temp[i] = (vt8231_read_value(client, | ||
| 775 | regtemp[i]) << 2) | ||
| 776 | | ((low >> (2 * i)) & 0x03); | ||
| 777 | data->temp_max[i] = vt8231_read_value(client, | ||
| 778 | regtempmax[i]); | ||
| 779 | data->temp_min[i] = vt8231_read_value(client, | ||
| 780 | regtempmin[i]); | ||
| 781 | } | ||
| 782 | } | ||
| 783 | |||
| 784 | i = vt8231_read_value(client, VT8231_REG_FANDIV); | ||
| 785 | data->fan_div[0] = (i >> 4) & 0x03; | ||
| 786 | data->fan_div[1] = i >> 6; | ||
| 787 | data->alarms = vt8231_read_value(client, VT8231_REG_ALARM1) | | ||
| 788 | (vt8231_read_value(client, VT8231_REG_ALARM2) << 8); | ||
| 789 | |||
| 790 | /* Set alarm flags correctly */ | ||
| 791 | if (!data->fan[0] && data->fan_min[0]) { | ||
| 792 | data->alarms |= 0x40; | ||
| 793 | } else if (data->fan[0] && !data->fan_min[0]) { | ||
| 794 | data->alarms &= ~0x40; | ||
| 795 | } | ||
| 796 | |||
| 797 | if (!data->fan[1] && data->fan_min[1]) { | ||
| 798 | data->alarms |= 0x80; | ||
| 799 | } else if (data->fan[1] && !data->fan_min[1]) { | ||
| 800 | data->alarms &= ~0x80; | ||
| 801 | } | ||
| 802 | |||
| 803 | data->last_updated = jiffies; | ||
| 804 | data->valid = 1; | ||
| 805 | } | ||
| 806 | |||
| 807 | up(&data->update_lock); | ||
| 808 | |||
| 809 | return data; | ||
| 810 | } | ||
| 811 | |||
| 812 | static int __devinit vt8231_pci_probe(struct pci_dev *dev, | ||
| 813 | const struct pci_device_id *id) | ||
| 814 | { | ||
| 815 | u16 val; | ||
| 816 | |||
| 817 | if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_BASE_REG, | ||
| 818 | &val)) | ||
| 819 | return -ENODEV; | ||
| 820 | |||
| 821 | isa_address = val & ~(VT8231_EXTENT - 1); | ||
| 822 | if (isa_address == 0 && force_addr == 0) { | ||
| 823 | dev_err(&dev->dev, "base address not set -\ | ||
| 824 | upgrade BIOS or use force_addr=0xaddr\n"); | ||
| 825 | return -ENODEV; | ||
| 826 | } | ||
| 827 | |||
| 828 | s_bridge = pci_dev_get(dev); | ||
| 829 | |||
| 830 | if (i2c_isa_add_driver(&vt8231_driver)) { | ||
| 831 | pci_dev_put(s_bridge); | ||
| 832 | s_bridge = NULL; | ||
| 833 | } | ||
| 834 | |||
| 835 | /* Always return failure here. This is to allow other drivers to bind | ||
| 836 | * to this pci device. We don't really want to have control over the | ||
| 837 | * pci device, we only wanted to read as few register values from it. | ||
| 838 | */ | ||
| 839 | return -ENODEV; | ||
| 840 | } | ||
| 841 | |||
| 842 | static int __init sm_vt8231_init(void) | ||
| 843 | { | ||
| 844 | return pci_module_init(&vt8231_pci_driver); | ||
| 845 | } | ||
| 846 | |||
| 847 | static void __exit sm_vt8231_exit(void) | ||
| 848 | { | ||
| 849 | pci_unregister_driver(&vt8231_pci_driver); | ||
| 850 | if (s_bridge != NULL) { | ||
| 851 | i2c_isa_del_driver(&vt8231_driver); | ||
| 852 | pci_dev_put(s_bridge); | ||
| 853 | s_bridge = NULL; | ||
| 854 | } | ||
| 855 | } | ||
| 856 | |||
| 857 | MODULE_AUTHOR("Roger Lucas <roger@planbit.co.uk>"); | ||
| 858 | MODULE_DESCRIPTION("VT8231 sensors"); | ||
| 859 | MODULE_LICENSE("GPL"); | ||
| 860 | |||
| 861 | module_init(sm_vt8231_init); | ||
| 862 | module_exit(sm_vt8231_exit); | ||
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index eee22a57e929..12d79f5e4900 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
| @@ -676,7 +676,7 @@ static int w83627ehf_detect(struct i2c_adapter *adapter) | |||
| 676 | int i, err = 0; | 676 | int i, err = 0; |
| 677 | 677 | ||
| 678 | if (!request_region(address + REGION_OFFSET, REGION_LENGTH, | 678 | if (!request_region(address + REGION_OFFSET, REGION_LENGTH, |
| 679 | w83627ehf_driver.name)) { | 679 | w83627ehf_driver.driver.name)) { |
| 680 | err = -EBUSY; | 680 | err = -EBUSY; |
| 681 | goto exit; | 681 | goto exit; |
| 682 | } | 682 | } |
| @@ -785,8 +785,9 @@ static int w83627ehf_detach_client(struct i2c_client *client) | |||
| 785 | } | 785 | } |
| 786 | 786 | ||
| 787 | static struct i2c_driver w83627ehf_driver = { | 787 | static struct i2c_driver w83627ehf_driver = { |
| 788 | .owner = THIS_MODULE, | 788 | .driver = { |
| 789 | .name = "w83627ehf", | 789 | .name = "w83627ehf", |
| 790 | }, | ||
| 790 | .attach_adapter = w83627ehf_detect, | 791 | .attach_adapter = w83627ehf_detect, |
| 791 | .detach_client = w83627ehf_detach_client, | 792 | .detach_client = w83627ehf_detach_client, |
| 792 | }; | 793 | }; |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index bbb3dcde146b..7ea441d4da63 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
| @@ -332,8 +332,9 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev); | |||
| 332 | static void w83627hf_init_client(struct i2c_client *client); | 332 | static void w83627hf_init_client(struct i2c_client *client); |
| 333 | 333 | ||
| 334 | static struct i2c_driver w83627hf_driver = { | 334 | static struct i2c_driver w83627hf_driver = { |
| 335 | .owner = THIS_MODULE, | 335 | .driver = { |
| 336 | .name = "w83627hf", | 336 | .name = "w83627hf", |
| 337 | }, | ||
| 337 | .attach_adapter = w83627hf_detect, | 338 | .attach_adapter = w83627hf_detect, |
| 338 | .detach_client = w83627hf_detach_client, | 339 | .detach_client = w83627hf_detach_client, |
| 339 | }; | 340 | }; |
| @@ -1009,7 +1010,7 @@ static int w83627hf_detect(struct i2c_adapter *adapter) | |||
| 1009 | address = force_addr & WINB_ALIGNMENT; | 1010 | address = force_addr & WINB_ALIGNMENT; |
| 1010 | 1011 | ||
| 1011 | if (!request_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE, | 1012 | if (!request_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE, |
| 1012 | w83627hf_driver.name)) { | 1013 | w83627hf_driver.driver.name)) { |
| 1013 | err = -EBUSY; | 1014 | err = -EBUSY; |
| 1014 | goto ERROR0; | 1015 | goto ERROR0; |
| 1015 | } | 1016 | } |
| @@ -1122,11 +1123,10 @@ static int w83627hf_detect(struct i2c_adapter *adapter) | |||
| 1122 | if (kind != w83697hf) | 1123 | if (kind != w83697hf) |
| 1123 | device_create_file_temp(new_client, 3); | 1124 | device_create_file_temp(new_client, 3); |
| 1124 | 1125 | ||
| 1125 | if (kind != w83697hf) | 1126 | if (kind != w83697hf && data->vid != 0xff) { |
| 1126 | device_create_file_vid(new_client); | 1127 | device_create_file_vid(new_client); |
| 1127 | |||
| 1128 | if (kind != w83697hf) | ||
| 1129 | device_create_file_vrm(new_client); | 1128 | device_create_file_vrm(new_client); |
| 1129 | } | ||
| 1130 | 1130 | ||
| 1131 | device_create_file_fan_div(new_client, 1); | 1131 | device_create_file_fan_div(new_client, 1); |
| 1132 | device_create_file_fan_div(new_client, 2); | 1132 | device_create_file_fan_div(new_client, 2); |
| @@ -1232,7 +1232,7 @@ static int w83627thf_read_gpio5(struct i2c_client *client) | |||
| 1232 | 1232 | ||
| 1233 | /* Make sure the pins are configured for input | 1233 | /* Make sure the pins are configured for input |
| 1234 | There must be at least five (VRM 9), and possibly 6 (VRM 10) */ | 1234 | There must be at least five (VRM 9), and possibly 6 (VRM 10) */ |
| 1235 | sel = superio_inb(W83627THF_GPIO5_IOSR); | 1235 | sel = superio_inb(W83627THF_GPIO5_IOSR) & 0x3f; |
| 1236 | if ((sel & 0x1f) != 0x1f) { | 1236 | if ((sel & 0x1f) != 0x1f) { |
| 1237 | dev_dbg(&client->dev, "GPIO5 not configured for VID " | 1237 | dev_dbg(&client->dev, "GPIO5 not configured for VID " |
| 1238 | "function\n"); | 1238 | "function\n"); |
| @@ -1323,19 +1323,18 @@ static void w83627hf_init_client(struct i2c_client *client) | |||
| 1323 | int hi = w83627hf_read_value(client, W83781D_REG_CHIPID); | 1323 | int hi = w83627hf_read_value(client, W83781D_REG_CHIPID); |
| 1324 | data->vid = (lo & 0x0f) | ((hi & 0x01) << 4); | 1324 | data->vid = (lo & 0x0f) | ((hi & 0x01) << 4); |
| 1325 | } else if (w83627thf == data->type) { | 1325 | } else if (w83627thf == data->type) { |
| 1326 | data->vid = w83627thf_read_gpio5(client) & 0x3f; | 1326 | data->vid = w83627thf_read_gpio5(client); |
| 1327 | } | 1327 | } |
| 1328 | 1328 | ||
| 1329 | /* Read VRM & OVT Config only once */ | 1329 | /* Read VRM & OVT Config only once */ |
| 1330 | if (w83627thf == data->type || w83637hf == data->type) { | 1330 | if (w83627thf == data->type || w83637hf == data->type) { |
| 1331 | data->vrm_ovt = | 1331 | data->vrm_ovt = |
| 1332 | w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG); | 1332 | w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG); |
| 1333 | data->vrm = (data->vrm_ovt & 0x01) ? 90 : 82; | ||
| 1334 | } else { | ||
| 1335 | /* Convert VID to voltage based on default VRM */ | ||
| 1336 | data->vrm = vid_which_vrm(); | ||
| 1337 | } | 1333 | } |
| 1338 | 1334 | ||
| 1335 | /* Convert VID to voltage based on VRM */ | ||
| 1336 | data->vrm = vid_which_vrm(); | ||
| 1337 | |||
| 1339 | tmp = w83627hf_read_value(client, W83781D_REG_SCFG1); | 1338 | tmp = w83627hf_read_value(client, W83781D_REG_SCFG1); |
| 1340 | for (i = 1; i <= 3; i++) { | 1339 | for (i = 1; i <= 3; i++) { |
| 1341 | if (!(tmp & BIT_SCFG1[i - 1])) { | 1340 | if (!(tmp & BIT_SCFG1[i - 1])) { |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index ffdb3a03e2b5..557114872f3c 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
| @@ -269,17 +269,18 @@ static struct w83781d_data *w83781d_update_device(struct device *dev); | |||
| 269 | static void w83781d_init_client(struct i2c_client *client); | 269 | static void w83781d_init_client(struct i2c_client *client); |
| 270 | 270 | ||
| 271 | static struct i2c_driver w83781d_driver = { | 271 | static struct i2c_driver w83781d_driver = { |
| 272 | .owner = THIS_MODULE, | 272 | .driver = { |
| 273 | .name = "w83781d", | 273 | .name = "w83781d", |
| 274 | }, | ||
| 274 | .id = I2C_DRIVERID_W83781D, | 275 | .id = I2C_DRIVERID_W83781D, |
| 275 | .flags = I2C_DF_NOTIFY, | ||
| 276 | .attach_adapter = w83781d_attach_adapter, | 276 | .attach_adapter = w83781d_attach_adapter, |
| 277 | .detach_client = w83781d_detach_client, | 277 | .detach_client = w83781d_detach_client, |
| 278 | }; | 278 | }; |
| 279 | 279 | ||
| 280 | static struct i2c_driver w83781d_isa_driver = { | 280 | static struct i2c_driver w83781d_isa_driver = { |
| 281 | .owner = THIS_MODULE, | 281 | .driver = { |
| 282 | .name = "w83781d-isa", | 282 | .name = "w83781d-isa", |
| 283 | }, | ||
| 283 | .attach_adapter = w83781d_isa_attach_adapter, | 284 | .attach_adapter = w83781d_isa_attach_adapter, |
| 284 | .detach_client = w83781d_detach_client, | 285 | .detach_client = w83781d_detach_client, |
| 285 | }; | 286 | }; |
| @@ -1012,7 +1013,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1012 | 1013 | ||
| 1013 | if (is_isa) | 1014 | if (is_isa) |
| 1014 | if (!request_region(address, W83781D_EXTENT, | 1015 | if (!request_region(address, W83781D_EXTENT, |
| 1015 | w83781d_isa_driver.name)) { | 1016 | w83781d_isa_driver.driver.name)) { |
| 1016 | dev_dbg(&adapter->dev, "Request of region " | 1017 | dev_dbg(&adapter->dev, "Request of region " |
| 1017 | "0x%x-0x%x for w83781d failed\n", address, | 1018 | "0x%x-0x%x for w83781d failed\n", address, |
| 1018 | address + W83781D_EXTENT - 1); | 1019 | address + W83781D_EXTENT - 1); |
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 1ba072630361..b176bf0c4c7b 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
| @@ -269,7 +269,6 @@ DIV_TO_REG(long val) | |||
| 269 | struct w83792d_data { | 269 | struct w83792d_data { |
| 270 | struct i2c_client client; | 270 | struct i2c_client client; |
| 271 | struct class_device *class_dev; | 271 | struct class_device *class_dev; |
| 272 | struct semaphore lock; | ||
| 273 | enum chips type; | 272 | enum chips type; |
| 274 | 273 | ||
| 275 | struct semaphore update_lock; | 274 | struct semaphore update_lock; |
| @@ -282,7 +281,7 @@ struct w83792d_data { | |||
| 282 | u8 in[9]; /* Register value */ | 281 | u8 in[9]; /* Register value */ |
| 283 | u8 in_max[9]; /* Register value */ | 282 | u8 in_max[9]; /* Register value */ |
| 284 | u8 in_min[9]; /* Register value */ | 283 | u8 in_min[9]; /* Register value */ |
| 285 | u8 low_bits[2]; /* Additional resolution to voltage in0-6 */ | 284 | u16 low_bits; /* Additional resolution to voltage in6-0 */ |
| 286 | u8 fan[7]; /* Register value */ | 285 | u8 fan[7]; /* Register value */ |
| 287 | u8 fan_min[7]; /* Register value */ | 286 | u8 fan_min[7]; /* Register value */ |
| 288 | u8 temp1[3]; /* current, over, thyst */ | 287 | u8 temp1[3]; /* current, over, thyst */ |
| @@ -317,45 +316,17 @@ static void w83792d_print_debug(struct w83792d_data *data, struct device *dev); | |||
| 317 | static void w83792d_init_client(struct i2c_client *client); | 316 | static void w83792d_init_client(struct i2c_client *client); |
| 318 | 317 | ||
| 319 | static struct i2c_driver w83792d_driver = { | 318 | static struct i2c_driver w83792d_driver = { |
| 320 | .owner = THIS_MODULE, | 319 | .driver = { |
| 321 | .name = "w83792d", | 320 | .name = "w83792d", |
| 322 | .flags = I2C_DF_NOTIFY, | 321 | }, |
| 323 | .attach_adapter = w83792d_attach_adapter, | 322 | .attach_adapter = w83792d_attach_adapter, |
| 324 | .detach_client = w83792d_detach_client, | 323 | .detach_client = w83792d_detach_client, |
| 325 | }; | 324 | }; |
| 326 | 325 | ||
| 327 | static long in_count_from_reg(int nr, struct w83792d_data *data) | 326 | static inline long in_count_from_reg(int nr, struct w83792d_data *data) |
| 328 | { | 327 | { |
| 329 | u16 vol_count = data->in[nr]; | 328 | /* in7 and in8 do not have low bits, but the formula still works */ |
| 330 | u16 low_bits = 0; | 329 | return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03)); |
| 331 | vol_count = (vol_count << 2); | ||
| 332 | switch (nr) | ||
| 333 | { | ||
| 334 | case 0: /* vin0 */ | ||
| 335 | low_bits = (data->low_bits[0]) & 0x03; | ||
| 336 | break; | ||
| 337 | case 1: /* vin1 */ | ||
| 338 | low_bits = ((data->low_bits[0]) & 0x0c) >> 2; | ||
| 339 | break; | ||
| 340 | case 2: /* vin2 */ | ||
| 341 | low_bits = ((data->low_bits[0]) & 0x30) >> 4; | ||
| 342 | break; | ||
| 343 | case 3: /* vin3 */ | ||
| 344 | low_bits = ((data->low_bits[0]) & 0xc0) >> 6; | ||
| 345 | break; | ||
| 346 | case 4: /* vin4 */ | ||
| 347 | low_bits = (data->low_bits[1]) & 0x03; | ||
| 348 | break; | ||
| 349 | case 5: /* vin5 */ | ||
| 350 | low_bits = ((data->low_bits[1]) & 0x0c) >> 2; | ||
| 351 | break; | ||
| 352 | case 6: /* vin6 */ | ||
| 353 | low_bits = ((data->low_bits[1]) & 0x30) >> 4; | ||
| 354 | default: | ||
| 355 | break; | ||
| 356 | } | ||
| 357 | vol_count = vol_count | low_bits; | ||
| 358 | return vol_count; | ||
| 359 | } | 330 | } |
| 360 | 331 | ||
| 361 | /* following are the sysfs callback functions */ | 332 | /* following are the sysfs callback functions */ |
| @@ -1192,7 +1163,6 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1192 | new_client = &data->client; | 1163 | new_client = &data->client; |
| 1193 | i2c_set_clientdata(new_client, data); | 1164 | i2c_set_clientdata(new_client, data); |
| 1194 | new_client->addr = address; | 1165 | new_client->addr = address; |
| 1195 | init_MUTEX(&data->lock); | ||
| 1196 | new_client->adapter = adapter; | 1166 | new_client->adapter = adapter; |
| 1197 | new_client->driver = &w83792d_driver; | 1167 | new_client->driver = &w83792d_driver; |
| 1198 | new_client->flags = 0; | 1168 | new_client->flags = 0; |
| @@ -1243,7 +1213,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1243 | goto ERROR1; | 1213 | goto ERROR1; |
| 1244 | } | 1214 | } |
| 1245 | val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID); | 1215 | val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID); |
| 1246 | if (val1 == 0x7a && address >= 0x2c) { | 1216 | if (val1 == 0x7a) { |
| 1247 | kind = w83792d; | 1217 | kind = w83792d; |
| 1248 | } else { | 1218 | } else { |
| 1249 | if (kind == 0) | 1219 | if (kind == 0) |
| @@ -1416,26 +1386,17 @@ w83792d_detach_client(struct i2c_client *client) | |||
| 1416 | return 0; | 1386 | return 0; |
| 1417 | } | 1387 | } |
| 1418 | 1388 | ||
| 1419 | /* The SMBus locks itself, usually, but nothing may access the Winbond between | 1389 | /* The SMBus locks itself. The Winbond W83792D chip has a bank register, |
| 1420 | bank switches. ISA access must always be locked explicitly! | 1390 | but the driver only accesses registers in bank 0, so we don't have |
| 1421 | We ignore the W83792D BUSY flag at this moment - it could lead to deadlocks, | 1391 | to switch banks and lock access between switches. */ |
| 1422 | would slow down the W83792D access and should not be necessary. | 1392 | static int w83792d_read_value(struct i2c_client *client, u8 reg) |
| 1423 | There are some ugly typecasts here, but the good news is - they should | ||
| 1424 | nowhere else be necessary! */ | ||
| 1425 | static int | ||
| 1426 | w83792d_read_value(struct i2c_client *client, u8 reg) | ||
| 1427 | { | 1393 | { |
| 1428 | int res=0; | 1394 | return i2c_smbus_read_byte_data(client, reg); |
| 1429 | res = i2c_smbus_read_byte_data(client, reg); | ||
| 1430 | |||
| 1431 | return res; | ||
| 1432 | } | 1395 | } |
| 1433 | 1396 | ||
| 1434 | static int | 1397 | static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) |
| 1435 | w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) | ||
| 1436 | { | 1398 | { |
| 1437 | i2c_smbus_write_byte_data(client, reg, value); | 1399 | return i2c_smbus_write_byte_data(client, reg, value); |
| 1438 | return 0; | ||
| 1439 | } | 1400 | } |
| 1440 | 1401 | ||
| 1441 | static void | 1402 | static void |
| @@ -1492,10 +1453,10 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) | |||
| 1492 | data->in_min[i] = w83792d_read_value(client, | 1453 | data->in_min[i] = w83792d_read_value(client, |
| 1493 | W83792D_REG_IN_MIN[i]); | 1454 | W83792D_REG_IN_MIN[i]); |
| 1494 | } | 1455 | } |
| 1495 | data->low_bits[0] = w83792d_read_value(client, | 1456 | data->low_bits = w83792d_read_value(client, |
| 1496 | W83792D_REG_LOW_BITS1); | 1457 | W83792D_REG_LOW_BITS1) + |
| 1497 | data->low_bits[1] = w83792d_read_value(client, | 1458 | (w83792d_read_value(client, |
| 1498 | W83792D_REG_LOW_BITS2); | 1459 | W83792D_REG_LOW_BITS2) << 8); |
| 1499 | for (i = 0; i < 7; i++) { | 1460 | for (i = 0; i < 7; i++) { |
| 1500 | /* Update the Fan measured value and limits */ | 1461 | /* Update the Fan measured value and limits */ |
| 1501 | data->fan[i] = w83792d_read_value(client, | 1462 | data->fan[i] = w83792d_read_value(client, |
| @@ -1506,7 +1467,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) | |||
| 1506 | pwm_array_tmp[i] = w83792d_read_value(client, | 1467 | pwm_array_tmp[i] = w83792d_read_value(client, |
| 1507 | W83792D_REG_PWM[i]); | 1468 | W83792D_REG_PWM[i]); |
| 1508 | data->pwm[i] = pwm_array_tmp[i] & 0x0f; | 1469 | data->pwm[i] = pwm_array_tmp[i] & 0x0f; |
| 1509 | data->pwm_mode[i] = (pwm_array_tmp[i] >> 7) & 0x01; | 1470 | data->pwm_mode[i] = pwm_array_tmp[i] >> 7; |
| 1510 | } | 1471 | } |
| 1511 | 1472 | ||
| 1512 | reg_tmp = w83792d_read_value(client, W83792D_REG_FAN_CFG); | 1473 | reg_tmp = w83792d_read_value(client, W83792D_REG_FAN_CFG); |
| @@ -1607,8 +1568,8 @@ static void w83792d_print_debug(struct w83792d_data *data, struct device *dev) | |||
| 1607 | dev_dbg(dev, "vin[%d] max is: 0x%x\n", i, data->in_max[i]); | 1568 | dev_dbg(dev, "vin[%d] max is: 0x%x\n", i, data->in_max[i]); |
| 1608 | dev_dbg(dev, "vin[%d] min is: 0x%x\n", i, data->in_min[i]); | 1569 | dev_dbg(dev, "vin[%d] min is: 0x%x\n", i, data->in_min[i]); |
| 1609 | } | 1570 | } |
| 1610 | dev_dbg(dev, "Low Bit1 is: 0x%x\n", data->low_bits[0]); | 1571 | dev_dbg(dev, "Low Bit1 is: 0x%x\n", data->low_bits & 0xff); |
| 1611 | dev_dbg(dev, "Low Bit2 is: 0x%x\n", data->low_bits[1]); | 1572 | dev_dbg(dev, "Low Bit2 is: 0x%x\n", data->low_bits >> 8); |
| 1612 | dev_dbg(dev, "7 set of Fan Counts and Duty Cycles: =====>\n"); | 1573 | dev_dbg(dev, "7 set of Fan Counts and Duty Cycles: =====>\n"); |
| 1613 | for (i=0; i<7; i++) { | 1574 | for (i=0; i<7; i++) { |
| 1614 | dev_dbg(dev, "fan[%d] is: 0x%x\n", i, data->fan[i]); | 1575 | dev_dbg(dev, "fan[%d] is: 0x%x\n", i, data->fan[i]); |
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index f495b6378668..f66c0cfdeda7 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
| @@ -92,10 +92,10 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev); | |||
| 92 | */ | 92 | */ |
| 93 | 93 | ||
| 94 | static struct i2c_driver w83l785ts_driver = { | 94 | static struct i2c_driver w83l785ts_driver = { |
| 95 | .owner = THIS_MODULE, | 95 | .driver = { |
| 96 | .name = "w83l785ts", | 96 | .name = "w83l785ts", |
| 97 | }, | ||
| 97 | .id = I2C_DRIVERID_W83L785TS, | 98 | .id = I2C_DRIVERID_W83L785TS, |
| 98 | .flags = I2C_DF_NOTIFY, | ||
| 99 | .attach_adapter = w83l785ts_attach_adapter, | 99 | .attach_adapter = w83l785ts_attach_adapter, |
| 100 | .detach_client = w83l785ts_detach_client, | 100 | .detach_client = w83l785ts_detach_client, |
| 101 | }; | 101 | }; |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ac3eafa8aac0..1c752ddc10e2 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
| @@ -468,8 +468,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
| 468 | return -1; | 468 | return -1; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | if (hwpec) | 471 | outb_p(hwpec, SMBAUXCTL); /* enable/disable hardware PEC */ |
| 472 | outb_p(1, SMBAUXCTL); /* enable hardware PEC */ | ||
| 473 | 472 | ||
| 474 | if(block) | 473 | if(block) |
| 475 | ret = i801_block_transaction(data, read_write, size, hwpec); | 474 | ret = i801_block_transaction(data, read_write, size, hwpec); |
| @@ -478,9 +477,6 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
| 478 | ret = i801_transaction(); | 477 | ret = i801_transaction(); |
| 479 | } | 478 | } |
| 480 | 479 | ||
| 481 | if (hwpec) | ||
| 482 | outb_p(0, SMBAUXCTL); /* disable hardware PEC */ | ||
| 483 | |||
| 484 | if(block) | 480 | if(block) |
| 485 | return ret; | 481 | return ret; |
| 486 | if(ret) | 482 | if(ret) |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 1a587253d716..87fae937e666 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
| @@ -725,6 +725,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
| 725 | strcpy(adap->name, "IBM IIC"); | 725 | strcpy(adap->name, "IBM IIC"); |
| 726 | i2c_set_adapdata(adap, dev); | 726 | i2c_set_adapdata(adap, dev); |
| 727 | adap->id = I2C_HW_OCP; | 727 | adap->id = I2C_HW_OCP; |
| 728 | adap->class = I2C_CLASS_HWMON; | ||
| 728 | adap->algo = &iic_algo; | 729 | adap->algo = &iic_algo; |
| 729 | adap->client_register = NULL; | 730 | adap->client_register = NULL; |
| 730 | adap->client_unregister = NULL; | 731 | adap->client_unregister = NULL; |
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 03672c9ca409..9f2ffef4d812 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c | |||
| @@ -92,15 +92,13 @@ int i2c_isa_add_driver(struct i2c_driver *driver) | |||
| 92 | int res; | 92 | int res; |
| 93 | 93 | ||
| 94 | /* Add the driver to the list of i2c drivers in the driver core */ | 94 | /* Add the driver to the list of i2c drivers in the driver core */ |
| 95 | driver->driver.name = driver->name; | ||
| 96 | driver->driver.owner = driver->owner; | ||
| 97 | driver->driver.bus = &i2c_bus_type; | 95 | driver->driver.bus = &i2c_bus_type; |
| 98 | driver->driver.probe = i2c_isa_device_probe; | 96 | driver->driver.probe = i2c_isa_device_probe; |
| 99 | driver->driver.remove = i2c_isa_device_remove; | 97 | driver->driver.remove = i2c_isa_device_remove; |
| 100 | res = driver_register(&driver->driver); | 98 | res = driver_register(&driver->driver); |
| 101 | if (res) | 99 | if (res) |
| 102 | return res; | 100 | return res; |
| 103 | dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->name); | 101 | dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->driver.name); |
| 104 | 102 | ||
| 105 | /* Now look for clients */ | 103 | /* Now look for clients */ |
| 106 | driver->attach_adapter(&isa_adapter); | 104 | driver->attach_adapter(&isa_adapter); |
| @@ -124,14 +122,14 @@ int i2c_isa_del_driver(struct i2c_driver *driver) | |||
| 124 | if ((res = driver->detach_client(client))) { | 122 | if ((res = driver->detach_client(client))) { |
| 125 | dev_err(&isa_adapter.dev, "Failed, driver " | 123 | dev_err(&isa_adapter.dev, "Failed, driver " |
| 126 | "%s not unregistered!\n", | 124 | "%s not unregistered!\n", |
| 127 | driver->name); | 125 | driver->driver.name); |
| 128 | return res; | 126 | return res; |
| 129 | } | 127 | } |
| 130 | } | 128 | } |
| 131 | 129 | ||
| 132 | /* Get the driver off the core list */ | 130 | /* Get the driver off the core list */ |
| 133 | driver_unregister(&driver->driver); | 131 | driver_unregister(&driver->driver); |
| 134 | dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->name); | 132 | dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->driver.name); |
| 135 | 133 | ||
| 136 | return 0; | 134 | return 0; |
| 137 | } | 135 | } |
| @@ -176,7 +174,7 @@ static void __exit i2c_isa_exit(void) | |||
| 176 | list_for_each_safe(item, _n, &isa_adapter.clients) { | 174 | list_for_each_safe(item, _n, &isa_adapter.clients) { |
| 177 | client = list_entry(item, struct i2c_client, list); | 175 | client = list_entry(item, struct i2c_client, list); |
| 178 | dev_err(&isa_adapter.dev, "Driver %s still has an active " | 176 | dev_err(&isa_adapter.dev, "Driver %s still has an active " |
| 179 | "ISA client at 0x%x\n", client->driver->name, | 177 | "ISA client at 0x%x\n", client->driver->driver.name, |
| 180 | client->addr); | 178 | client->addr); |
| 181 | } | 179 | } |
| 182 | if (client != NULL) | 180 | if (client != NULL) |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 81031eb51056..22781d84f79f 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * drivers/i2c/busses/i2c-mv64xxx.c | ||
| 3 | * | ||
| 4 | * Driver for the i2c controller on the Marvell line of host bridges for MIPS | 2 | * Driver for the i2c controller on the Marvell line of host bridges for MIPS |
| 5 | * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0). | 3 | * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0). |
| 6 | * | 4 | * |
| @@ -65,7 +63,6 @@ enum { | |||
| 65 | MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK, | 63 | MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK, |
| 66 | MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK, | 64 | MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK, |
| 67 | MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA, | 65 | MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA, |
| 68 | MV64XXX_I2C_STATE_ABORTING, | ||
| 69 | }; | 66 | }; |
| 70 | 67 | ||
| 71 | /* Driver actions */ | 68 | /* Driver actions */ |
| @@ -85,6 +82,7 @@ struct mv64xxx_i2c_data { | |||
| 85 | int irq; | 82 | int irq; |
| 86 | u32 state; | 83 | u32 state; |
| 87 | u32 action; | 84 | u32 action; |
| 85 | u32 aborting; | ||
| 88 | u32 cntl_bits; | 86 | u32 cntl_bits; |
| 89 | void __iomem *reg_base; | 87 | void __iomem *reg_base; |
| 90 | u32 reg_base_p; | 88 | u32 reg_base_p; |
| @@ -122,12 +120,6 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | |||
| 122 | return; | 120 | return; |
| 123 | } | 121 | } |
| 124 | 122 | ||
| 125 | if (drv_data->state == MV64XXX_I2C_STATE_ABORTING) { | ||
| 126 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; | ||
| 127 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
| 128 | return; | ||
| 129 | } | ||
| 130 | |||
| 131 | /* The status from the ctlr [mostly] tells us what to do next */ | 123 | /* The status from the ctlr [mostly] tells us what to do next */ |
| 132 | switch (status) { | 124 | switch (status) { |
| 133 | /* Start condition interrupt */ | 125 | /* Start condition interrupt */ |
| @@ -148,14 +140,16 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | |||
| 148 | /* FALLTHRU */ | 140 | /* FALLTHRU */ |
| 149 | case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */ | 141 | case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */ |
| 150 | case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */ | 142 | case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */ |
| 151 | if (drv_data->bytes_left > 0) { | 143 | if ((drv_data->bytes_left == 0) |
| 144 | || (drv_data->aborting | ||
| 145 | && (drv_data->byte_posn != 0))) { | ||
| 146 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; | ||
| 147 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
| 148 | } else { | ||
| 152 | drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA; | 149 | drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA; |
| 153 | drv_data->state = | 150 | drv_data->state = |
| 154 | MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK; | 151 | MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK; |
| 155 | drv_data->bytes_left--; | 152 | drv_data->bytes_left--; |
| 156 | } else { | ||
| 157 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; | ||
| 158 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
| 159 | } | 153 | } |
| 160 | break; | 154 | break; |
| 161 | 155 | ||
| @@ -184,7 +178,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | |||
| 184 | } | 178 | } |
| 185 | drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA; | 179 | drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA; |
| 186 | 180 | ||
| 187 | if (drv_data->bytes_left == 1) | 181 | if ((drv_data->bytes_left == 1) || drv_data->aborting) |
| 188 | drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK; | 182 | drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK; |
| 189 | break; | 183 | break; |
| 190 | 184 | ||
| @@ -320,6 +314,7 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data, | |||
| 320 | drv_data->msg = msg; | 314 | drv_data->msg = msg; |
| 321 | drv_data->byte_posn = 0; | 315 | drv_data->byte_posn = 0; |
| 322 | drv_data->bytes_left = msg->len; | 316 | drv_data->bytes_left = msg->len; |
| 317 | drv_data->aborting = 0; | ||
| 323 | drv_data->rc = 0; | 318 | drv_data->rc = 0; |
| 324 | drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | | 319 | drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | |
| 325 | MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; | 320 | MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; |
| @@ -359,17 +354,19 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) | |||
| 359 | } | 354 | } |
| 360 | 355 | ||
| 361 | if (abort && drv_data->block) { | 356 | if (abort && drv_data->block) { |
| 362 | drv_data->state = MV64XXX_I2C_STATE_ABORTING; | 357 | drv_data->aborting = 1; |
| 363 | spin_unlock_irqrestore(&drv_data->lock, flags); | 358 | spin_unlock_irqrestore(&drv_data->lock, flags); |
| 364 | 359 | ||
| 365 | time_left = wait_event_timeout(drv_data->waitq, | 360 | time_left = wait_event_timeout(drv_data->waitq, |
| 366 | !drv_data->block, | 361 | !drv_data->block, |
| 367 | msecs_to_jiffies(drv_data->adapter.timeout)); | 362 | msecs_to_jiffies(drv_data->adapter.timeout)); |
| 368 | 363 | ||
| 369 | if (time_left <= 0) { | 364 | if ((time_left <= 0) && drv_data->block) { |
| 370 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | 365 | drv_data->state = MV64XXX_I2C_STATE_IDLE; |
| 371 | dev_err(&drv_data->adapter.dev, | 366 | dev_err(&drv_data->adapter.dev, |
| 372 | "mv64xxx: I2C bus locked\n"); | 367 | "mv64xxx: I2C bus locked, block: %d, " |
| 368 | "time_left: %d\n", drv_data->block, | ||
| 369 | (int)time_left); | ||
| 373 | } | 370 | } |
| 374 | } else | 371 | } else |
| 375 | spin_unlock_irqrestore(&drv_data->lock, flags); | 372 | spin_unlock_irqrestore(&drv_data->lock, flags); |
| @@ -510,7 +507,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) | |||
| 510 | goto exit_kfree; | 507 | goto exit_kfree; |
| 511 | } | 508 | } |
| 512 | 509 | ||
| 513 | strncpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", | 510 | strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", |
| 514 | I2C_NAME_SIZE); | 511 | I2C_NAME_SIZE); |
| 515 | 512 | ||
| 516 | init_waitqueue_head(&drv_data->waitq); | 513 | init_waitqueue_head(&drv_data->waitq); |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 4d18e6e5f159..2d80eb26f688 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | nForce3 Pro150 MCP 00D4 | 30 | nForce3 Pro150 MCP 00D4 |
| 31 | nForce3 250Gb MCP 00E4 | 31 | nForce3 250Gb MCP 00E4 |
| 32 | nForce4 MCP 0052 | 32 | nForce4 MCP 0052 |
| 33 | nForce4 MCP-04 0034 | ||
| 33 | 34 | ||
| 34 | This driver supports the 2 SMBuses that are included in the MCP of the | 35 | This driver supports the 2 SMBuses that are included in the MCP of the |
| 35 | nForce2/3/4 chipsets. | 36 | nForce2/3/4 chipsets. |
| @@ -257,6 +258,7 @@ static struct pci_device_id nforce2_ids[] = { | |||
| 257 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) }, | 258 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) }, |
| 258 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) }, | 259 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) }, |
| 259 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) }, | 260 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) }, |
| 261 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS) }, | ||
| 260 | { 0 } | 262 | { 0 } |
| 261 | }; | 263 | }; |
| 262 | 264 | ||
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index f63a53779281..d702e5e0388d 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h | |||
| @@ -80,6 +80,14 @@ static struct adapter_parm adapter_parm[] = { | |||
| 80 | .setscl = { 0x01, DATA, 1 }, | 80 | .setscl = { 0x01, DATA, 1 }, |
| 81 | .getsda = { 0x10, STAT, 1 }, | 81 | .getsda = { 0x10, STAT, 1 }, |
| 82 | }, | 82 | }, |
| 83 | /* type 6: Barco LPT->DVI (K5800236) adapter */ | ||
| 84 | { | ||
| 85 | .setsda = { 0x02, DATA, 1 }, | ||
| 86 | .setscl = { 0x01, DATA, 1 }, | ||
| 87 | .getsda = { 0x20, STAT, 0 }, | ||
| 88 | .getscl = { 0x40, STAT, 0 }, | ||
| 89 | .init = { 0xfc, DATA, 0 }, | ||
| 90 | }, | ||
| 83 | }; | 91 | }; |
| 84 | 92 | ||
| 85 | static int type; | 93 | static int type; |
| @@ -91,4 +99,6 @@ MODULE_PARM_DESC(type, | |||
| 91 | " 2 = Velleman K8000 adapter\n" | 99 | " 2 = Velleman K8000 adapter\n" |
| 92 | " 3 = ELV adapter\n" | 100 | " 3 = ELV adapter\n" |
| 93 | " 4 = ADM1032 evaluation board\n" | 101 | " 4 = ADM1032 evaluation board\n" |
| 94 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"); | 102 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" |
| 103 | " 6 = Barco LPT->DVI (K5800236) adapter\n" | ||
| 104 | ); | ||
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 02682fb794c8..93d483b8b770 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c | |||
| @@ -52,9 +52,9 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd, | |||
| 52 | * Driver data (common to all clients) | 52 | * Driver data (common to all clients) |
| 53 | */ | 53 | */ |
| 54 | static struct i2c_driver ds1337_driver = { | 54 | static struct i2c_driver ds1337_driver = { |
| 55 | .owner = THIS_MODULE, | 55 | .driver = { |
| 56 | .name = "ds1337", | 56 | .name = "ds1337", |
| 57 | .flags = I2C_DF_NOTIFY, | 57 | }, |
| 58 | .attach_adapter = ds1337_attach_adapter, | 58 | .attach_adapter = ds1337_attach_adapter, |
| 59 | .detach_client = ds1337_detach_client, | 59 | .detach_client = ds1337_detach_client, |
| 60 | .command = ds1337_command, | 60 | .command = ds1337_command, |
| @@ -337,13 +337,38 @@ exit: | |||
| 337 | 337 | ||
| 338 | static void ds1337_init_client(struct i2c_client *client) | 338 | static void ds1337_init_client(struct i2c_client *client) |
| 339 | { | 339 | { |
| 340 | s32 val; | 340 | u8 status, control; |
| 341 | 341 | ||
| 342 | /* Ensure that device is set in 24-hour mode */ | 342 | /* On some boards, the RTC isn't configured by boot firmware. |
| 343 | val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); | 343 | * Handle that case by starting/configuring the RTC now. |
| 344 | if ((val >= 0) && (val & (1 << 6))) | 344 | */ |
| 345 | i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, | 345 | status = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS); |
| 346 | val & 0x3f); | 346 | control = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL); |
| 347 | |||
| 348 | if ((status & 0x80) || (control & 0x80)) { | ||
| 349 | /* RTC not running */ | ||
| 350 | u8 buf[16]; | ||
| 351 | struct i2c_msg msg[1]; | ||
| 352 | |||
| 353 | dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); | ||
| 354 | |||
| 355 | /* Initialize all, including STATUS and CONTROL to zero */ | ||
| 356 | memset(buf, 0, sizeof(buf)); | ||
| 357 | msg[0].addr = client->addr; | ||
| 358 | msg[0].flags = 0; | ||
| 359 | msg[0].len = sizeof(buf); | ||
| 360 | msg[0].buf = &buf[0]; | ||
| 361 | |||
| 362 | i2c_transfer(client->adapter, msg, 1); | ||
| 363 | } else { | ||
| 364 | /* Running: ensure that device is set in 24-hour mode */ | ||
| 365 | s32 val; | ||
| 366 | |||
| 367 | val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); | ||
| 368 | if ((val >= 0) && (val & (1 << 6))) | ||
| 369 | i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, | ||
| 370 | val & 0x3f); | ||
| 371 | } | ||
| 347 | } | 372 | } |
| 348 | 373 | ||
| 349 | static int ds1337_detach_client(struct i2c_client *client) | 374 | static int ds1337_detach_client(struct i2c_client *client) |
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c index da488b735abf..0710b9da9d54 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c | |||
| @@ -232,10 +232,10 @@ static int ds1374_detach(struct i2c_client *client) | |||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | static struct i2c_driver ds1374_driver = { | 234 | static struct i2c_driver ds1374_driver = { |
| 235 | .owner = THIS_MODULE, | 235 | .driver = { |
| 236 | .name = DS1374_DRV_NAME, | 236 | .name = DS1374_DRV_NAME, |
| 237 | }, | ||
| 237 | .id = I2C_DRIVERID_DS1374, | 238 | .id = I2C_DRIVERID_DS1374, |
| 238 | .flags = I2C_DF_NOTIFY, | ||
| 239 | .attach_adapter = ds1374_attach, | 239 | .attach_adapter = ds1374_attach, |
| 240 | .detach_client = ds1374_detach, | 240 | .detach_client = ds1374_detach, |
| 241 | }; | 241 | }; |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 4baf573fa04f..41116b7947f6 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
| @@ -68,10 +68,10 @@ static int eeprom_detach_client(struct i2c_client *client); | |||
| 68 | 68 | ||
| 69 | /* This is the driver that will be inserted */ | 69 | /* This is the driver that will be inserted */ |
| 70 | static struct i2c_driver eeprom_driver = { | 70 | static struct i2c_driver eeprom_driver = { |
| 71 | .owner = THIS_MODULE, | 71 | .driver = { |
| 72 | .name = "eeprom", | 72 | .name = "eeprom", |
| 73 | }, | ||
| 73 | .id = I2C_DRIVERID_EEPROM, | 74 | .id = I2C_DRIVERID_EEPROM, |
| 74 | .flags = I2C_DF_NOTIFY, | ||
| 75 | .attach_adapter = eeprom_attach_adapter, | 75 | .attach_adapter = eeprom_attach_adapter, |
| 76 | .detach_client = eeprom_detach_client, | 76 | .detach_client = eeprom_detach_client, |
| 77 | }; | 77 | }; |
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index d2a100d77839..1251c7fc18d5 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c | |||
| @@ -1632,11 +1632,11 @@ static int isp1301_scan_bus(struct i2c_adapter *bus) | |||
| 1632 | } | 1632 | } |
| 1633 | 1633 | ||
| 1634 | static struct i2c_driver isp1301_driver = { | 1634 | static struct i2c_driver isp1301_driver = { |
| 1635 | .owner = THIS_MODULE, | 1635 | .driver = { |
| 1636 | .name = "isp1301_omap", | 1636 | .name = "isp1301_omap", |
| 1637 | }, | ||
| 1637 | .id = 1301, /* FIXME "official", i2c-ids.h */ | 1638 | .id = 1301, /* FIXME "official", i2c-ids.h */ |
| 1638 | .class = I2C_CLASS_HWMON, | 1639 | .class = I2C_CLASS_HWMON, |
| 1639 | .flags = I2C_DF_NOTIFY, | ||
| 1640 | .attach_adapter = isp1301_scan_bus, | 1640 | .attach_adapter = isp1301_scan_bus, |
| 1641 | .detach_client = isp1301_detach_client, | 1641 | .detach_client = isp1301_detach_client, |
| 1642 | }; | 1642 | }; |
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 3df309ae44a6..2dc3d48375fc 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c | |||
| @@ -211,10 +211,10 @@ m41t00_detach(struct i2c_client *client) | |||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static struct i2c_driver m41t00_driver = { | 213 | static struct i2c_driver m41t00_driver = { |
| 214 | .owner = THIS_MODULE, | 214 | .driver = { |
| 215 | .name = M41T00_DRV_NAME, | 215 | .name = M41T00_DRV_NAME, |
| 216 | }, | ||
| 216 | .id = I2C_DRIVERID_STM41T00, | 217 | .id = I2C_DRIVERID_STM41T00, |
| 217 | .flags = I2C_DF_NOTIFY, | ||
| 218 | .attach_adapter = m41t00_attach, | 218 | .attach_adapter = m41t00_attach, |
| 219 | .detach_client = m41t00_detach, | 219 | .detach_client = m41t00_detach, |
| 220 | }; | 220 | }; |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index b376a006883c..6d3ff584155e 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
| @@ -67,9 +67,9 @@ static int max6875_detach_client(struct i2c_client *client); | |||
| 67 | 67 | ||
| 68 | /* This is the driver that will be inserted */ | 68 | /* This is the driver that will be inserted */ |
| 69 | static struct i2c_driver max6875_driver = { | 69 | static struct i2c_driver max6875_driver = { |
| 70 | .owner = THIS_MODULE, | 70 | .driver = { |
| 71 | .name = "max6875", | 71 | .name = "max6875", |
| 72 | .flags = I2C_DF_NOTIFY, | 72 | }, |
| 73 | .attach_adapter = max6875_attach_adapter, | 73 | .attach_adapter = max6875_attach_adapter, |
| 74 | .detach_client = max6875_detach_client, | 74 | .detach_client = max6875_detach_client, |
| 75 | }; | 75 | }; |
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index 59a930346229..54b6e6a4beed 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c | |||
| @@ -38,9 +38,9 @@ static int pca9539_detach_client(struct i2c_client *client); | |||
| 38 | 38 | ||
| 39 | /* This is the driver that will be inserted */ | 39 | /* This is the driver that will be inserted */ |
| 40 | static struct i2c_driver pca9539_driver = { | 40 | static struct i2c_driver pca9539_driver = { |
| 41 | .owner = THIS_MODULE, | 41 | .driver = { |
| 42 | .name = "pca9539", | 42 | .name = "pca9539", |
| 43 | .flags = I2C_DF_NOTIFY, | 43 | }, |
| 44 | .attach_adapter = pca9539_attach_adapter, | 44 | .attach_adapter = pca9539_attach_adapter, |
| 45 | .detach_client = pca9539_detach_client, | 45 | .detach_client = pca9539_detach_client, |
| 46 | }; | 46 | }; |
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index c323c2de236c..c3e6449c4481 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c | |||
| @@ -65,10 +65,10 @@ static void pcf8574_init_client(struct i2c_client *client); | |||
| 65 | 65 | ||
| 66 | /* This is the driver that will be inserted */ | 66 | /* This is the driver that will be inserted */ |
| 67 | static struct i2c_driver pcf8574_driver = { | 67 | static struct i2c_driver pcf8574_driver = { |
| 68 | .owner = THIS_MODULE, | 68 | .driver = { |
| 69 | .name = "pcf8574", | 69 | .name = "pcf8574", |
| 70 | }, | ||
| 70 | .id = I2C_DRIVERID_PCF8574, | 71 | .id = I2C_DRIVERID_PCF8574, |
| 71 | .flags = I2C_DF_NOTIFY, | ||
| 72 | .attach_adapter = pcf8574_attach_adapter, | 72 | .attach_adapter = pcf8574_attach_adapter, |
| 73 | .detach_client = pcf8574_detach_client, | 73 | .detach_client = pcf8574_detach_client, |
| 74 | }; | 74 | }; |
diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index ce420a67560b..36cff09c678d 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c | |||
| @@ -88,10 +88,10 @@ static int pcf8591_read_channel(struct device *dev, int channel); | |||
| 88 | 88 | ||
| 89 | /* This is the driver that will be inserted */ | 89 | /* This is the driver that will be inserted */ |
| 90 | static struct i2c_driver pcf8591_driver = { | 90 | static struct i2c_driver pcf8591_driver = { |
| 91 | .owner = THIS_MODULE, | 91 | .driver = { |
| 92 | .name = "pcf8591", | 92 | .name = "pcf8591", |
| 93 | }, | ||
| 93 | .id = I2C_DRIVERID_PCF8591, | 94 | .id = I2C_DRIVERID_PCF8591, |
| 94 | .flags = I2C_DF_NOTIFY, | ||
| 95 | .attach_adapter = pcf8591_attach_adapter, | 95 | .attach_adapter = pcf8591_attach_adapter, |
| 96 | .detach_client = pcf8591_detach_client, | 96 | .detach_client = pcf8591_detach_client, |
| 97 | }; | 97 | }; |
diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c index 916cdc1af23c..ceaa6b0bdfd6 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/bcd.h> | ||
| 17 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
| 18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 19 | #include <linux/string.h> | 20 | #include <linux/string.h> |
| @@ -52,9 +53,6 @@ static inline u8 _rtc8564_ctrl2(struct i2c_client *client) | |||
| 52 | #define CTRL1(c) _rtc8564_ctrl1(c) | 53 | #define CTRL1(c) _rtc8564_ctrl1(c) |
| 53 | #define CTRL2(c) _rtc8564_ctrl2(c) | 54 | #define CTRL2(c) _rtc8564_ctrl2(c) |
| 54 | 55 | ||
| 55 | #define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10) | ||
| 56 | #define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10) | ||
| 57 | |||
| 58 | static int debug;; | 56 | static int debug;; |
| 59 | module_param(debug, int, S_IRUGO | S_IWUSR); | 57 | module_param(debug, int, S_IRUGO | S_IWUSR); |
| 60 | 58 | ||
| @@ -157,7 +155,6 @@ static int rtc8564_attach(struct i2c_adapter *adap, int addr, int kind) | |||
| 157 | 155 | ||
| 158 | strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); | 156 | strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); |
| 159 | i2c_set_clientdata(new_client, d); | 157 | i2c_set_clientdata(new_client, d); |
| 160 | new_client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 161 | new_client->addr = addr; | 158 | new_client->addr = addr; |
| 162 | new_client->adapter = adap; | 159 | new_client->adapter = adap; |
| 163 | new_client->driver = &rtc8564_driver; | 160 | new_client->driver = &rtc8564_driver; |
| @@ -224,16 +221,16 @@ static int rtc8564_get_datetime(struct i2c_client *client, struct rtc_tm *dt) | |||
| 224 | return ret; | 221 | return ret; |
| 225 | 222 | ||
| 226 | /* century stored in minute alarm reg */ | 223 | /* century stored in minute alarm reg */ |
| 227 | dt->year = BCD_TO_BIN(buf[RTC8564_REG_YEAR]); | 224 | dt->year = BCD2BIN(buf[RTC8564_REG_YEAR]); |
| 228 | dt->year += 100 * BCD_TO_BIN(buf[RTC8564_REG_AL_MIN] & 0x3f); | 225 | dt->year += 100 * BCD2BIN(buf[RTC8564_REG_AL_MIN] & 0x3f); |
| 229 | dt->mday = BCD_TO_BIN(buf[RTC8564_REG_DAY] & 0x3f); | 226 | dt->mday = BCD2BIN(buf[RTC8564_REG_DAY] & 0x3f); |
| 230 | dt->wday = BCD_TO_BIN(buf[RTC8564_REG_WDAY] & 7); | 227 | dt->wday = BCD2BIN(buf[RTC8564_REG_WDAY] & 7); |
| 231 | dt->mon = BCD_TO_BIN(buf[RTC8564_REG_MON_CENT] & 0x1f); | 228 | dt->mon = BCD2BIN(buf[RTC8564_REG_MON_CENT] & 0x1f); |
| 232 | 229 | ||
| 233 | dt->secs = BCD_TO_BIN(buf[RTC8564_REG_SEC] & 0x7f); | 230 | dt->secs = BCD2BIN(buf[RTC8564_REG_SEC] & 0x7f); |
| 234 | dt->vl = (buf[RTC8564_REG_SEC] & 0x80) == 0x80; | 231 | dt->vl = (buf[RTC8564_REG_SEC] & 0x80) == 0x80; |
| 235 | dt->mins = BCD_TO_BIN(buf[RTC8564_REG_MIN] & 0x7f); | 232 | dt->mins = BCD2BIN(buf[RTC8564_REG_MIN] & 0x7f); |
| 236 | dt->hours = BCD_TO_BIN(buf[RTC8564_REG_HR] & 0x3f); | 233 | dt->hours = BCD2BIN(buf[RTC8564_REG_HR] & 0x3f); |
| 237 | 234 | ||
| 238 | _DBGRTCTM(2, *dt); | 235 | _DBGRTCTM(2, *dt); |
| 239 | 236 | ||
| @@ -255,18 +252,18 @@ rtc8564_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) | |||
| 255 | 252 | ||
| 256 | buf[RTC8564_REG_CTRL1] = CTRL1(client) | RTC8564_CTRL1_STOP; | 253 | buf[RTC8564_REG_CTRL1] = CTRL1(client) | RTC8564_CTRL1_STOP; |
| 257 | buf[RTC8564_REG_CTRL2] = CTRL2(client); | 254 | buf[RTC8564_REG_CTRL2] = CTRL2(client); |
| 258 | buf[RTC8564_REG_SEC] = BIN_TO_BCD(dt->secs); | 255 | buf[RTC8564_REG_SEC] = BIN2BCD(dt->secs); |
| 259 | buf[RTC8564_REG_MIN] = BIN_TO_BCD(dt->mins); | 256 | buf[RTC8564_REG_MIN] = BIN2BCD(dt->mins); |
| 260 | buf[RTC8564_REG_HR] = BIN_TO_BCD(dt->hours); | 257 | buf[RTC8564_REG_HR] = BIN2BCD(dt->hours); |
| 261 | 258 | ||
| 262 | if (datetoo) { | 259 | if (datetoo) { |
| 263 | len += 5; | 260 | len += 5; |
| 264 | buf[RTC8564_REG_DAY] = BIN_TO_BCD(dt->mday); | 261 | buf[RTC8564_REG_DAY] = BIN2BCD(dt->mday); |
| 265 | buf[RTC8564_REG_WDAY] = BIN_TO_BCD(dt->wday); | 262 | buf[RTC8564_REG_WDAY] = BIN2BCD(dt->wday); |
| 266 | buf[RTC8564_REG_MON_CENT] = BIN_TO_BCD(dt->mon) & 0x1f; | 263 | buf[RTC8564_REG_MON_CENT] = BIN2BCD(dt->mon) & 0x1f; |
| 267 | /* century stored in minute alarm reg */ | 264 | /* century stored in minute alarm reg */ |
| 268 | buf[RTC8564_REG_YEAR] = BIN_TO_BCD(dt->year % 100); | 265 | buf[RTC8564_REG_YEAR] = BIN2BCD(dt->year % 100); |
| 269 | buf[RTC8564_REG_AL_MIN] = BIN_TO_BCD(dt->year / 100); | 266 | buf[RTC8564_REG_AL_MIN] = BIN2BCD(dt->year / 100); |
| 270 | } | 267 | } |
| 271 | 268 | ||
| 272 | ret = rtc8564_write(client, 0, buf, len); | 269 | ret = rtc8564_write(client, 0, buf, len); |
| @@ -361,10 +358,10 @@ rtc8564_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 361 | } | 358 | } |
| 362 | 359 | ||
| 363 | static struct i2c_driver rtc8564_driver = { | 360 | static struct i2c_driver rtc8564_driver = { |
| 364 | .owner = THIS_MODULE, | 361 | .driver = { |
| 365 | .name = "RTC8564", | 362 | .name = "RTC8564", |
| 363 | }, | ||
| 366 | .id = I2C_DRIVERID_RTC8564, | 364 | .id = I2C_DRIVERID_RTC8564, |
| 367 | .flags = I2C_DF_NOTIFY, | ||
| 368 | .attach_adapter = rtc8564_probe, | 365 | .attach_adapter = rtc8564_probe, |
| 369 | .detach_client = rtc8564_detach, | 366 | .detach_client = rtc8564_detach, |
| 370 | .command = rtc8564_command | 367 | .command = rtc8564_command |
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 280dd7a45db6..e70b3db69edd 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
| @@ -637,9 +637,9 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus) | |||
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | static struct i2c_driver tps65010_driver = { | 639 | static struct i2c_driver tps65010_driver = { |
| 640 | .owner = THIS_MODULE, | 640 | .driver = { |
| 641 | .name = "tps65010", | 641 | .name = "tps65010", |
| 642 | .flags = I2C_DF_NOTIFY, | 642 | }, |
| 643 | .attach_adapter = tps65010_scan_bus, | 643 | .attach_adapter = tps65010_scan_bus, |
| 644 | .detach_client = __exit_p(tps65010_detach_client), | 644 | .detach_client = __exit_p(tps65010_detach_client), |
| 645 | }; | 645 | }; |
diff --git a/drivers/i2c/chips/x1205.c b/drivers/i2c/chips/x1205.c index 7da366cdc18c..245fffa92dbd 100644 --- a/drivers/i2c/chips/x1205.c +++ b/drivers/i2c/chips/x1205.c | |||
| @@ -105,9 +105,9 @@ static int x1205_command(struct i2c_client *client, unsigned int cmd, | |||
| 105 | void *arg); | 105 | void *arg); |
| 106 | 106 | ||
| 107 | static struct i2c_driver x1205_driver = { | 107 | static struct i2c_driver x1205_driver = { |
| 108 | .owner = THIS_MODULE, | 108 | .driver = { |
| 109 | .name = "x1205", | 109 | .name = "x1205", |
| 110 | .flags = I2C_DF_NOTIFY, | 110 | }, |
| 111 | .attach_adapter = &x1205_attach, | 111 | .attach_adapter = &x1205_attach, |
| 112 | .detach_client = &x1205_detach, | 112 | .detach_client = &x1205_detach, |
| 113 | }; | 113 | }; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 82ea1b7ec914..52b77477df57 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -197,7 +197,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) | |||
| 197 | /* inform drivers of new adapters */ | 197 | /* inform drivers of new adapters */ |
| 198 | list_for_each(item,&drivers) { | 198 | list_for_each(item,&drivers) { |
| 199 | driver = list_entry(item, struct i2c_driver, list); | 199 | driver = list_entry(item, struct i2c_driver, list); |
| 200 | if (driver->flags & I2C_DF_NOTIFY) | 200 | if (driver->attach_adapter) |
| 201 | /* We ignore the return code; if it fails, too bad */ | 201 | /* We ignore the return code; if it fails, too bad */ |
| 202 | driver->attach_adapter(adap); | 202 | driver->attach_adapter(adap); |
| 203 | } | 203 | } |
| @@ -235,7 +235,8 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 235 | if (driver->detach_adapter) | 235 | if (driver->detach_adapter) |
| 236 | if ((res = driver->detach_adapter(adap))) { | 236 | if ((res = driver->detach_adapter(adap))) { |
| 237 | dev_err(&adap->dev, "detach_adapter failed " | 237 | dev_err(&adap->dev, "detach_adapter failed " |
| 238 | "for driver [%s]\n", driver->name); | 238 | "for driver [%s]\n", |
| 239 | driver->driver.name); | ||
| 239 | goto out_unlock; | 240 | goto out_unlock; |
| 240 | } | 241 | } |
| 241 | } | 242 | } |
| @@ -245,10 +246,6 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 245 | list_for_each_safe(item, _n, &adap->clients) { | 246 | list_for_each_safe(item, _n, &adap->clients) { |
| 246 | client = list_entry(item, struct i2c_client, list); | 247 | client = list_entry(item, struct i2c_client, list); |
| 247 | 248 | ||
| 248 | /* detaching devices is unconditional of the set notify | ||
| 249 | * flag, as _all_ clients that reside on the adapter | ||
| 250 | * must be deleted, as this would cause invalid states. | ||
| 251 | */ | ||
| 252 | if ((res=client->driver->detach_client(client))) { | 249 | if ((res=client->driver->detach_client(client))) { |
| 253 | dev_err(&adap->dev, "detach_client failed for client " | 250 | dev_err(&adap->dev, "detach_client failed for client " |
| 254 | "[%s] at address 0x%02x\n", client->name, | 251 | "[%s] at address 0x%02x\n", client->name, |
| @@ -286,7 +283,7 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 286 | * chips. | 283 | * chips. |
| 287 | */ | 284 | */ |
| 288 | 285 | ||
| 289 | int i2c_add_driver(struct i2c_driver *driver) | 286 | int i2c_register_driver(struct module *owner, struct i2c_driver *driver) |
| 290 | { | 287 | { |
| 291 | struct list_head *item; | 288 | struct list_head *item; |
| 292 | struct i2c_adapter *adapter; | 289 | struct i2c_adapter *adapter; |
| @@ -295,8 +292,7 @@ int i2c_add_driver(struct i2c_driver *driver) | |||
| 295 | down(&core_lists); | 292 | down(&core_lists); |
| 296 | 293 | ||
| 297 | /* add the driver to the list of i2c drivers in the driver core */ | 294 | /* add the driver to the list of i2c drivers in the driver core */ |
| 298 | driver->driver.owner = driver->owner; | 295 | driver->driver.owner = owner; |
| 299 | driver->driver.name = driver->name; | ||
| 300 | driver->driver.bus = &i2c_bus_type; | 296 | driver->driver.bus = &i2c_bus_type; |
| 301 | driver->driver.probe = i2c_device_probe; | 297 | driver->driver.probe = i2c_device_probe; |
| 302 | driver->driver.remove = i2c_device_remove; | 298 | driver->driver.remove = i2c_device_remove; |
| @@ -306,10 +302,10 @@ int i2c_add_driver(struct i2c_driver *driver) | |||
| 306 | goto out_unlock; | 302 | goto out_unlock; |
| 307 | 303 | ||
| 308 | list_add_tail(&driver->list,&drivers); | 304 | list_add_tail(&driver->list,&drivers); |
| 309 | pr_debug("i2c-core: driver [%s] registered\n", driver->name); | 305 | pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); |
| 310 | 306 | ||
| 311 | /* now look for instances of driver on our adapters */ | 307 | /* now look for instances of driver on our adapters */ |
| 312 | if (driver->flags & I2C_DF_NOTIFY) { | 308 | if (driver->attach_adapter) { |
| 313 | list_for_each(item,&adapters) { | 309 | list_for_each(item,&adapters) { |
| 314 | adapter = list_entry(item, struct i2c_adapter, list); | 310 | adapter = list_entry(item, struct i2c_adapter, list); |
| 315 | driver->attach_adapter(adapter); | 311 | driver->attach_adapter(adapter); |
| @@ -320,6 +316,7 @@ int i2c_add_driver(struct i2c_driver *driver) | |||
| 320 | up(&core_lists); | 316 | up(&core_lists); |
| 321 | return res; | 317 | return res; |
| 322 | } | 318 | } |
| 319 | EXPORT_SYMBOL(i2c_register_driver); | ||
| 323 | 320 | ||
| 324 | int i2c_del_driver(struct i2c_driver *driver) | 321 | int i2c_del_driver(struct i2c_driver *driver) |
| 325 | { | 322 | { |
| @@ -334,17 +331,14 @@ int i2c_del_driver(struct i2c_driver *driver) | |||
| 334 | /* Have a look at each adapter, if clients of this driver are still | 331 | /* Have a look at each adapter, if clients of this driver are still |
| 335 | * attached. If so, detach them to be able to kill the driver | 332 | * attached. If so, detach them to be able to kill the driver |
| 336 | * afterwards. | 333 | * afterwards. |
| 337 | * | ||
| 338 | * Removing clients does not depend on the notify flag, else | ||
| 339 | * invalid operation might (will!) result, when using stale client | ||
| 340 | * pointers. | ||
| 341 | */ | 334 | */ |
| 342 | list_for_each(item1,&adapters) { | 335 | list_for_each(item1,&adapters) { |
| 343 | adap = list_entry(item1, struct i2c_adapter, list); | 336 | adap = list_entry(item1, struct i2c_adapter, list); |
| 344 | if (driver->detach_adapter) { | 337 | if (driver->detach_adapter) { |
| 345 | if ((res = driver->detach_adapter(adap))) { | 338 | if ((res = driver->detach_adapter(adap))) { |
| 346 | dev_err(&adap->dev, "detach_adapter failed " | 339 | dev_err(&adap->dev, "detach_adapter failed " |
| 347 | "for driver [%s]\n", driver->name); | 340 | "for driver [%s]\n", |
| 341 | driver->driver.name); | ||
| 348 | goto out_unlock; | 342 | goto out_unlock; |
| 349 | } | 343 | } |
| 350 | } else { | 344 | } else { |
| @@ -368,7 +362,7 @@ int i2c_del_driver(struct i2c_driver *driver) | |||
| 368 | 362 | ||
| 369 | driver_unregister(&driver->driver); | 363 | driver_unregister(&driver->driver); |
| 370 | list_del(&driver->list); | 364 | list_del(&driver->list); |
| 371 | pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); | 365 | pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); |
| 372 | 366 | ||
| 373 | out_unlock: | 367 | out_unlock: |
| 374 | up(&core_lists); | 368 | up(&core_lists); |
| @@ -419,8 +413,7 @@ int i2c_attach_client(struct i2c_client *client) | |||
| 419 | } | 413 | } |
| 420 | } | 414 | } |
| 421 | 415 | ||
| 422 | if (client->flags & I2C_CLIENT_ALLOW_USE) | 416 | client->usage_count = 0; |
| 423 | client->usage_count = 0; | ||
| 424 | 417 | ||
| 425 | client->dev.parent = &client->adapter->dev; | 418 | client->dev.parent = &client->adapter->dev; |
| 426 | client->dev.driver = &client->driver->driver; | 419 | client->dev.driver = &client->driver->driver; |
| @@ -443,8 +436,7 @@ int i2c_detach_client(struct i2c_client *client) | |||
| 443 | struct i2c_adapter *adapter = client->adapter; | 436 | struct i2c_adapter *adapter = client->adapter; |
| 444 | int res = 0; | 437 | int res = 0; |
| 445 | 438 | ||
| 446 | if ((client->flags & I2C_CLIENT_ALLOW_USE) | 439 | if (client->usage_count > 0) { |
| 447 | && (client->usage_count > 0)) { | ||
| 448 | dev_warn(&client->dev, "Client [%s] still busy, " | 440 | dev_warn(&client->dev, "Client [%s] still busy, " |
| 449 | "can't detach\n", client->name); | 441 | "can't detach\n", client->name); |
| 450 | return -EBUSY; | 442 | return -EBUSY; |
| @@ -475,10 +467,10 @@ int i2c_detach_client(struct i2c_client *client) | |||
| 475 | static int i2c_inc_use_client(struct i2c_client *client) | 467 | static int i2c_inc_use_client(struct i2c_client *client) |
| 476 | { | 468 | { |
| 477 | 469 | ||
| 478 | if (!try_module_get(client->driver->owner)) | 470 | if (!try_module_get(client->driver->driver.owner)) |
| 479 | return -ENODEV; | 471 | return -ENODEV; |
| 480 | if (!try_module_get(client->adapter->owner)) { | 472 | if (!try_module_get(client->adapter->owner)) { |
| 481 | module_put(client->driver->owner); | 473 | module_put(client->driver->driver.owner); |
| 482 | return -ENODEV; | 474 | return -ENODEV; |
| 483 | } | 475 | } |
| 484 | 476 | ||
| @@ -487,7 +479,7 @@ static int i2c_inc_use_client(struct i2c_client *client) | |||
| 487 | 479 | ||
| 488 | static void i2c_dec_use_client(struct i2c_client *client) | 480 | static void i2c_dec_use_client(struct i2c_client *client) |
| 489 | { | 481 | { |
| 490 | module_put(client->driver->owner); | 482 | module_put(client->driver->driver.owner); |
| 491 | module_put(client->adapter->owner); | 483 | module_put(client->adapter->owner); |
| 492 | } | 484 | } |
| 493 | 485 | ||
| @@ -499,33 +491,20 @@ int i2c_use_client(struct i2c_client *client) | |||
| 499 | if (ret) | 491 | if (ret) |
| 500 | return ret; | 492 | return ret; |
| 501 | 493 | ||
| 502 | if (client->flags & I2C_CLIENT_ALLOW_USE) { | 494 | client->usage_count++; |
| 503 | if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) | ||
| 504 | client->usage_count++; | ||
| 505 | else if (client->usage_count > 0) | ||
| 506 | goto busy; | ||
| 507 | else | ||
| 508 | client->usage_count++; | ||
| 509 | } | ||
| 510 | 495 | ||
| 511 | return 0; | 496 | return 0; |
| 512 | busy: | ||
| 513 | i2c_dec_use_client(client); | ||
| 514 | return -EBUSY; | ||
| 515 | } | 497 | } |
| 516 | 498 | ||
| 517 | int i2c_release_client(struct i2c_client *client) | 499 | int i2c_release_client(struct i2c_client *client) |
| 518 | { | 500 | { |
| 519 | if(client->flags & I2C_CLIENT_ALLOW_USE) { | 501 | if (!client->usage_count) { |
| 520 | if(client->usage_count>0) | 502 | pr_debug("i2c-core: %s used one too many times\n", |
| 521 | client->usage_count--; | 503 | __FUNCTION__); |
| 522 | else { | 504 | return -EPERM; |
| 523 | pr_debug("i2c-core: %s used one too many times\n", | ||
| 524 | __FUNCTION__); | ||
| 525 | return -EPERM; | ||
| 526 | } | ||
| 527 | } | 505 | } |
| 528 | 506 | ||
| 507 | client->usage_count--; | ||
| 529 | i2c_dec_use_client(client); | 508 | i2c_dec_use_client(client); |
| 530 | 509 | ||
| 531 | return 0; | 510 | return 0; |
| @@ -539,14 +518,14 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) | |||
| 539 | down(&adap->clist_lock); | 518 | down(&adap->clist_lock); |
| 540 | list_for_each(item,&adap->clients) { | 519 | list_for_each(item,&adap->clients) { |
| 541 | client = list_entry(item, struct i2c_client, list); | 520 | client = list_entry(item, struct i2c_client, list); |
| 542 | if (!try_module_get(client->driver->owner)) | 521 | if (!try_module_get(client->driver->driver.owner)) |
| 543 | continue; | 522 | continue; |
| 544 | if (NULL != client->driver->command) { | 523 | if (NULL != client->driver->command) { |
| 545 | up(&adap->clist_lock); | 524 | up(&adap->clist_lock); |
| 546 | client->driver->command(client,cmd,arg); | 525 | client->driver->command(client,cmd,arg); |
| 547 | down(&adap->clist_lock); | 526 | down(&adap->clist_lock); |
| 548 | } | 527 | } |
| 549 | module_put(client->driver->owner); | 528 | module_put(client->driver->driver.owner); |
| 550 | } | 529 | } |
| 551 | up(&adap->clist_lock); | 530 | up(&adap->clist_lock); |
| 552 | } | 531 | } |
| @@ -1147,7 +1126,6 @@ EXPORT_SYMBOL_GPL(i2c_bus_type); | |||
| 1147 | 1126 | ||
| 1148 | EXPORT_SYMBOL(i2c_add_adapter); | 1127 | EXPORT_SYMBOL(i2c_add_adapter); |
| 1149 | EXPORT_SYMBOL(i2c_del_adapter); | 1128 | EXPORT_SYMBOL(i2c_del_adapter); |
| 1150 | EXPORT_SYMBOL(i2c_add_driver); | ||
| 1151 | EXPORT_SYMBOL(i2c_del_driver); | 1129 | EXPORT_SYMBOL(i2c_del_driver); |
| 1152 | EXPORT_SYMBOL(i2c_attach_client); | 1130 | EXPORT_SYMBOL(i2c_attach_client); |
| 1153 | EXPORT_SYMBOL(i2c_detach_client); | 1131 | EXPORT_SYMBOL(i2c_detach_client); |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 8af0bd1424d2..ed7eed388bae 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
| @@ -42,8 +42,7 @@ static struct i2c_client i2cdev_client_template; | |||
| 42 | struct i2c_dev { | 42 | struct i2c_dev { |
| 43 | int minor; | 43 | int minor; |
| 44 | struct i2c_adapter *adap; | 44 | struct i2c_adapter *adap; |
| 45 | struct class_device class_dev; | 45 | struct class_device *class_dev; |
| 46 | struct completion released; /* FIXME, we need a class_device_unregister() */ | ||
| 47 | }; | 46 | }; |
| 48 | #define to_i2c_dev(d) container_of(d, struct i2c_dev, class_dev) | 47 | #define to_i2c_dev(d) container_of(d, struct i2c_dev, class_dev) |
| 49 | 48 | ||
| @@ -105,7 +104,10 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev) | |||
| 105 | 104 | ||
| 106 | static ssize_t show_adapter_name(struct class_device *class_dev, char *buf) | 105 | static ssize_t show_adapter_name(struct class_device *class_dev, char *buf) |
| 107 | { | 106 | { |
| 108 | struct i2c_dev *i2c_dev = to_i2c_dev(class_dev); | 107 | struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(class_dev->devt)); |
| 108 | |||
| 109 | if (!i2c_dev) | ||
| 110 | return -ENODEV; | ||
| 109 | return sprintf(buf, "%s\n", i2c_dev->adap->name); | 111 | return sprintf(buf, "%s\n", i2c_dev->adap->name); |
| 110 | } | 112 | } |
| 111 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); | 113 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); |
| @@ -408,21 +410,12 @@ static struct file_operations i2cdev_fops = { | |||
| 408 | .release = i2cdev_release, | 410 | .release = i2cdev_release, |
| 409 | }; | 411 | }; |
| 410 | 412 | ||
| 411 | static void release_i2c_dev(struct class_device *dev) | 413 | static struct class *i2c_dev_class; |
| 412 | { | ||
| 413 | struct i2c_dev *i2c_dev = to_i2c_dev(dev); | ||
| 414 | complete(&i2c_dev->released); | ||
| 415 | } | ||
| 416 | |||
| 417 | static struct class i2c_dev_class = { | ||
| 418 | .name = "i2c-dev", | ||
| 419 | .release = &release_i2c_dev, | ||
| 420 | }; | ||
| 421 | 414 | ||
| 422 | static int i2cdev_attach_adapter(struct i2c_adapter *adap) | 415 | static int i2cdev_attach_adapter(struct i2c_adapter *adap) |
| 423 | { | 416 | { |
| 424 | struct i2c_dev *i2c_dev; | 417 | struct i2c_dev *i2c_dev; |
| 425 | int retval; | 418 | struct device *dev; |
| 426 | 419 | ||
| 427 | i2c_dev = get_free_i2c_dev(adap); | 420 | i2c_dev = get_free_i2c_dev(adap); |
| 428 | if (IS_ERR(i2c_dev)) | 421 | if (IS_ERR(i2c_dev)) |
| @@ -434,21 +427,20 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) | |||
| 434 | /* register this i2c device with the driver core */ | 427 | /* register this i2c device with the driver core */ |
| 435 | i2c_dev->adap = adap; | 428 | i2c_dev->adap = adap; |
| 436 | if (adap->dev.parent == &platform_bus) | 429 | if (adap->dev.parent == &platform_bus) |
| 437 | i2c_dev->class_dev.dev = &adap->dev; | 430 | dev = &adap->dev; |
| 438 | else | 431 | else |
| 439 | i2c_dev->class_dev.dev = adap->dev.parent; | 432 | dev = adap->dev.parent; |
| 440 | i2c_dev->class_dev.class = &i2c_dev_class; | 433 | i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL, |
| 441 | i2c_dev->class_dev.devt = MKDEV(I2C_MAJOR, i2c_dev->minor); | 434 | MKDEV(I2C_MAJOR, i2c_dev->minor), |
| 442 | snprintf(i2c_dev->class_dev.class_id, BUS_ID_SIZE, "i2c-%d", i2c_dev->minor); | 435 | dev, "i2c-%d", i2c_dev->minor); |
| 443 | retval = class_device_register(&i2c_dev->class_dev); | 436 | if (!i2c_dev->class_dev) |
| 444 | if (retval) | ||
| 445 | goto error; | 437 | goto error; |
| 446 | class_device_create_file(&i2c_dev->class_dev, &class_device_attr_name); | 438 | class_device_create_file(i2c_dev->class_dev, &class_device_attr_name); |
| 447 | return 0; | 439 | return 0; |
| 448 | error: | 440 | error: |
| 449 | return_i2c_dev(i2c_dev); | 441 | return_i2c_dev(i2c_dev); |
| 450 | kfree(i2c_dev); | 442 | kfree(i2c_dev); |
| 451 | return retval; | 443 | return -ENODEV; |
| 452 | } | 444 | } |
| 453 | 445 | ||
| 454 | static int i2cdev_detach_adapter(struct i2c_adapter *adap) | 446 | static int i2cdev_detach_adapter(struct i2c_adapter *adap) |
| @@ -459,10 +451,8 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap) | |||
| 459 | if (!i2c_dev) | 451 | if (!i2c_dev) |
| 460 | return -ENODEV; | 452 | return -ENODEV; |
| 461 | 453 | ||
| 462 | init_completion(&i2c_dev->released); | ||
| 463 | return_i2c_dev(i2c_dev); | 454 | return_i2c_dev(i2c_dev); |
| 464 | class_device_unregister(&i2c_dev->class_dev); | 455 | class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, i2c_dev->minor)); |
| 465 | wait_for_completion(&i2c_dev->released); | ||
| 466 | kfree(i2c_dev); | 456 | kfree(i2c_dev); |
| 467 | 457 | ||
| 468 | pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); | 458 | pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); |
| @@ -474,21 +464,14 @@ static int i2cdev_detach_client(struct i2c_client *client) | |||
| 474 | return 0; | 464 | return 0; |
| 475 | } | 465 | } |
| 476 | 466 | ||
| 477 | static int i2cdev_command(struct i2c_client *client, unsigned int cmd, | ||
| 478 | void *arg) | ||
| 479 | { | ||
| 480 | return -1; | ||
| 481 | } | ||
| 482 | |||
| 483 | static struct i2c_driver i2cdev_driver = { | 467 | static struct i2c_driver i2cdev_driver = { |
| 484 | .owner = THIS_MODULE, | 468 | .driver = { |
| 485 | .name = "dev_driver", | 469 | .name = "dev_driver", |
| 470 | }, | ||
| 486 | .id = I2C_DRIVERID_I2CDEV, | 471 | .id = I2C_DRIVERID_I2CDEV, |
| 487 | .flags = I2C_DF_NOTIFY, | ||
| 488 | .attach_adapter = i2cdev_attach_adapter, | 472 | .attach_adapter = i2cdev_attach_adapter, |
| 489 | .detach_adapter = i2cdev_detach_adapter, | 473 | .detach_adapter = i2cdev_detach_adapter, |
| 490 | .detach_client = i2cdev_detach_client, | 474 | .detach_client = i2cdev_detach_client, |
| 491 | .command = i2cdev_command, | ||
| 492 | }; | 475 | }; |
| 493 | 476 | ||
| 494 | static struct i2c_client i2cdev_client_template = { | 477 | static struct i2c_client i2cdev_client_template = { |
| @@ -507,8 +490,8 @@ static int __init i2c_dev_init(void) | |||
| 507 | if (res) | 490 | if (res) |
| 508 | goto out; | 491 | goto out; |
| 509 | 492 | ||
| 510 | res = class_register(&i2c_dev_class); | 493 | i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); |
| 511 | if (res) | 494 | if (IS_ERR(i2c_dev_class)) |
| 512 | goto out_unreg_chrdev; | 495 | goto out_unreg_chrdev; |
| 513 | 496 | ||
| 514 | res = i2c_add_driver(&i2cdev_driver); | 497 | res = i2c_add_driver(&i2cdev_driver); |
| @@ -518,7 +501,7 @@ static int __init i2c_dev_init(void) | |||
| 518 | return 0; | 501 | return 0; |
| 519 | 502 | ||
| 520 | out_unreg_class: | 503 | out_unreg_class: |
| 521 | class_unregister(&i2c_dev_class); | 504 | class_destroy(i2c_dev_class); |
| 522 | out_unreg_chrdev: | 505 | out_unreg_chrdev: |
| 523 | unregister_chrdev(I2C_MAJOR, "i2c"); | 506 | unregister_chrdev(I2C_MAJOR, "i2c"); |
| 524 | out: | 507 | out: |
| @@ -529,7 +512,7 @@ out: | |||
| 529 | static void __exit i2c_dev_exit(void) | 512 | static void __exit i2c_dev_exit(void) |
| 530 | { | 513 | { |
| 531 | i2c_del_driver(&i2cdev_driver); | 514 | i2c_del_driver(&i2cdev_driver); |
| 532 | class_unregister(&i2c_dev_class); | 515 | class_destroy(i2c_dev_class); |
| 533 | unregister_chrdev(I2C_MAJOR,"i2c"); | 516 | unregister_chrdev(I2C_MAJOR,"i2c"); |
| 534 | } | 517 | } |
| 535 | 518 | ||
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 5e1f5e9653cb..5ebfd1d138da 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
| @@ -176,9 +176,9 @@ detach_thermostat(struct i2c_adapter *adapter) | |||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | static struct i2c_driver thermostat_driver = { | 178 | static struct i2c_driver thermostat_driver = { |
| 179 | .owner = THIS_MODULE, | 179 | .driver = { |
| 180 | .name = "therm_adt746x", | 180 | .name = "therm_adt746x", |
| 181 | .flags = I2C_DF_NOTIFY, | 181 | }, |
| 182 | .attach_adapter = attach_thermostat, | 182 | .attach_adapter = attach_thermostat, |
| 183 | .detach_adapter = detach_thermostat, | 183 | .detach_adapter = detach_thermostat, |
| 184 | }; | 184 | }; |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 435427daed75..8d0958c38b6b 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
| @@ -283,9 +283,9 @@ static int therm_pm72_detach(struct i2c_adapter *adapter); | |||
| 283 | 283 | ||
| 284 | static struct i2c_driver therm_pm72_driver = | 284 | static struct i2c_driver therm_pm72_driver = |
| 285 | { | 285 | { |
| 286 | .owner = THIS_MODULE, | 286 | .driver = { |
| 287 | .name = "therm_pm72", | 287 | .name = "therm_pm72", |
| 288 | .flags = I2C_DF_NOTIFY, | 288 | }, |
| 289 | .attach_adapter = therm_pm72_attach, | 289 | .attach_adapter = therm_pm72_attach, |
| 290 | .detach_adapter = therm_pm72_detach, | 290 | .detach_adapter = therm_pm72_detach, |
| 291 | }; | 291 | }; |
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 6aaa1df1a64e..3d9dd2e166aa 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
| @@ -354,10 +354,10 @@ do_detach( struct i2c_client *client ) | |||
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | static struct i2c_driver g4fan_driver = { | 356 | static struct i2c_driver g4fan_driver = { |
| 357 | .owner = THIS_MODULE, | 357 | .driver = { |
| 358 | .name = "therm_windtunnel", | 358 | .name = "therm_windtunnel", |
| 359 | }, | ||
| 359 | .id = I2C_DRIVERID_G4FAN, | 360 | .id = I2C_DRIVERID_G4FAN, |
| 360 | .flags = I2C_DF_NOTIFY, | ||
| 361 | .attach_adapter = do_attach, | 361 | .attach_adapter = do_attach, |
| 362 | .detach_client = do_detach, | 362 | .detach_client = do_detach, |
| 363 | }; | 363 | }; |
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c index c62ed68a3138..57460e46c89f 100644 --- a/drivers/macintosh/windfarm_lm75_sensor.c +++ b/drivers/macintosh/windfarm_lm75_sensor.c | |||
| @@ -47,9 +47,9 @@ static int wf_lm75_attach(struct i2c_adapter *adapter); | |||
| 47 | static int wf_lm75_detach(struct i2c_client *client); | 47 | static int wf_lm75_detach(struct i2c_client *client); |
| 48 | 48 | ||
| 49 | static struct i2c_driver wf_lm75_driver = { | 49 | static struct i2c_driver wf_lm75_driver = { |
| 50 | .owner = THIS_MODULE, | 50 | .driver = { |
| 51 | .name = "wf_lm75", | 51 | .name = "wf_lm75", |
| 52 | .flags = I2C_DF_NOTIFY, | 52 | }, |
| 53 | .attach_adapter = wf_lm75_attach, | 53 | .attach_adapter = wf_lm75_attach, |
| 54 | .detach_client = wf_lm75_detach, | 54 | .detach_client = wf_lm75_detach, |
| 55 | }; | 55 | }; |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 1ca2b67aedfb..e61003de1d5f 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
| @@ -420,7 +420,6 @@ adv7170_detect_client (struct i2c_adapter *adapter, | |||
| 420 | client->addr = address; | 420 | client->addr = address; |
| 421 | client->adapter = adapter; | 421 | client->adapter = adapter; |
| 422 | client->driver = &i2c_driver_adv7170; | 422 | client->driver = &i2c_driver_adv7170; |
| 423 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 424 | if ((client->addr == I2C_ADV7170 >> 1) || | 423 | if ((client->addr == I2C_ADV7170 >> 1) || |
| 425 | (client->addr == (I2C_ADV7170 >> 1) + 1)) { | 424 | (client->addr == (I2C_ADV7170 >> 1) + 1)) { |
| 426 | dname = adv7170_name; | 425 | dname = adv7170_name; |
| @@ -498,11 +497,11 @@ adv7170_detach_client (struct i2c_client *client) | |||
| 498 | /* ----------------------------------------------------------------------- */ | 497 | /* ----------------------------------------------------------------------- */ |
| 499 | 498 | ||
| 500 | static struct i2c_driver i2c_driver_adv7170 = { | 499 | static struct i2c_driver i2c_driver_adv7170 = { |
| 501 | .owner = THIS_MODULE, | 500 | .driver = { |
| 502 | .name = "adv7170", /* name */ | 501 | .name = "adv7170", /* name */ |
| 502 | }, | ||
| 503 | 503 | ||
| 504 | .id = I2C_DRIVERID_ADV7170, | 504 | .id = I2C_DRIVERID_ADV7170, |
| 505 | .flags = I2C_DF_NOTIFY, | ||
| 506 | 505 | ||
| 507 | .attach_adapter = adv7170_attach_adapter, | 506 | .attach_adapter = adv7170_attach_adapter, |
| 508 | .detach_client = adv7170_detach_client, | 507 | .detach_client = adv7170_detach_client, |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 173bca1e0295..6d9536a71ee4 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
| @@ -470,7 +470,6 @@ adv7175_detect_client (struct i2c_adapter *adapter, | |||
| 470 | client->addr = address; | 470 | client->addr = address; |
| 471 | client->adapter = adapter; | 471 | client->adapter = adapter; |
| 472 | client->driver = &i2c_driver_adv7175; | 472 | client->driver = &i2c_driver_adv7175; |
| 473 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 474 | if ((client->addr == I2C_ADV7175 >> 1) || | 473 | if ((client->addr == I2C_ADV7175 >> 1) || |
| 475 | (client->addr == (I2C_ADV7175 >> 1) + 1)) { | 474 | (client->addr == (I2C_ADV7175 >> 1) + 1)) { |
| 476 | dname = adv7175_name; | 475 | dname = adv7175_name; |
| @@ -548,11 +547,11 @@ adv7175_detach_client (struct i2c_client *client) | |||
| 548 | /* ----------------------------------------------------------------------- */ | 547 | /* ----------------------------------------------------------------------- */ |
| 549 | 548 | ||
| 550 | static struct i2c_driver i2c_driver_adv7175 = { | 549 | static struct i2c_driver i2c_driver_adv7175 = { |
| 551 | .owner = THIS_MODULE, | 550 | .driver = { |
| 552 | .name = "adv7175", /* name */ | 551 | .name = "adv7175", /* name */ |
| 552 | }, | ||
| 553 | 553 | ||
| 554 | .id = I2C_DRIVERID_ADV7175, | 554 | .id = I2C_DRIVERID_ADV7175, |
| 555 | .flags = I2C_DF_NOTIFY, | ||
| 556 | 555 | ||
| 557 | .attach_adapter = adv7175_attach_adapter, | 556 | .attach_adapter = adv7175_attach_adapter, |
| 558 | .detach_client = adv7175_detach_client, | 557 | .detach_client = adv7175_detach_client, |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 3ee0afca76a7..560b99891753 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
| @@ -535,7 +535,6 @@ bt819_detect_client (struct i2c_adapter *adapter, | |||
| 535 | client->addr = address; | 535 | client->addr = address; |
| 536 | client->adapter = adapter; | 536 | client->adapter = adapter; |
| 537 | client->driver = &i2c_driver_bt819; | 537 | client->driver = &i2c_driver_bt819; |
| 538 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 539 | 538 | ||
| 540 | decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL); | 539 | decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL); |
| 541 | if (decoder == NULL) { | 540 | if (decoder == NULL) { |
| @@ -623,11 +622,11 @@ bt819_detach_client (struct i2c_client *client) | |||
| 623 | /* ----------------------------------------------------------------------- */ | 622 | /* ----------------------------------------------------------------------- */ |
| 624 | 623 | ||
| 625 | static struct i2c_driver i2c_driver_bt819 = { | 624 | static struct i2c_driver i2c_driver_bt819 = { |
| 626 | .owner = THIS_MODULE, | 625 | .driver = { |
| 627 | .name = "bt819", | 626 | .name = "bt819", |
| 627 | }, | ||
| 628 | 628 | ||
| 629 | .id = I2C_DRIVERID_BT819, | 629 | .id = I2C_DRIVERID_BT819, |
| 630 | .flags = I2C_DF_NOTIFY, | ||
| 631 | 630 | ||
| 632 | .attach_adapter = bt819_attach_adapter, | 631 | .attach_adapter = bt819_attach_adapter, |
| 633 | .detach_client = bt819_detach_client, | 632 | .detach_client = bt819_detach_client, |
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 3ca1d768bfd3..1c3ff5f38a6d 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c | |||
| @@ -230,10 +230,10 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 230 | /* ----------------------------------------------------------------------- */ | 230 | /* ----------------------------------------------------------------------- */ |
| 231 | 231 | ||
| 232 | static struct i2c_driver driver = { | 232 | static struct i2c_driver driver = { |
| 233 | .owner = THIS_MODULE, | 233 | .driver = { |
| 234 | .name = "i2c bt832 driver", | 234 | .name = "i2c bt832 driver", |
| 235 | }, | ||
| 235 | .id = -1, /* FIXME */ | 236 | .id = -1, /* FIXME */ |
| 236 | .flags = I2C_DF_NOTIFY, | ||
| 237 | .attach_adapter = bt832_probe, | 237 | .attach_adapter = bt832_probe, |
| 238 | .detach_client = bt832_detach, | 238 | .detach_client = bt832_detach, |
| 239 | .command = bt832_command, | 239 | .command = bt832_command, |
| @@ -241,7 +241,6 @@ static struct i2c_driver driver = { | |||
| 241 | static struct i2c_client client_template = | 241 | static struct i2c_client client_template = |
| 242 | { | 242 | { |
| 243 | .name = "bt832", | 243 | .name = "bt832", |
| 244 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 245 | .driver = &driver, | 244 | .driver = &driver, |
| 246 | }; | 245 | }; |
| 247 | 246 | ||
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 8eb871d0e85b..60508069bbed 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
| @@ -323,7 +323,6 @@ bt856_detect_client (struct i2c_adapter *adapter, | |||
| 323 | client->addr = address; | 323 | client->addr = address; |
| 324 | client->adapter = adapter; | 324 | client->adapter = adapter; |
| 325 | client->driver = &i2c_driver_bt856; | 325 | client->driver = &i2c_driver_bt856; |
| 326 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 327 | strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); | 326 | strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); |
| 328 | 327 | ||
| 329 | encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL); | 328 | encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL); |
| @@ -405,11 +404,11 @@ bt856_detach_client (struct i2c_client *client) | |||
| 405 | /* ----------------------------------------------------------------------- */ | 404 | /* ----------------------------------------------------------------------- */ |
| 406 | 405 | ||
| 407 | static struct i2c_driver i2c_driver_bt856 = { | 406 | static struct i2c_driver i2c_driver_bt856 = { |
| 408 | .owner = THIS_MODULE, | 407 | .driver = { |
| 409 | .name = "bt856", | 408 | .name = "bt856", |
| 409 | }, | ||
| 410 | 410 | ||
| 411 | .id = I2C_DRIVERID_BT856, | 411 | .id = I2C_DRIVERID_BT856, |
| 412 | .flags = I2C_DF_NOTIFY, | ||
| 413 | 412 | ||
| 414 | .attach_adapter = bt856_attach_adapter, | 413 | .attach_adapter = bt856_attach_adapter, |
| 415 | .detach_client = bt856_detach_client, | 414 | .detach_client = bt856_detach_client, |
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 77619eb131f6..d6418c023d39 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c | |||
| @@ -300,7 +300,7 @@ static int attach_inform(struct i2c_client *client) | |||
| 300 | 300 | ||
| 301 | if (bttv_debug) | 301 | if (bttv_debug) |
| 302 | printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", | 302 | printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", |
| 303 | btv->c.nr,client->driver->name,client->addr, | 303 | btv->c.nr, client->driver->driver.name, client->addr, |
| 304 | client->name); | 304 | client->name); |
| 305 | if (!client->driver->command) | 305 | if (!client->driver->command) |
| 306 | return 0; | 306 | return 0; |
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 780b352ec119..643ead1a87ee 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
| @@ -42,15 +42,16 @@ MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On"); | |||
| 42 | #define cs53l32a_dbg(fmt, arg...) \ | 42 | #define cs53l32a_dbg(fmt, arg...) \ |
| 43 | do { \ | 43 | do { \ |
| 44 | if (debug) \ | 44 | if (debug) \ |
| 45 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 45 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 46 | client->driver->driver.name, \ | ||
| 46 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 47 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 47 | } while (0) | 48 | } while (0) |
| 48 | 49 | ||
| 49 | #define cs53l32a_err(fmt, arg...) do { \ | 50 | #define cs53l32a_err(fmt, arg...) do { \ |
| 50 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ | 51 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 51 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 52 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 52 | #define cs53l32a_info(fmt, arg...) do { \ | 53 | #define cs53l32a_info(fmt, arg...) do { \ |
| 53 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ | 54 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 54 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 55 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 55 | 56 | ||
| 56 | static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END }; | 57 | static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END }; |
| @@ -154,7 +155,6 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind) | |||
| 154 | client->addr = address; | 155 | client->addr = address; |
| 155 | client->adapter = adapter; | 156 | client->adapter = adapter; |
| 156 | client->driver = &i2c_driver; | 157 | client->driver = &i2c_driver; |
| 157 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 158 | snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); | 158 | snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); |
| 159 | 159 | ||
| 160 | cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); | 160 | cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); |
| @@ -216,13 +216,13 @@ static int cs53l32a_detach(struct i2c_client *client) | |||
| 216 | 216 | ||
| 217 | /* i2c implementation */ | 217 | /* i2c implementation */ |
| 218 | static struct i2c_driver i2c_driver = { | 218 | static struct i2c_driver i2c_driver = { |
| 219 | .name = "cs53l32a", | 219 | .driver = { |
| 220 | .name = "cs53l32a", | ||
| 221 | }, | ||
| 220 | .id = I2C_DRIVERID_CS53L32A, | 222 | .id = I2C_DRIVERID_CS53L32A, |
| 221 | .flags = I2C_DF_NOTIFY, | ||
| 222 | .attach_adapter = cs53l32a_probe, | 223 | .attach_adapter = cs53l32a_probe, |
| 223 | .detach_client = cs53l32a_detach, | 224 | .detach_client = cs53l32a_detach, |
| 224 | .command = cs53l32a_command, | 225 | .command = cs53l32a_command, |
| 225 | .owner = THIS_MODULE, | ||
| 226 | }; | 226 | }; |
| 227 | 227 | ||
| 228 | 228 | ||
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 5b93723a1768..3b09f46dddf6 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -773,7 +773,6 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, | |||
| 773 | client->addr = address; | 773 | client->addr = address; |
| 774 | client->adapter = adapter; | 774 | client->adapter = adapter; |
| 775 | client->driver = &i2c_driver_cx25840; | 775 | client->driver = &i2c_driver_cx25840; |
| 776 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 777 | snprintf(client->name, sizeof(client->name) - 1, "cx25840"); | 776 | snprintf(client->name, sizeof(client->name) - 1, "cx25840"); |
| 778 | 777 | ||
| 779 | cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1); | 778 | cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1); |
| @@ -844,15 +843,15 @@ static int cx25840_detach_client(struct i2c_client *client) | |||
| 844 | /* ----------------------------------------------------------------------- */ | 843 | /* ----------------------------------------------------------------------- */ |
| 845 | 844 | ||
| 846 | static struct i2c_driver i2c_driver_cx25840 = { | 845 | static struct i2c_driver i2c_driver_cx25840 = { |
| 847 | .name = "cx25840", | 846 | .driver = { |
| 847 | .name = "cx25840", | ||
| 848 | }, | ||
| 848 | 849 | ||
| 849 | .id = I2C_DRIVERID_CX25840, | 850 | .id = I2C_DRIVERID_CX25840, |
| 850 | .flags = I2C_DF_NOTIFY, | ||
| 851 | 851 | ||
| 852 | .attach_adapter = cx25840_attach_adapter, | 852 | .attach_adapter = cx25840_attach_adapter, |
| 853 | .detach_client = cx25840_detach_client, | 853 | .detach_client = cx25840_detach_client, |
| 854 | .command = cx25840_command, | 854 | .command = cx25840_command, |
| 855 | .owner = THIS_MODULE, | ||
| 856 | }; | 855 | }; |
| 857 | 856 | ||
| 858 | 857 | ||
diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h index 4932ed1c9b19..40aa59f9c525 100644 --- a/drivers/media/video/cx25840/cx25840.h +++ b/drivers/media/video/cx25840/cx25840.h | |||
| @@ -27,15 +27,16 @@ | |||
| 27 | extern int cx25840_debug; | 27 | extern int cx25840_debug; |
| 28 | 28 | ||
| 29 | #define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \ | 29 | #define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \ |
| 30 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 30 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 31 | client->driver->driver.name, \ | ||
| 31 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 32 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 32 | 33 | ||
| 33 | #define cx25840_err(fmt, arg...) do { \ | 34 | #define cx25840_err(fmt, arg...) do { \ |
| 34 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ | 35 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 35 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 36 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 36 | 37 | ||
| 37 | #define cx25840_info(fmt, arg...) do { \ | 38 | #define cx25840_info(fmt, arg...) do { \ |
| 38 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ | 39 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 39 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 40 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 40 | 41 | ||
| 41 | #define CX25840_CID_CARDTYPE (V4L2_CID_PRIVATE_BASE+0) | 42 | #define CX25840_CID_CARDTYPE (V4L2_CID_PRIVATE_BASE+0) |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 9790d412f192..4a8fb161b16a 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
| @@ -94,7 +94,7 @@ static int attach_inform(struct i2c_client *client) | |||
| 94 | struct cx88_core *core = i2c_get_adapdata(client->adapter); | 94 | struct cx88_core *core = i2c_get_adapdata(client->adapter); |
| 95 | 95 | ||
| 96 | dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", | 96 | dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", |
| 97 | client->driver->name, client->addr, client->name); | 97 | client->driver->driver.name, client->addr, client->name); |
| 98 | if (!client->driver->command) | 98 | if (!client->driver->command) |
| 99 | return 0; | 99 | return 0; |
| 100 | 100 | ||
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 7f5603054f02..d14bcf4ceaea 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
| @@ -497,7 +497,6 @@ static struct i2c_adapter em28xx_adap_template = { | |||
| 497 | 497 | ||
| 498 | static struct i2c_client em28xx_client_template = { | 498 | static struct i2c_client em28xx_client_template = { |
| 499 | .name = "em28xx internal", | 499 | .name = "em28xx internal", |
| 500 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 501 | }; | 500 | }; |
| 502 | 501 | ||
| 503 | /* ----------------------------------------------------------- */ | 502 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c index deeef125eb92..bb5cbecffcc3 100644 --- a/drivers/media/video/indycam.c +++ b/drivers/media/video/indycam.c | |||
| @@ -451,10 +451,10 @@ static int indycam_command(struct i2c_client *client, unsigned int cmd, | |||
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | static struct i2c_driver i2c_driver_indycam = { | 453 | static struct i2c_driver i2c_driver_indycam = { |
| 454 | .owner = THIS_MODULE, | 454 | .driver = { |
| 455 | .name = "indycam", | 455 | .name = "indycam", |
| 456 | }, | ||
| 456 | .id = I2C_DRIVERID_INDYCAM, | 457 | .id = I2C_DRIVERID_INDYCAM, |
| 457 | .flags = I2C_DF_NOTIFY, | ||
| 458 | .attach_adapter = indycam_probe, | 458 | .attach_adapter = indycam_probe, |
| 459 | .detach_client = indycam_detach, | 459 | .detach_client = indycam_detach, |
| 460 | .command = indycam_command, | 460 | .command = indycam_command, |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 740e543311af..3cc1d6a6019b 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
| @@ -278,9 +278,10 @@ static int ir_detach(struct i2c_client *client); | |||
| 278 | static int ir_probe(struct i2c_adapter *adap); | 278 | static int ir_probe(struct i2c_adapter *adap); |
| 279 | 279 | ||
| 280 | static struct i2c_driver driver = { | 280 | static struct i2c_driver driver = { |
| 281 | .name = "ir remote kbd driver", | 281 | .driver = { |
| 282 | .name = "ir remote kbd driver", | ||
| 283 | }, | ||
| 282 | .id = I2C_DRIVERID_INFRARED, | 284 | .id = I2C_DRIVERID_INFRARED, |
| 283 | .flags = I2C_DF_NOTIFY, | ||
| 284 | .attach_adapter = ir_probe, | 285 | .attach_adapter = ir_probe, |
| 285 | .detach_client = ir_detach, | 286 | .detach_client = ir_detach, |
| 286 | }; | 287 | }; |
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index d86f8e92e534..183253e2dd91 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
| @@ -59,7 +59,8 @@ | |||
| 59 | #define msp3400_dbg(fmt, arg...) \ | 59 | #define msp3400_dbg(fmt, arg...) \ |
| 60 | do { \ | 60 | do { \ |
| 61 | if (debug) \ | 61 | if (debug) \ |
| 62 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 62 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 63 | client->driver->driver.name, \ | ||
| 63 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 64 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 64 | } while (0) | 65 | } while (0) |
| 65 | 66 | ||
| @@ -67,7 +68,8 @@ | |||
| 67 | #define msp3400_dbg_mediumvol(fmt, arg...) \ | 68 | #define msp3400_dbg_mediumvol(fmt, arg...) \ |
| 68 | do { \ | 69 | do { \ |
| 69 | if (debug >= 2) \ | 70 | if (debug >= 2) \ |
| 70 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 71 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 72 | client->driver->driver.name, \ | ||
| 71 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 73 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 72 | } while (0) | 74 | } while (0) |
| 73 | 75 | ||
| @@ -75,18 +77,19 @@ | |||
| 75 | #define msp3400_dbg_highvol(fmt, arg...) \ | 77 | #define msp3400_dbg_highvol(fmt, arg...) \ |
| 76 | do { \ | 78 | do { \ |
| 77 | if (debug >= 16) \ | 79 | if (debug >= 16) \ |
| 78 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 80 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 81 | client->driver->driver.name, \ | ||
| 79 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 82 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 80 | } while (0) | 83 | } while (0) |
| 81 | 84 | ||
| 82 | #define msp3400_err(fmt, arg...) do { \ | 85 | #define msp3400_err(fmt, arg...) do { \ |
| 83 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ | 86 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 84 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 87 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 85 | #define msp3400_warn(fmt, arg...) do { \ | 88 | #define msp3400_warn(fmt, arg...) do { \ |
| 86 | printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->name, \ | 89 | printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 87 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 90 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 88 | #define msp3400_info(fmt, arg...) do { \ | 91 | #define msp3400_info(fmt, arg...) do { \ |
| 89 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ | 92 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 90 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 93 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 91 | 94 | ||
| 92 | #define OPMODE_AUTO -1 | 95 | #define OPMODE_AUTO -1 |
| @@ -1561,14 +1564,12 @@ static int msp_resume(struct device * dev); | |||
| 1561 | static void msp_wake_thread(struct i2c_client *client); | 1564 | static void msp_wake_thread(struct i2c_client *client); |
| 1562 | 1565 | ||
| 1563 | static struct i2c_driver driver = { | 1566 | static struct i2c_driver driver = { |
| 1564 | .owner = THIS_MODULE, | ||
| 1565 | .name = "msp3400", | ||
| 1566 | .id = I2C_DRIVERID_MSP3400, | 1567 | .id = I2C_DRIVERID_MSP3400, |
| 1567 | .flags = I2C_DF_NOTIFY, | ||
| 1568 | .attach_adapter = msp_probe, | 1568 | .attach_adapter = msp_probe, |
| 1569 | .detach_client = msp_detach, | 1569 | .detach_client = msp_detach, |
| 1570 | .command = msp_command, | 1570 | .command = msp_command, |
| 1571 | .driver = { | 1571 | .driver = { |
| 1572 | .name = "i2c msp3400 driver", | ||
| 1572 | .suspend = msp_suspend, | 1573 | .suspend = msp_suspend, |
| 1573 | .resume = msp_resume, | 1574 | .resume = msp_resume, |
| 1574 | }, | 1575 | }, |
| @@ -1577,7 +1578,6 @@ static struct i2c_driver driver = { | |||
| 1577 | static struct i2c_client client_template = | 1578 | static struct i2c_client client_template = |
| 1578 | { | 1579 | { |
| 1579 | .name = "(unset)", | 1580 | .name = "(unset)", |
| 1580 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 1581 | .driver = &driver, | 1581 | .driver = &driver, |
| 1582 | }; | 1582 | }; |
| 1583 | 1583 | ||
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 2de34ebf0673..428f1bb75ec3 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c | |||
| @@ -410,11 +410,11 @@ static int ovcamchip_command(struct i2c_client *c, unsigned int cmd, void *arg) | |||
| 410 | /* ----------------------------------------------------------------------- */ | 410 | /* ----------------------------------------------------------------------- */ |
| 411 | 411 | ||
| 412 | static struct i2c_driver driver = { | 412 | static struct i2c_driver driver = { |
| 413 | .owner = THIS_MODULE, | 413 | .driver = { |
| 414 | .name = "ovcamchip", | 414 | .name = "ovcamchip", |
| 415 | }, | ||
| 415 | .id = I2C_DRIVERID_OVCAMCHIP, | 416 | .id = I2C_DRIVERID_OVCAMCHIP, |
| 416 | .class = I2C_CLASS_CAM_DIGITAL, | 417 | .class = I2C_CLASS_CAM_DIGITAL, |
| 417 | .flags = I2C_DF_NOTIFY, | ||
| 418 | .attach_adapter = ovcamchip_attach, | 418 | .attach_adapter = ovcamchip_attach, |
| 419 | .detach_client = ovcamchip_detach, | 419 | .detach_client = ovcamchip_detach, |
| 420 | .command = ovcamchip_command, | 420 | .command = ovcamchip_command, |
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index b8054da31ffd..0aa9e72f632c 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
| @@ -151,25 +151,18 @@ static int saa5246a_detach(struct i2c_client *client) | |||
| 151 | return 0; | 151 | return 0; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static int saa5246a_command(struct i2c_client *device, unsigned int cmd, | ||
| 155 | void *arg) | ||
| 156 | { | ||
| 157 | return -EINVAL; | ||
| 158 | } | ||
| 159 | |||
| 160 | /* | 154 | /* |
| 161 | * I2C interfaces | 155 | * I2C interfaces |
| 162 | */ | 156 | */ |
| 163 | 157 | ||
| 164 | static struct i2c_driver i2c_driver_videotext = | 158 | static struct i2c_driver i2c_driver_videotext = |
| 165 | { | 159 | { |
| 166 | .owner = THIS_MODULE, | 160 | .driver = { |
| 167 | .name = IF_NAME, /* name */ | 161 | .name = IF_NAME, /* name */ |
| 162 | }, | ||
| 168 | .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ | 163 | .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ |
| 169 | .flags = I2C_DF_NOTIFY, | ||
| 170 | .attach_adapter = saa5246a_probe, | 164 | .attach_adapter = saa5246a_probe, |
| 171 | .detach_client = saa5246a_detach, | 165 | .detach_client = saa5246a_detach, |
| 172 | .command = saa5246a_command | ||
| 173 | }; | 166 | }; |
| 174 | 167 | ||
| 175 | static struct i2c_client client_template = { | 168 | static struct i2c_client client_template = { |
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 7ffa2e9a9bf3..a51c7bd96618 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
| @@ -226,23 +226,16 @@ static int saa5249_detach(struct i2c_client *client) | |||
| 226 | return 0; | 226 | return 0; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | static int saa5249_command(struct i2c_client *device, | ||
| 230 | unsigned int cmd, void *arg) | ||
| 231 | { | ||
| 232 | return -EINVAL; | ||
| 233 | } | ||
| 234 | |||
| 235 | /* new I2C driver support */ | 229 | /* new I2C driver support */ |
| 236 | 230 | ||
| 237 | static struct i2c_driver i2c_driver_videotext = | 231 | static struct i2c_driver i2c_driver_videotext = |
| 238 | { | 232 | { |
| 239 | .owner = THIS_MODULE, | 233 | .driver = { |
| 240 | .name = IF_NAME, /* name */ | 234 | .name = IF_NAME, /* name */ |
| 235 | }, | ||
| 241 | .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ | 236 | .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ |
| 242 | .flags = I2C_DF_NOTIFY, | ||
| 243 | .attach_adapter = saa5249_probe, | 237 | .attach_adapter = saa5249_probe, |
| 244 | .detach_client = saa5249_detach, | 238 | .detach_client = saa5249_detach, |
| 245 | .command = saa5249_command | ||
| 246 | }; | 239 | }; |
| 247 | 240 | ||
| 248 | static struct i2c_client client_template = { | 241 | static struct i2c_client client_template = { |
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 923322503e8f..d60a783e0473 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c | |||
| @@ -495,10 +495,10 @@ static int saa6588_command(struct i2c_client *client, unsigned int cmd, | |||
| 495 | /* ----------------------------------------------------------------------- */ | 495 | /* ----------------------------------------------------------------------- */ |
| 496 | 496 | ||
| 497 | static struct i2c_driver driver = { | 497 | static struct i2c_driver driver = { |
| 498 | .owner = THIS_MODULE, | 498 | .driver = { |
| 499 | .name = "i2c saa6588 driver", | 499 | .name = "i2c saa6588 driver", |
| 500 | }, | ||
| 500 | .id = -1, /* FIXME */ | 501 | .id = -1, /* FIXME */ |
| 501 | .flags = I2C_DF_NOTIFY, | ||
| 502 | .attach_adapter = saa6588_probe, | 502 | .attach_adapter = saa6588_probe, |
| 503 | .detach_client = saa6588_detach, | 503 | .detach_client = saa6588_detach, |
| 504 | .command = saa6588_command, | 504 | .command = saa6588_command, |
| @@ -506,7 +506,6 @@ static struct i2c_driver driver = { | |||
| 506 | 506 | ||
| 507 | static struct i2c_client client_template = { | 507 | static struct i2c_client client_template = { |
| 508 | .name = "saa6588", | 508 | .name = "saa6588", |
| 509 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 510 | .driver = &driver, | 509 | .driver = &driver, |
| 511 | }; | 510 | }; |
| 512 | 511 | ||
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index e116bdbed310..619ff0b7a1ff 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
| @@ -501,7 +501,6 @@ saa7110_detect_client (struct i2c_adapter *adapter, | |||
| 501 | client->addr = address; | 501 | client->addr = address; |
| 502 | client->adapter = adapter; | 502 | client->adapter = adapter; |
| 503 | client->driver = &i2c_driver_saa7110; | 503 | client->driver = &i2c_driver_saa7110; |
| 504 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 505 | strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); | 504 | strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); |
| 506 | 505 | ||
| 507 | decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL); | 506 | decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL); |
| @@ -587,11 +586,11 @@ saa7110_detach_client (struct i2c_client *client) | |||
| 587 | /* ----------------------------------------------------------------------- */ | 586 | /* ----------------------------------------------------------------------- */ |
| 588 | 587 | ||
| 589 | static struct i2c_driver i2c_driver_saa7110 = { | 588 | static struct i2c_driver i2c_driver_saa7110 = { |
| 590 | .owner = THIS_MODULE, | 589 | .driver = { |
| 591 | .name = "saa7110", | 590 | .name = "saa7110", |
| 591 | }, | ||
| 592 | 592 | ||
| 593 | .id = I2C_DRIVERID_SAA7110, | 593 | .id = I2C_DRIVERID_SAA7110, |
| 594 | .flags = I2C_DF_NOTIFY, | ||
| 595 | 594 | ||
| 596 | .attach_adapter = saa7110_attach_adapter, | 595 | .attach_adapter = saa7110_attach_adapter, |
| 597 | .detach_client = saa7110_detach_client, | 596 | .detach_client = saa7110_detach_client, |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index fe8a5e453969..acaeee592b54 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
| @@ -518,7 +518,6 @@ saa7111_detect_client (struct i2c_adapter *adapter, | |||
| 518 | client->addr = address; | 518 | client->addr = address; |
| 519 | client->adapter = adapter; | 519 | client->adapter = adapter; |
| 520 | client->driver = &i2c_driver_saa7111; | 520 | client->driver = &i2c_driver_saa7111; |
| 521 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 522 | strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); | 521 | strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); |
| 523 | 522 | ||
| 524 | decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); | 523 | decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); |
| @@ -590,11 +589,11 @@ saa7111_detach_client (struct i2c_client *client) | |||
| 590 | /* ----------------------------------------------------------------------- */ | 589 | /* ----------------------------------------------------------------------- */ |
| 591 | 590 | ||
| 592 | static struct i2c_driver i2c_driver_saa7111 = { | 591 | static struct i2c_driver i2c_driver_saa7111 = { |
| 593 | .owner = THIS_MODULE, | 592 | .driver = { |
| 594 | .name = "saa7111", | 593 | .name = "saa7111", |
| 594 | }, | ||
| 595 | 595 | ||
| 596 | .id = I2C_DRIVERID_SAA7111A, | 596 | .id = I2C_DRIVERID_SAA7111A, |
| 597 | .flags = I2C_DF_NOTIFY, | ||
| 598 | 597 | ||
| 599 | .attach_adapter = saa7111_attach_adapter, | 598 | .attach_adapter = saa7111_attach_adapter, |
| 600 | .detach_client = saa7111_detach_client, | 599 | .detach_client = saa7111_detach_client, |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index d9f50e2f7b92..b7ac0122f729 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
| @@ -859,7 +859,6 @@ saa7114_detect_client (struct i2c_adapter *adapter, | |||
| 859 | client->addr = address; | 859 | client->addr = address; |
| 860 | client->adapter = adapter; | 860 | client->adapter = adapter; |
| 861 | client->driver = &i2c_driver_saa7114; | 861 | client->driver = &i2c_driver_saa7114; |
| 862 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 863 | strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); | 862 | strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); |
| 864 | 863 | ||
| 865 | decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL); | 864 | decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL); |
| @@ -1204,11 +1203,11 @@ saa7114_detach_client (struct i2c_client *client) | |||
| 1204 | /* ----------------------------------------------------------------------- */ | 1203 | /* ----------------------------------------------------------------------- */ |
| 1205 | 1204 | ||
| 1206 | static struct i2c_driver i2c_driver_saa7114 = { | 1205 | static struct i2c_driver i2c_driver_saa7114 = { |
| 1207 | .owner = THIS_MODULE, | 1206 | .driver = { |
| 1208 | .name = "saa7114", | 1207 | .name = "saa7114", |
| 1208 | }, | ||
| 1209 | 1209 | ||
| 1210 | .id = I2C_DRIVERID_SAA7114, | 1210 | .id = I2C_DRIVERID_SAA7114, |
| 1211 | .flags = I2C_DF_NOTIFY, | ||
| 1212 | 1211 | ||
| 1213 | .attach_adapter = saa7114_attach_adapter, | 1212 | .attach_adapter = saa7114_attach_adapter, |
| 1214 | .detach_client = saa7114_detach_client, | 1213 | .detach_client = saa7114_detach_client, |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index e717e30d8187..29e28c742cd4 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
| @@ -52,15 +52,16 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
| 52 | #define saa7115_dbg(fmt,arg...) \ | 52 | #define saa7115_dbg(fmt,arg...) \ |
| 53 | do { \ | 53 | do { \ |
| 54 | if (debug) \ | 54 | if (debug) \ |
| 55 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 55 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 56 | client->driver->driver.name, \ | ||
| 56 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 57 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 57 | } while (0) | 58 | } while (0) |
| 58 | 59 | ||
| 59 | #define saa7115_err(fmt, arg...) do { \ | 60 | #define saa7115_err(fmt, arg...) do { \ |
| 60 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ | 61 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 61 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 62 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 62 | #define saa7115_info(fmt, arg...) do { \ | 63 | #define saa7115_info(fmt, arg...) do { \ |
| 63 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ | 64 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 64 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 65 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 65 | 66 | ||
| 66 | static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END }; | 67 | static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END }; |
| @@ -1270,7 +1271,6 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
| 1270 | client->addr = address; | 1271 | client->addr = address; |
| 1271 | client->adapter = adapter; | 1272 | client->adapter = adapter; |
| 1272 | client->driver = &i2c_driver_saa7115; | 1273 | client->driver = &i2c_driver_saa7115; |
| 1273 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 1274 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); | 1274 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); |
| 1275 | 1275 | ||
| 1276 | saa7115_dbg("detecting saa7115 client on address 0x%x\n", address << 1); | 1276 | saa7115_dbg("detecting saa7115 client on address 0x%x\n", address << 1); |
| @@ -1354,13 +1354,13 @@ static int saa7115_detach(struct i2c_client *client) | |||
| 1354 | 1354 | ||
| 1355 | /* i2c implementation */ | 1355 | /* i2c implementation */ |
| 1356 | static struct i2c_driver i2c_driver_saa7115 = { | 1356 | static struct i2c_driver i2c_driver_saa7115 = { |
| 1357 | .name = "saa7115", | 1357 | .driver = { |
| 1358 | .name = "saa7115", | ||
| 1359 | }, | ||
| 1358 | .id = I2C_DRIVERID_SAA711X, | 1360 | .id = I2C_DRIVERID_SAA711X, |
| 1359 | .flags = I2C_DF_NOTIFY, | ||
| 1360 | .attach_adapter = saa7115_probe, | 1361 | .attach_adapter = saa7115_probe, |
| 1361 | .detach_client = saa7115_detach, | 1362 | .detach_client = saa7115_detach, |
| 1362 | .command = saa7115_command, | 1363 | .command = saa7115_command, |
| 1363 | .owner = THIS_MODULE, | ||
| 1364 | }; | 1364 | }; |
| 1365 | 1365 | ||
| 1366 | 1366 | ||
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 31f7b950b01c..8008537391b5 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c | |||
| @@ -494,7 +494,6 @@ saa711x_detect_client (struct i2c_adapter *adapter, | |||
| 494 | client->addr = address; | 494 | client->addr = address; |
| 495 | client->adapter = adapter; | 495 | client->adapter = adapter; |
| 496 | client->driver = &i2c_driver_saa711x; | 496 | client->driver = &i2c_driver_saa711x; |
| 497 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 498 | strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); | 497 | strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); |
| 499 | decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); | 498 | decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); |
| 500 | if (decoder == NULL) { | 499 | if (decoder == NULL) { |
| @@ -565,11 +564,11 @@ saa711x_detach_client (struct i2c_client *client) | |||
| 565 | /* ----------------------------------------------------------------------- */ | 564 | /* ----------------------------------------------------------------------- */ |
| 566 | 565 | ||
| 567 | static struct i2c_driver i2c_driver_saa711x = { | 566 | static struct i2c_driver i2c_driver_saa711x = { |
| 568 | .owner = THIS_MODULE, | 567 | .driver = { |
| 569 | .name = "saa711x", | 568 | .name = "saa711x", |
| 569 | }, | ||
| 570 | 570 | ||
| 571 | .id = I2C_DRIVERID_SAA711X, | 571 | .id = I2C_DRIVERID_SAA711X, |
| 572 | .flags = I2C_DF_NOTIFY, | ||
| 573 | 572 | ||
| 574 | .attach_adapter = saa711x_attach_adapter, | 573 | .attach_adapter = saa711x_attach_adapter, |
| 575 | .detach_client = saa711x_detach_client, | 574 | .detach_client = saa711x_detach_client, |
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index c36f014f1fdf..bca6ed0e2752 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
| @@ -69,7 +69,8 @@ MODULE_PARM_DESC(test_image, "test_image (0-1)"); | |||
| 69 | #define saa7127_dbg(fmt, arg...) \ | 69 | #define saa7127_dbg(fmt, arg...) \ |
| 70 | do { \ | 70 | do { \ |
| 71 | if (debug >= 1) \ | 71 | if (debug >= 1) \ |
| 72 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 72 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 73 | client->driver->driver.name, \ | ||
| 73 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 74 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 74 | } while (0) | 75 | } while (0) |
| 75 | 76 | ||
| @@ -77,15 +78,16 @@ MODULE_PARM_DESC(test_image, "test_image (0-1)"); | |||
| 77 | #define saa7127_dbg_highvol(fmt, arg...) \ | 78 | #define saa7127_dbg_highvol(fmt, arg...) \ |
| 78 | do { \ | 79 | do { \ |
| 79 | if (debug == 2) \ | 80 | if (debug == 2) \ |
| 80 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | 81 | printk(KERN_INFO "%s debug %d-%04x: " fmt, \ |
| 82 | client->driver->driver.name, \ | ||
| 81 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | 83 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ |
| 82 | } while (0) | 84 | } while (0) |
| 83 | 85 | ||
| 84 | #define saa7127_err(fmt, arg...) do { \ | 86 | #define saa7127_err(fmt, arg...) do { \ |
| 85 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ | 87 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 86 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 88 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 87 | #define saa7127_info(fmt, arg...) do { \ | 89 | #define saa7127_info(fmt, arg...) do { \ |
| 88 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ | 90 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 89 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 91 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 90 | 92 | ||
| 91 | static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; | 93 | static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; |
| @@ -719,7 +721,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
| 719 | client->addr = address; | 721 | client->addr = address; |
| 720 | client->adapter = adapter; | 722 | client->adapter = adapter; |
| 721 | client->driver = &i2c_driver_saa7127; | 723 | client->driver = &i2c_driver_saa7127; |
| 722 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 723 | snprintf(client->name, sizeof(client->name) - 1, "saa7127"); | 724 | snprintf(client->name, sizeof(client->name) - 1, "saa7127"); |
| 724 | 725 | ||
| 725 | saa7127_dbg("detecting saa7127 client on address 0x%x\n", address << 1); | 726 | saa7127_dbg("detecting saa7127 client on address 0x%x\n", address << 1); |
| @@ -819,13 +820,13 @@ static int saa7127_detach(struct i2c_client *client) | |||
| 819 | /* ----------------------------------------------------------------------- */ | 820 | /* ----------------------------------------------------------------------- */ |
| 820 | 821 | ||
| 821 | static struct i2c_driver i2c_driver_saa7127 = { | 822 | static struct i2c_driver i2c_driver_saa7127 = { |
| 822 | .name = "saa7127", | 823 | .driver = { |
| 824 | .name = "saa7127", | ||
| 825 | }, | ||
| 823 | .id = I2C_DRIVERID_SAA7127, | 826 | .id = I2C_DRIVERID_SAA7127, |
| 824 | .flags = I2C_DF_NOTIFY, | ||
| 825 | .attach_adapter = saa7127_probe, | 827 | .attach_adapter = saa7127_probe, |
| 826 | .detach_client = saa7127_detach, | 828 | .detach_client = saa7127_detach, |
| 827 | .command = saa7127_command, | 829 | .command = saa7127_command, |
| 828 | .owner = THIS_MODULE, | ||
| 829 | }; | 830 | }; |
| 830 | 831 | ||
| 831 | 832 | ||
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index a61d24f588f7..4615a982ac64 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
| @@ -597,10 +597,10 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 597 | /* ----------------------------------------------------------------------- */ | 597 | /* ----------------------------------------------------------------------- */ |
| 598 | 598 | ||
| 599 | static struct i2c_driver driver = { | 599 | static struct i2c_driver driver = { |
| 600 | .owner = THIS_MODULE, | 600 | .driver = { |
| 601 | .name = "i2c saa6752hs MPEG encoder", | 601 | .name = "i2c saa6752hs MPEG encoder", |
| 602 | }, | ||
| 602 | .id = I2C_DRIVERID_SAA6752HS, | 603 | .id = I2C_DRIVERID_SAA6752HS, |
| 603 | .flags = I2C_DF_NOTIFY, | ||
| 604 | .attach_adapter = saa6752hs_probe, | 604 | .attach_adapter = saa6752hs_probe, |
| 605 | .detach_client = saa6752hs_detach, | 605 | .detach_client = saa6752hs_detach, |
| 606 | .command = saa6752hs_command, | 606 | .command = saa6752hs_command, |
| @@ -609,7 +609,6 @@ static struct i2c_driver driver = { | |||
| 609 | static struct i2c_client client_template = | 609 | static struct i2c_client client_template = |
| 610 | { | 610 | { |
| 611 | .name = "saa6752hs", | 611 | .name = "saa6752hs", |
| 612 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 613 | .driver = &driver, | 612 | .driver = &driver, |
| 614 | }; | 613 | }; |
| 615 | 614 | ||
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index df9dd36721e0..1792d03d621d 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
| @@ -333,7 +333,7 @@ static int attach_inform(struct i2c_client *client) | |||
| 333 | struct tuner_setup tun_setup; | 333 | struct tuner_setup tun_setup; |
| 334 | 334 | ||
| 335 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", | 335 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", |
| 336 | client->driver->name, client->addr, client->name); | 336 | client->driver->driver.name, client->addr, client->name); |
| 337 | 337 | ||
| 338 | /* Am I an i2c remote control? */ | 338 | /* Am I an i2c remote control? */ |
| 339 | 339 | ||
| @@ -343,7 +343,7 @@ static int attach_inform(struct i2c_client *client) | |||
| 343 | { | 343 | { |
| 344 | struct IR_i2c *ir = i2c_get_clientdata(client); | 344 | struct IR_i2c *ir = i2c_get_clientdata(client); |
| 345 | d1printk("%s i2c IR detected (%s).\n", | 345 | d1printk("%s i2c IR detected (%s).\n", |
| 346 | client->driver->name,ir->phys); | 346 | client->driver->driver.name, ir->phys); |
| 347 | saa7134_set_i2c_ir(dev,ir); | 347 | saa7134_set_i2c_ir(dev,ir); |
| 348 | break; | 348 | break; |
| 349 | } | 349 | } |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 132aa7943c16..f72a9f796209 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
| @@ -415,7 +415,6 @@ saa7185_detect_client (struct i2c_adapter *adapter, | |||
| 415 | client->addr = address; | 415 | client->addr = address; |
| 416 | client->adapter = adapter; | 416 | client->adapter = adapter; |
| 417 | client->driver = &i2c_driver_saa7185; | 417 | client->driver = &i2c_driver_saa7185; |
| 418 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 419 | strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); | 418 | strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); |
| 420 | 419 | ||
| 421 | encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL); | 420 | encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL); |
| @@ -487,11 +486,11 @@ saa7185_detach_client (struct i2c_client *client) | |||
| 487 | /* ----------------------------------------------------------------------- */ | 486 | /* ----------------------------------------------------------------------- */ |
| 488 | 487 | ||
| 489 | static struct i2c_driver i2c_driver_saa7185 = { | 488 | static struct i2c_driver i2c_driver_saa7185 = { |
| 490 | .owner = THIS_MODULE, | 489 | .driver = { |
| 491 | .name = "saa7185", /* name */ | 490 | .name = "saa7185", /* name */ |
| 491 | }, | ||
| 492 | 492 | ||
| 493 | .id = I2C_DRIVERID_SAA7185B, | 493 | .id = I2C_DRIVERID_SAA7185B, |
| 494 | .flags = I2C_DF_NOTIFY, | ||
| 495 | 494 | ||
| 496 | .attach_adapter = saa7185_attach_adapter, | 495 | .attach_adapter = saa7185_attach_adapter, |
| 497 | .detach_client = saa7185_detach_client, | 496 | .detach_client = saa7185_detach_client, |
diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index cbca896e8cfa..41f6f05a0436 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c | |||
| @@ -788,10 +788,10 @@ static int saa7191_command(struct i2c_client *client, unsigned int cmd, | |||
| 788 | } | 788 | } |
| 789 | 789 | ||
| 790 | static struct i2c_driver i2c_driver_saa7191 = { | 790 | static struct i2c_driver i2c_driver_saa7191 = { |
| 791 | .owner = THIS_MODULE, | 791 | .driver = { |
| 792 | .name = "saa7191", | 792 | .name = "saa7191", |
| 793 | }, | ||
| 793 | .id = I2C_DRIVERID_SAA7191, | 794 | .id = I2C_DRIVERID_SAA7191, |
| 794 | .flags = I2C_DF_NOTIFY, | ||
| 795 | .attach_adapter = saa7191_probe, | 795 | .attach_adapter = saa7191_probe, |
| 796 | .detach_client = saa7191_detach, | 796 | .detach_client = saa7191_detach, |
| 797 | .command = saa7191_command | 797 | .command = saa7191_command |
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index d32737dd2142..549c9929f107 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c | |||
| @@ -501,10 +501,10 @@ static int tda7432_command(struct i2c_client *client, | |||
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | static struct i2c_driver driver = { | 503 | static struct i2c_driver driver = { |
| 504 | .owner = THIS_MODULE, | 504 | .driver = { |
| 505 | .name = "i2c tda7432 driver", | 505 | .name = "i2c tda7432 driver", |
| 506 | }, | ||
| 506 | .id = I2C_DRIVERID_TDA7432, | 507 | .id = I2C_DRIVERID_TDA7432, |
| 507 | .flags = I2C_DF_NOTIFY, | ||
| 508 | .attach_adapter = tda7432_probe, | 508 | .attach_adapter = tda7432_probe, |
| 509 | .detach_client = tda7432_detach, | 509 | .detach_client = tda7432_detach, |
| 510 | .command = tda7432_command, | 510 | .command = tda7432_command, |
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 0cb5c7e9a884..ed4c04119ccc 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
| @@ -221,10 +221,10 @@ static int detach(struct i2c_client *client) | |||
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static struct i2c_driver driver = { | 223 | static struct i2c_driver driver = { |
| 224 | .owner = THIS_MODULE, | 224 | .driver = { |
| 225 | .name = "tda9840", | 225 | .name = "tda9840", |
| 226 | }, | ||
| 226 | .id = I2C_DRIVERID_TDA9840, | 227 | .id = I2C_DRIVERID_TDA9840, |
| 227 | .flags = I2C_DF_NOTIFY, | ||
| 228 | .attach_adapter = attach, | 228 | .attach_adapter = attach, |
| 229 | .detach_client = detach, | 229 | .detach_client = detach, |
| 230 | .command = command, | 230 | .command = command, |
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index a5e37dc91f39..9c3ecf7a0fed 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c | |||
| @@ -372,10 +372,10 @@ static int tda9875_command(struct i2c_client *client, | |||
| 372 | 372 | ||
| 373 | 373 | ||
| 374 | static struct i2c_driver driver = { | 374 | static struct i2c_driver driver = { |
| 375 | .owner = THIS_MODULE, | 375 | .driver = { |
| 376 | .name = "i2c tda9875 driver", | 376 | .name = "i2c tda9875 driver", |
| 377 | }, | ||
| 377 | .id = I2C_DRIVERID_TDA9875, | 378 | .id = I2C_DRIVERID_TDA9875, |
| 378 | .flags = I2C_DF_NOTIFY, | ||
| 379 | .attach_adapter = tda9875_probe, | 379 | .attach_adapter = tda9875_probe, |
| 380 | .detach_client = tda9875_detach, | 380 | .detach_client = tda9875_detach, |
| 381 | .command = tda9875_command, | 381 | .command = tda9875_command, |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 2f2414e90e8b..7165a1b9625a 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
| @@ -819,14 +819,12 @@ static int tda9887_resume(struct device * dev) | |||
| 819 | /* ----------------------------------------------------------------------- */ | 819 | /* ----------------------------------------------------------------------- */ |
| 820 | 820 | ||
| 821 | static struct i2c_driver driver = { | 821 | static struct i2c_driver driver = { |
| 822 | .owner = THIS_MODULE, | ||
| 823 | .name = "i2c tda9887 driver", | ||
| 824 | .id = -1, /* FIXME */ | 822 | .id = -1, /* FIXME */ |
| 825 | .flags = I2C_DF_NOTIFY, | ||
| 826 | .attach_adapter = tda9887_probe, | 823 | .attach_adapter = tda9887_probe, |
| 827 | .detach_client = tda9887_detach, | 824 | .detach_client = tda9887_detach, |
| 828 | .command = tda9887_command, | 825 | .command = tda9887_command, |
| 829 | .driver = { | 826 | .driver = { |
| 827 | .name = "i2c tda9887 driver", | ||
| 830 | .suspend = tda9887_suspend, | 828 | .suspend = tda9887_suspend, |
| 831 | .resume = tda9887_resume, | 829 | .resume = tda9887_resume, |
| 832 | }, | 830 | }, |
| @@ -834,7 +832,6 @@ static struct i2c_driver driver = { | |||
| 834 | static struct i2c_client client_template = | 832 | static struct i2c_client client_template = |
| 835 | { | 833 | { |
| 836 | .name = "tda9887", | 834 | .name = "tda9887", |
| 837 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 838 | .driver = &driver, | 835 | .driver = &driver, |
| 839 | }; | 836 | }; |
| 840 | 837 | ||
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 09149dad1b84..bb35844e3842 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
| @@ -190,10 +190,10 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static struct i2c_driver driver = { | 192 | static struct i2c_driver driver = { |
| 193 | .owner = THIS_MODULE, | 193 | .driver = { |
| 194 | .name = "tea6415c", | 194 | .name = "tea6415c", |
| 195 | }, | ||
| 195 | .id = I2C_DRIVERID_TEA6415C, | 196 | .id = I2C_DRIVERID_TEA6415C, |
| 196 | .flags = I2C_DF_NOTIFY, | ||
| 197 | .attach_adapter = attach, | 197 | .attach_adapter = attach, |
| 198 | .detach_client = detach, | 198 | .detach_client = detach, |
| 199 | .command = command, | 199 | .command = command, |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index e908f917c8d2..c4ba3742f5c7 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
| @@ -167,10 +167,10 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static struct i2c_driver driver = { | 169 | static struct i2c_driver driver = { |
| 170 | .owner = THIS_MODULE, | 170 | .driver = { |
| 171 | .name = "tea6420", | 171 | .name = "tea6420", |
| 172 | }, | ||
| 172 | .id = I2C_DRIVERID_TEA6420, | 173 | .id = I2C_DRIVERID_TEA6420, |
| 173 | .flags = I2C_DF_NOTIFY, | ||
| 174 | .attach_adapter = attach, | 174 | .attach_adapter = attach, |
| 175 | .detach_client = detach, | 175 | .detach_client = detach, |
| 176 | .command = command, | 176 | .command = command, |
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index 79203595b9c1..d97f66804c37 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c | |||
| @@ -175,10 +175,10 @@ tuner_probe(struct i2c_adapter *adap) | |||
| 175 | static struct i2c_driver | 175 | static struct i2c_driver |
| 176 | i2c_driver_tuner = | 176 | i2c_driver_tuner = |
| 177 | { | 177 | { |
| 178 | .owner = THIS_MODULE, | 178 | .driver = { |
| 179 | .name = "sab3036", | 179 | .name = "sab3036", |
| 180 | }, | ||
| 180 | .id = I2C_DRIVERID_SAB3036, | 181 | .id = I2C_DRIVERID_SAB3036, |
| 181 | .flags = I2C_DF_NOTIFY, | ||
| 182 | .attach_adapter = tuner_probe, | 182 | .attach_adapter = tuner_probe, |
| 183 | .detach_client = tuner_detach, | 183 | .detach_client = tuner_detach, |
| 184 | .command = tuner_command | 184 | .command = tuner_command |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index e58abdfcaab8..c13c7b95ef35 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
| @@ -206,7 +206,7 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
| 206 | 206 | ||
| 207 | set_freq(c, t->freq); | 207 | set_freq(c, t->freq); |
| 208 | tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", | 208 | tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", |
| 209 | c->adapter->name, c->driver->name, c->addr << 1, type, | 209 | c->adapter->name, c->driver->driver.name, c->addr << 1, type, |
| 210 | t->mode_mask); | 210 | t->mode_mask); |
| 211 | } | 211 | } |
| 212 | 212 | ||
| @@ -742,21 +742,18 @@ static int tuner_resume(struct device *dev) | |||
| 742 | /* ----------------------------------------------------------------------- */ | 742 | /* ----------------------------------------------------------------------- */ |
| 743 | 743 | ||
| 744 | static struct i2c_driver driver = { | 744 | static struct i2c_driver driver = { |
| 745 | .owner = THIS_MODULE, | ||
| 746 | .name = "tuner", | ||
| 747 | .id = I2C_DRIVERID_TUNER, | 745 | .id = I2C_DRIVERID_TUNER, |
| 748 | .flags = I2C_DF_NOTIFY, | ||
| 749 | .attach_adapter = tuner_probe, | 746 | .attach_adapter = tuner_probe, |
| 750 | .detach_client = tuner_detach, | 747 | .detach_client = tuner_detach, |
| 751 | .command = tuner_command, | 748 | .command = tuner_command, |
| 752 | .driver = { | 749 | .driver = { |
| 750 | .name = "tuner", | ||
| 753 | .suspend = tuner_suspend, | 751 | .suspend = tuner_suspend, |
| 754 | .resume = tuner_resume, | 752 | .resume = tuner_resume, |
| 755 | }, | 753 | }, |
| 756 | }; | 754 | }; |
| 757 | static struct i2c_client client_template = { | 755 | static struct i2c_client client_template = { |
| 758 | .name = "(tuner unset)", | 756 | .name = "(tuner unset)", |
| 759 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 760 | .driver = &driver, | 757 | .driver = &driver, |
| 761 | }; | 758 | }; |
| 762 | 759 | ||
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 5b20e8177cad..0292c5abf14a 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
| @@ -1702,10 +1702,10 @@ static int chip_command(struct i2c_client *client, | |||
| 1702 | 1702 | ||
| 1703 | 1703 | ||
| 1704 | static struct i2c_driver driver = { | 1704 | static struct i2c_driver driver = { |
| 1705 | .owner = THIS_MODULE, | 1705 | .driver = { |
| 1706 | .name = "generic i2c audio driver", | 1706 | .name = "generic i2c audio driver", |
| 1707 | }, | ||
| 1707 | .id = I2C_DRIVERID_TVAUDIO, | 1708 | .id = I2C_DRIVERID_TVAUDIO, |
| 1708 | .flags = I2C_DF_NOTIFY, | ||
| 1709 | .attach_adapter = chip_probe, | 1709 | .attach_adapter = chip_probe, |
| 1710 | .detach_client = chip_detach, | 1710 | .detach_client = chip_detach, |
| 1711 | .command = chip_command, | 1711 | .command = chip_command, |
| @@ -1714,7 +1714,6 @@ static struct i2c_driver driver = { | |||
| 1714 | static struct i2c_client client_template = | 1714 | static struct i2c_client client_template = |
| 1715 | { | 1715 | { |
| 1716 | .name = "(unset)", | 1716 | .name = "(unset)", |
| 1717 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 1718 | .driver = &driver, | 1717 | .driver = &driver, |
| 1719 | }; | 1718 | }; |
| 1720 | 1719 | ||
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 5ac235365dd8..8ac4cb82a459 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
| @@ -751,7 +751,6 @@ tveeprom_detect_client(struct i2c_adapter *adapter, | |||
| 751 | client->addr = address; | 751 | client->addr = address; |
| 752 | client->adapter = adapter; | 752 | client->adapter = adapter; |
| 753 | client->driver = &i2c_driver_tveeprom; | 753 | client->driver = &i2c_driver_tveeprom; |
| 754 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 755 | snprintf(client->name, sizeof(client->name), "tveeprom"); | 754 | snprintf(client->name, sizeof(client->name), "tveeprom"); |
| 756 | i2c_attach_client(client); | 755 | i2c_attach_client(client); |
| 757 | 756 | ||
| @@ -779,10 +778,10 @@ tveeprom_detach_client (struct i2c_client *client) | |||
| 779 | } | 778 | } |
| 780 | 779 | ||
| 781 | static struct i2c_driver i2c_driver_tveeprom = { | 780 | static struct i2c_driver i2c_driver_tveeprom = { |
| 782 | .owner = THIS_MODULE, | 781 | .driver = { |
| 783 | .name = "tveeprom", | 782 | .name = "tveeprom", |
| 783 | }, | ||
| 784 | .id = I2C_DRIVERID_TVEEPROM, | 784 | .id = I2C_DRIVERID_TVEEPROM, |
| 785 | .flags = I2C_DF_NOTIFY, | ||
| 786 | .attach_adapter = tveeprom_attach_adapter, | 785 | .attach_adapter = tveeprom_attach_adapter, |
| 787 | .detach_client = tveeprom_detach_client, | 786 | .detach_client = tveeprom_detach_client, |
| 788 | .command = tveeprom_command, | 787 | .command = tveeprom_command, |
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index 8318bd1aad00..e837f9f7fed6 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c | |||
| @@ -228,16 +228,14 @@ static int tvmixer_release(struct inode *inode, struct file *file) | |||
| 228 | 228 | ||
| 229 | static struct i2c_driver driver = { | 229 | static struct i2c_driver driver = { |
| 230 | #ifdef I2C_PEC | 230 | #ifdef I2C_PEC |
| 231 | .owner = THIS_MODULE, | 231 | .driver = { |
| 232 | #endif | 232 | .name = "tv card mixer driver", |
| 233 | }, | ||
| 234 | #else | ||
| 233 | .name = "tv card mixer driver", | 235 | .name = "tv card mixer driver", |
| 236 | #endif | ||
| 234 | .id = I2C_DRIVERID_TVMIXER, | 237 | .id = I2C_DRIVERID_TVMIXER, |
| 235 | #ifdef I2C_DF_DUMMY | ||
| 236 | .flags = I2C_DF_DUMMY, | ||
| 237 | #else | ||
| 238 | .flags = I2C_DF_NOTIFY, | ||
| 239 | .detach_adapter = tvmixer_adapters, | 238 | .detach_adapter = tvmixer_adapters, |
| 240 | #endif | ||
| 241 | .attach_adapter = tvmixer_adapters, | 239 | .attach_adapter = tvmixer_adapters, |
| 242 | .detach_client = tvmixer_clients, | 240 | .detach_client = tvmixer_clients, |
| 243 | }; | 241 | }; |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 97431e26d229..a60442ea4f94 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
| @@ -714,7 +714,6 @@ static struct i2c_driver driver; | |||
| 714 | 714 | ||
| 715 | static struct i2c_client client_template = { | 715 | static struct i2c_client client_template = { |
| 716 | .name = "(unset)", | 716 | .name = "(unset)", |
| 717 | .flags = I2C_CLIENT_ALLOW_USE, | ||
| 718 | .driver = &driver, | 717 | .driver = &driver, |
| 719 | }; | 718 | }; |
| 720 | 719 | ||
| @@ -801,12 +800,12 @@ static int tvp5150_detach_client(struct i2c_client *client) | |||
| 801 | /* ----------------------------------------------------------------------- */ | 800 | /* ----------------------------------------------------------------------- */ |
| 802 | 801 | ||
| 803 | static struct i2c_driver driver = { | 802 | static struct i2c_driver driver = { |
| 804 | .owner = THIS_MODULE, | 803 | .driver = { |
| 805 | .name = "tvp5150", | 804 | .name = "tvp5150", |
| 805 | }, | ||
| 806 | 806 | ||
| 807 | /* FIXME */ | 807 | /* FIXME */ |
| 808 | .id = I2C_DRIVERID_SAA7110, | 808 | .id = I2C_DRIVERID_SAA7110, |
| 809 | .flags = I2C_DF_NOTIFY, | ||
| 810 | 809 | ||
| 811 | .attach_adapter = tvp5150_attach_adapter, | 810 | .attach_adapter = tvp5150_attach_adapter, |
| 812 | .detach_client = tvp5150_detach_client, | 811 | .detach_client = tvp5150_detach_client, |
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 137b58f2c666..8dcee8b60e21 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
| @@ -631,7 +631,6 @@ vpx3220_detect_client (struct i2c_adapter *adapter, | |||
| 631 | client->addr = address; | 631 | client->addr = address; |
| 632 | client->adapter = adapter; | 632 | client->adapter = adapter; |
| 633 | client->driver = &vpx3220_i2c_driver; | 633 | client->driver = &vpx3220_i2c_driver; |
| 634 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 635 | 634 | ||
| 636 | /* Check for manufacture ID and part number */ | 635 | /* Check for manufacture ID and part number */ |
| 637 | if (kind < 0) { | 636 | if (kind < 0) { |
| @@ -722,11 +721,11 @@ vpx3220_attach_adapter (struct i2c_adapter *adapter) | |||
| 722 | */ | 721 | */ |
| 723 | 722 | ||
| 724 | static struct i2c_driver vpx3220_i2c_driver = { | 723 | static struct i2c_driver vpx3220_i2c_driver = { |
| 725 | .owner = THIS_MODULE, | 724 | .driver = { |
| 726 | .name = "vpx3220", | 725 | .name = "vpx3220", |
| 726 | }, | ||
| 727 | 727 | ||
| 728 | .id = I2C_DRIVERID_VPX3220, | 728 | .id = I2C_DRIVERID_VPX3220, |
| 729 | .flags = I2C_DF_NOTIFY, | ||
| 730 | 729 | ||
| 731 | .attach_adapter = vpx3220_attach_adapter, | 730 | .attach_adapter = vpx3220_attach_adapter, |
| 732 | .detach_client = vpx3220_detach_client, | 731 | .detach_client = vpx3220_detach_client, |
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index a6936ad74fcf..bbfd55cd9948 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
| @@ -40,10 +40,10 @@ MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); | |||
| 40 | MODULE_LICENSE("GPL"); | 40 | MODULE_LICENSE("GPL"); |
| 41 | 41 | ||
| 42 | #define wm8775_err(fmt, arg...) do { \ | 42 | #define wm8775_err(fmt, arg...) do { \ |
| 43 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ | 43 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 44 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 44 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 45 | #define wm8775_info(fmt, arg...) do { \ | 45 | #define wm8775_info(fmt, arg...) do { \ |
| 46 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ | 46 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ |
| 47 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) | 47 | i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) |
| 48 | 48 | ||
| 49 | 49 | ||
| @@ -168,7 +168,6 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind) | |||
| 168 | client->addr = address; | 168 | client->addr = address; |
| 169 | client->adapter = adapter; | 169 | client->adapter = adapter; |
| 170 | client->driver = &i2c_driver; | 170 | client->driver = &i2c_driver; |
| 171 | client->flags = I2C_CLIENT_ALLOW_USE; | ||
| 172 | snprintf(client->name, sizeof(client->name) - 1, "wm8775"); | 171 | snprintf(client->name, sizeof(client->name) - 1, "wm8775"); |
| 173 | 172 | ||
| 174 | wm8775_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); | 173 | wm8775_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); |
| @@ -233,15 +232,15 @@ static int wm8775_detach(struct i2c_client *client) | |||
| 233 | 232 | ||
| 234 | /* i2c implementation */ | 233 | /* i2c implementation */ |
| 235 | static struct i2c_driver i2c_driver = { | 234 | static struct i2c_driver i2c_driver = { |
| 236 | .name = "wm8775", | 235 | .driver = { |
| 236 | .name = "wm8775", | ||
| 237 | }, | ||
| 237 | 238 | ||
| 238 | .id = I2C_DRIVERID_WM8775, | 239 | .id = I2C_DRIVERID_WM8775, |
| 239 | .flags = I2C_DF_NOTIFY, | ||
| 240 | 240 | ||
| 241 | .attach_adapter = wm8775_probe, | 241 | .attach_adapter = wm8775_probe, |
| 242 | .detach_client = wm8775_detach, | 242 | .detach_client = wm8775_detach, |
| 243 | .command = wm8775_command, | 243 | .command = wm8775_command, |
| 244 | .owner = THIS_MODULE, | ||
| 245 | }; | 244 | }; |
| 246 | 245 | ||
| 247 | 246 | ||
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 07bde9acd672..4034f1b45366 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
| @@ -1311,7 +1311,7 @@ zoran_open (struct inode *inode, | |||
| 1311 | res = -ENODEV; | 1311 | res = -ENODEV; |
| 1312 | goto open_unlock_and_return; | 1312 | goto open_unlock_and_return; |
| 1313 | } | 1313 | } |
| 1314 | if (!try_module_get(zr->decoder->driver->owner)) { | 1314 | if (!try_module_get(zr->decoder->driver->driver.owner)) { |
| 1315 | dprintk(1, | 1315 | dprintk(1, |
| 1316 | KERN_ERR | 1316 | KERN_ERR |
| 1317 | "%s: failed to grab ownership of i2c decoder\n", | 1317 | "%s: failed to grab ownership of i2c decoder\n", |
| @@ -1321,13 +1321,13 @@ zoran_open (struct inode *inode, | |||
| 1321 | goto open_unlock_and_return; | 1321 | goto open_unlock_and_return; |
| 1322 | } | 1322 | } |
| 1323 | if (zr->encoder && | 1323 | if (zr->encoder && |
| 1324 | !try_module_get(zr->encoder->driver->owner)) { | 1324 | !try_module_get(zr->encoder->driver->driver.owner)) { |
| 1325 | dprintk(1, | 1325 | dprintk(1, |
| 1326 | KERN_ERR | 1326 | KERN_ERR |
| 1327 | "%s: failed to grab ownership of i2c encoder\n", | 1327 | "%s: failed to grab ownership of i2c encoder\n", |
| 1328 | ZR_DEVNAME(zr)); | 1328 | ZR_DEVNAME(zr)); |
| 1329 | res = -EIO; | 1329 | res = -EIO; |
| 1330 | module_put(zr->decoder->driver->owner); | 1330 | module_put(zr->decoder->driver->driver.owner); |
| 1331 | module_put(THIS_MODULE); | 1331 | module_put(THIS_MODULE); |
| 1332 | goto open_unlock_and_return; | 1332 | goto open_unlock_and_return; |
| 1333 | } | 1333 | } |
| @@ -1393,9 +1393,9 @@ zoran_open (struct inode *inode, | |||
| 1393 | open_unlock_and_return: | 1393 | open_unlock_and_return: |
| 1394 | /* if we grabbed locks, release them accordingly */ | 1394 | /* if we grabbed locks, release them accordingly */ |
| 1395 | if (have_module_locks) { | 1395 | if (have_module_locks) { |
| 1396 | module_put(zr->decoder->driver->owner); | 1396 | module_put(zr->decoder->driver->driver.owner); |
| 1397 | if (zr->encoder) { | 1397 | if (zr->encoder) { |
| 1398 | module_put(zr->encoder->driver->owner); | 1398 | module_put(zr->encoder->driver->driver.owner); |
| 1399 | } | 1399 | } |
| 1400 | module_put(THIS_MODULE); | 1400 | module_put(THIS_MODULE); |
| 1401 | } | 1401 | } |
| @@ -1461,9 +1461,9 @@ zoran_close (struct inode *inode, | |||
| 1461 | kfree(fh); | 1461 | kfree(fh); |
| 1462 | 1462 | ||
| 1463 | /* release locks on the i2c modules */ | 1463 | /* release locks on the i2c modules */ |
| 1464 | module_put(zr->decoder->driver->owner); | 1464 | module_put(zr->decoder->driver->driver.owner); |
| 1465 | if (zr->encoder) { | 1465 | if (zr->encoder) { |
| 1466 | module_put(zr->encoder->driver->owner); | 1466 | module_put(zr->encoder->driver->driver.owner); |
| 1467 | } | 1467 | } |
| 1468 | module_put(THIS_MODULE); | 1468 | module_put(THIS_MODULE); |
| 1469 | 1469 | ||
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index 04d69339c054..3605a6f3067b 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c | |||
| @@ -1533,12 +1533,12 @@ static int w9968cf_i2c_attach_inform(struct i2c_client* client) | |||
| 1533 | } | 1533 | } |
| 1534 | } else { | 1534 | } else { |
| 1535 | DBG(4, "Rejected client [%s] with driver [%s]", | 1535 | DBG(4, "Rejected client [%s] with driver [%s]", |
| 1536 | client->name, client->driver->name) | 1536 | client->name, client->driver->driver.name) |
| 1537 | return -EINVAL; | 1537 | return -EINVAL; |
| 1538 | } | 1538 | } |
| 1539 | 1539 | ||
| 1540 | DBG(5, "I2C attach client [%s] with driver [%s]", | 1540 | DBG(5, "I2C attach client [%s] with driver [%s]", |
| 1541 | client->name, client->driver->name) | 1541 | client->name, client->driver->driver.name) |
| 1542 | 1542 | ||
| 1543 | return 0; | 1543 | return 0; |
| 1544 | } | 1544 | } |
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index ad60bbb16cdf..a1f2c5e8fc88 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c | |||
| @@ -1288,18 +1288,13 @@ static int maven_detach_client(struct i2c_client* client) { | |||
| 1288 | return 0; | 1288 | return 0; |
| 1289 | } | 1289 | } |
| 1290 | 1290 | ||
| 1291 | static int maven_command(struct i2c_client* client, unsigned int cmd, void* arg) { | ||
| 1292 | return -ENOIOCTLCMD; /* or -EINVAL, depends on who will call this */ | ||
| 1293 | } | ||
| 1294 | |||
| 1295 | static struct i2c_driver maven_driver={ | 1291 | static struct i2c_driver maven_driver={ |
| 1296 | .owner = THIS_MODULE, | 1292 | .driver = { |
| 1297 | .name = "maven", | 1293 | .name = "maven", |
| 1294 | }, | ||
| 1298 | .id = I2C_DRIVERID_MGATVO, | 1295 | .id = I2C_DRIVERID_MGATVO, |
| 1299 | .flags = I2C_DF_NOTIFY, | ||
| 1300 | .attach_adapter = maven_attach_adapter, | 1296 | .attach_adapter = maven_attach_adapter, |
| 1301 | .detach_client = maven_detach_client, | 1297 | .detach_client = maven_detach_client, |
| 1302 | .command = maven_command, | ||
| 1303 | }; | 1298 | }; |
| 1304 | 1299 | ||
| 1305 | /* ************************** */ | 1300 | /* ************************** */ |
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h index cd4b7a042b86..f346e4d5381c 100644 --- a/include/linux/hwmon-vid.h +++ b/include/linux/hwmon-vid.h | |||
| @@ -23,14 +23,14 @@ | |||
| 23 | #ifndef _LINUX_HWMON_VID_H | 23 | #ifndef _LINUX_HWMON_VID_H |
| 24 | #define _LINUX_HWMON_VID_H | 24 | #define _LINUX_HWMON_VID_H |
| 25 | 25 | ||
| 26 | int vid_from_reg(int val, int vrm); | 26 | int vid_from_reg(int val, u8 vrm); |
| 27 | int vid_which_vrm(void); | 27 | u8 vid_which_vrm(void); |
| 28 | 28 | ||
| 29 | /* vrm is the VRM/VRD document version multiplied by 10. | 29 | /* vrm is the VRM/VRD document version multiplied by 10. |
| 30 | val is in mV to avoid floating point in the kernel. | 30 | val is in mV to avoid floating point in the kernel. |
| 31 | Returned value is the 4-, 5- or 6-bit VID code. | 31 | Returned value is the 4-, 5- or 6-bit VID code. |
| 32 | Note that only VRM 9.x is supported for now. */ | 32 | Note that only VRM 9.x is supported for now. */ |
| 33 | static inline int vid_to_reg(int val, int vrm) | 33 | static inline int vid_to_reg(int val, u8 vrm) |
| 34 | { | 34 | { |
| 35 | switch (vrm) { | 35 | switch (vrm) { |
| 36 | case 91: /* VRM 9.1 */ | 36 | case 91: /* VRM 9.1 */ |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 006c81ef4d50..fb46f8d56999 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
| @@ -25,12 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | /* | 26 | /* |
| 27 | * ---- Driver types ----------------------------------------------------- | 27 | * ---- Driver types ----------------------------------------------------- |
| 28 | * device id name + number function description, i2c address(es) | ||
| 29 | * | ||
| 30 | * Range 1000-1999 range is defined in sensors/sensors.h | ||
| 31 | * Range 0x100 - 0x1ff is for V4L2 Common Components | ||
| 32 | * Range 0xf000 - 0xffff is reserved for local experimentation, and should | ||
| 33 | * never be used in official drivers | ||
| 34 | */ | 28 | */ |
| 35 | 29 | ||
| 36 | #define I2C_DRIVERID_MSP3400 1 | 30 | #define I2C_DRIVERID_MSP3400 1 |
| @@ -110,13 +104,7 @@ | |||
| 110 | #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ | 104 | #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ |
| 111 | #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ | 105 | #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ |
| 112 | 106 | ||
| 113 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ | ||
| 114 | #define I2C_DRIVERID_EXP1 0xF1 | ||
| 115 | #define I2C_DRIVERID_EXP2 0xF2 | ||
| 116 | #define I2C_DRIVERID_EXP3 0xF3 | ||
| 117 | |||
| 118 | #define I2C_DRIVERID_I2CDEV 900 | 107 | #define I2C_DRIVERID_I2CDEV 900 |
| 119 | #define I2C_DRIVERID_I2CPROC 901 | ||
| 120 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ | 108 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ |
| 121 | #define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ | 109 | #define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ |
| 122 | 110 | ||
| @@ -131,15 +119,12 @@ | |||
| 131 | #define I2C_DRIVERID_ADM1021 1008 | 119 | #define I2C_DRIVERID_ADM1021 1008 |
| 132 | #define I2C_DRIVERID_ADM9240 1009 | 120 | #define I2C_DRIVERID_ADM9240 1009 |
| 133 | #define I2C_DRIVERID_LTC1710 1010 | 121 | #define I2C_DRIVERID_LTC1710 1010 |
| 134 | #define I2C_DRIVERID_SIS5595 1011 | ||
| 135 | #define I2C_DRIVERID_ICSPLL 1012 | 122 | #define I2C_DRIVERID_ICSPLL 1012 |
| 136 | #define I2C_DRIVERID_BT869 1013 | 123 | #define I2C_DRIVERID_BT869 1013 |
| 137 | #define I2C_DRIVERID_MAXILIFE 1014 | 124 | #define I2C_DRIVERID_MAXILIFE 1014 |
| 138 | #define I2C_DRIVERID_MATORB 1015 | 125 | #define I2C_DRIVERID_MATORB 1015 |
| 139 | #define I2C_DRIVERID_GL520 1016 | 126 | #define I2C_DRIVERID_GL520 1016 |
| 140 | #define I2C_DRIVERID_THMC50 1017 | 127 | #define I2C_DRIVERID_THMC50 1017 |
| 141 | #define I2C_DRIVERID_DDCMON 1018 | ||
| 142 | #define I2C_DRIVERID_VIA686A 1019 | ||
| 143 | #define I2C_DRIVERID_ADM1025 1020 | 128 | #define I2C_DRIVERID_ADM1025 1020 |
| 144 | #define I2C_DRIVERID_LM87 1021 | 129 | #define I2C_DRIVERID_LM87 1021 |
| 145 | #define I2C_DRIVERID_PCF8574 1022 | 130 | #define I2C_DRIVERID_PCF8574 1022 |
| @@ -151,21 +136,16 @@ | |||
| 151 | #define I2C_DRIVERID_FSCPOS 1028 | 136 | #define I2C_DRIVERID_FSCPOS 1028 |
| 152 | #define I2C_DRIVERID_FSCSCY 1029 | 137 | #define I2C_DRIVERID_FSCSCY 1029 |
| 153 | #define I2C_DRIVERID_PCF8591 1030 | 138 | #define I2C_DRIVERID_PCF8591 1030 |
| 154 | #define I2C_DRIVERID_SMSC47M1 1031 | ||
| 155 | #define I2C_DRIVERID_VT1211 1032 | ||
| 156 | #define I2C_DRIVERID_LM92 1033 | 139 | #define I2C_DRIVERID_LM92 1033 |
| 157 | #define I2C_DRIVERID_VT8231 1034 | ||
| 158 | #define I2C_DRIVERID_SMARTBATT 1035 | 140 | #define I2C_DRIVERID_SMARTBATT 1035 |
| 159 | #define I2C_DRIVERID_BMCSENSORS 1036 | 141 | #define I2C_DRIVERID_BMCSENSORS 1036 |
| 160 | #define I2C_DRIVERID_FS451 1037 | 142 | #define I2C_DRIVERID_FS451 1037 |
| 161 | #define I2C_DRIVERID_W83627HF 1038 | ||
| 162 | #define I2C_DRIVERID_LM85 1039 | 143 | #define I2C_DRIVERID_LM85 1039 |
| 163 | #define I2C_DRIVERID_LM83 1040 | 144 | #define I2C_DRIVERID_LM83 1040 |
| 164 | #define I2C_DRIVERID_LM90 1042 | 145 | #define I2C_DRIVERID_LM90 1042 |
| 165 | #define I2C_DRIVERID_ASB100 1043 | 146 | #define I2C_DRIVERID_ASB100 1043 |
| 166 | #define I2C_DRIVERID_FSCHER 1046 | 147 | #define I2C_DRIVERID_FSCHER 1046 |
| 167 | #define I2C_DRIVERID_W83L785TS 1047 | 148 | #define I2C_DRIVERID_W83L785TS 1047 |
| 168 | #define I2C_DRIVERID_SMSC47B397 1050 | ||
| 169 | 149 | ||
| 170 | /* | 150 | /* |
| 171 | * ---- Adapter types ---------------------------------------------------- | 151 | * ---- Adapter types ---------------------------------------------------- |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 5e19a7ba69b2..7863a59bd598 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -105,14 +105,14 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | |||
| 105 | * A driver is capable of handling one or more physical devices present on | 105 | * A driver is capable of handling one or more physical devices present on |
| 106 | * I2C adapters. This information is used to inform the driver of adapter | 106 | * I2C adapters. This information is used to inform the driver of adapter |
| 107 | * events. | 107 | * events. |
| 108 | * | ||
| 109 | * The driver.owner field should be set to the module owner of this driver. | ||
| 110 | * The driver.name field should be set to the name of this driver. | ||
| 108 | */ | 111 | */ |
| 109 | 112 | ||
| 110 | struct i2c_driver { | 113 | struct i2c_driver { |
| 111 | struct module *owner; | ||
| 112 | char name[32]; | ||
| 113 | int id; | 114 | int id; |
| 114 | unsigned int class; | 115 | unsigned int class; |
| 115 | unsigned int flags; /* div., see below */ | ||
| 116 | 116 | ||
| 117 | /* Notifies the driver that a new bus has appeared. This routine | 117 | /* Notifies the driver that a new bus has appeared. This routine |
| 118 | * can be used by the driver to test if the bus meets its conditions | 118 | * can be used by the driver to test if the bus meets its conditions |
| @@ -250,18 +250,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) | |||
| 250 | dev_set_drvdata (&dev->dev, data); | 250 | dev_set_drvdata (&dev->dev, data); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | /*flags for the driver struct: */ | ||
| 254 | #define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ | ||
| 255 | #if 0 | ||
| 256 | /* this flag is gone -- there is a (optional) driver->detach_adapter | ||
| 257 | * callback now which can be used instead */ | ||
| 258 | # define I2C_DF_DUMMY 0x02 | ||
| 259 | #endif | ||
| 260 | |||
| 261 | /*flags for the client struct: */ | 253 | /*flags for the client struct: */ |
| 262 | #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ | ||
| 263 | #define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */ | ||
| 264 | /* on an i2c_client */ | ||
| 265 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ | 254 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ |
| 266 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ | 255 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ |
| 267 | /* Must equal I2C_M_TEN below */ | 256 | /* Must equal I2C_M_TEN below */ |
| @@ -302,26 +291,20 @@ struct i2c_client_address_data { | |||
| 302 | extern int i2c_add_adapter(struct i2c_adapter *); | 291 | extern int i2c_add_adapter(struct i2c_adapter *); |
| 303 | extern int i2c_del_adapter(struct i2c_adapter *); | 292 | extern int i2c_del_adapter(struct i2c_adapter *); |
| 304 | 293 | ||
| 305 | extern int i2c_add_driver(struct i2c_driver *); | 294 | extern int i2c_register_driver(struct module *, struct i2c_driver *); |
| 306 | extern int i2c_del_driver(struct i2c_driver *); | 295 | extern int i2c_del_driver(struct i2c_driver *); |
| 307 | 296 | ||
| 297 | static inline int i2c_add_driver(struct i2c_driver *driver) | ||
| 298 | { | ||
| 299 | return i2c_register_driver(THIS_MODULE, driver); | ||
| 300 | } | ||
| 301 | |||
| 308 | extern int i2c_attach_client(struct i2c_client *); | 302 | extern int i2c_attach_client(struct i2c_client *); |
| 309 | extern int i2c_detach_client(struct i2c_client *); | 303 | extern int i2c_detach_client(struct i2c_client *); |
| 310 | 304 | ||
| 311 | /* New function: This is to get an i2c_client-struct for controlling the | 305 | /* Should be used to make sure that client-struct is valid and that it |
| 312 | client either by using i2c_control-function or having the | 306 | is okay to access the i2c-client. |
| 313 | client-module export functions that can be used with the i2c_client | 307 | returns -ENODEV if client has gone in the meantime */ |
| 314 | -struct. */ | ||
| 315 | extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, | ||
| 316 | struct i2c_client *prev); | ||
| 317 | |||
| 318 | /* Should be used with new function | ||
| 319 | extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *); | ||
| 320 | to make sure that client-struct is valid and that it is okay to access | ||
| 321 | the i2c-client. | ||
| 322 | returns -EACCES if client doesn't allow use (default) | ||
| 323 | returns -EBUSY if client doesn't allow multiple use (default) and | ||
| 324 | usage_count >0 */ | ||
| 325 | extern int i2c_use_client(struct i2c_client *); | 308 | extern int i2c_use_client(struct i2c_client *); |
| 326 | extern int i2c_release_client(struct i2c_client *); | 309 | extern int i2c_release_client(struct i2c_client *); |
| 327 | 310 | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 24db7248301a..a213e999de31 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -986,6 +986,7 @@ | |||
| 986 | #define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a | 986 | #define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a |
| 987 | #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C | 987 | #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C |
| 988 | #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D | 988 | #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D |
| 989 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 | ||
| 989 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 | 990 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 |
| 990 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 | 991 | #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 |
| 991 | #define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 | 992 | #define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 |
diff --git a/include/media/tuner.h b/include/media/tuner.h index faa0f8e3091b..b37cde606692 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
| @@ -218,14 +218,15 @@ extern int default_tuner_init(struct i2c_client *c); | |||
| 218 | extern int tea5767_autodetection(struct i2c_client *c); | 218 | extern int tea5767_autodetection(struct i2c_client *c); |
| 219 | 219 | ||
| 220 | #define tuner_warn(fmt, arg...) do {\ | 220 | #define tuner_warn(fmt, arg...) do {\ |
| 221 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ | 221 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ |
| 222 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | 222 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
| 223 | #define tuner_info(fmt, arg...) do {\ | 223 | #define tuner_info(fmt, arg...) do {\ |
| 224 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ | 224 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ |
| 225 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | 225 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
| 226 | #define tuner_dbg(fmt, arg...) do {\ | 226 | #define tuner_dbg(fmt, arg...) do {\ |
| 227 | if (tuner_debug) \ | 227 | if (tuner_debug) \ |
| 228 | printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ | 228 | printk(KERN_DEBUG "%s %d-%04x: " fmt, \ |
| 229 | t->i2c.driver->driver.name, \ | ||
| 229 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) | 230 | t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) |
| 230 | 231 | ||
| 231 | #endif /* __KERNEL__ */ | 232 | #endif /* __KERNEL__ */ |
diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c index 533895eba0eb..7360d8954d60 100644 --- a/sound/oss/dmasound/dac3550a.c +++ b/sound/oss/dmasound/dac3550a.c | |||
| @@ -41,10 +41,10 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address); | |||
| 41 | static int daca_detach_client(struct i2c_client *client); | 41 | static int daca_detach_client(struct i2c_client *client); |
| 42 | 42 | ||
| 43 | struct i2c_driver daca_driver = { | 43 | struct i2c_driver daca_driver = { |
| 44 | .owner = THIS_MODULE, | 44 | .driver = { |
| 45 | .name = "DAC3550A driver V " DACA_VERSION, | 45 | .name = "DAC3550A driver V " DACA_VERSION, |
| 46 | }, | ||
| 46 | .id = I2C_DRIVERID_DACA, | 47 | .id = I2C_DRIVERID_DACA, |
| 47 | .flags = I2C_DF_NOTIFY, | ||
| 48 | .attach_adapter = daca_attach_adapter, | 48 | .attach_adapter = daca_attach_adapter, |
| 49 | .detach_client = daca_detach_client, | 49 | .detach_client = daca_detach_client, |
| 50 | }; | 50 | }; |
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index d36a1fe2fcf3..81315996c0f1 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c | |||
| @@ -47,9 +47,9 @@ static int tas_attach_adapter(struct i2c_adapter *); | |||
| 47 | static int tas_detach_client(struct i2c_client *); | 47 | static int tas_detach_client(struct i2c_client *); |
| 48 | 48 | ||
| 49 | struct i2c_driver tas_driver = { | 49 | struct i2c_driver tas_driver = { |
| 50 | .owner = THIS_MODULE, | 50 | .driver = { |
| 51 | .name = "tas", | 51 | .name = "tas", |
| 52 | .flags = I2C_DF_NOTIFY, | 52 | }, |
| 53 | .attach_adapter = tas_attach_adapter, | 53 | .attach_adapter = tas_attach_adapter, |
| 54 | .detach_client = tas_detach_client, | 54 | .detach_client = tas_detach_client, |
| 55 | }; | 55 | }; |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 097fbcfc5d45..6058c2dd1b7f 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
| @@ -41,9 +41,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter); | |||
| 41 | static int keywest_detach_client(struct i2c_client *client); | 41 | static int keywest_detach_client(struct i2c_client *client); |
| 42 | 42 | ||
| 43 | struct i2c_driver keywest_driver = { | 43 | struct i2c_driver keywest_driver = { |
| 44 | .name = "PMac Keywest Audio", | 44 | .driver = { |
| 45 | .name = "PMac Keywest Audio", | ||
| 46 | }, | ||
| 45 | .id = I2C_DRIVERID_KEYWEST, | 47 | .id = I2C_DRIVERID_KEYWEST, |
| 46 | .flags = I2C_DF_NOTIFY, | ||
| 47 | .attach_adapter = &keywest_attach_adapter, | 48 | .attach_adapter = &keywest_attach_adapter, |
| 48 | .detach_client = &keywest_detach_client, | 49 | .detach_client = &keywest_detach_client, |
| 49 | }; | 50 | }; |
