diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-15 21:07:59 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-15 21:07:59 -0400 |
commit | 84c3d4aaec3338201b449034beac41635866bddf (patch) | |
tree | 3412951682fb2dd4feb8a5532f8efbaf8b345933 /drivers/i2c/chips/pca9539.c | |
parent | 43d2548bb2ef7e6d753f91468a746784041e522d (diff) | |
parent | fafa3a3f16723997f039a0193997464d66dafd8f (diff) |
Merge commit 'origin/master'
Manual merge of:
arch/powerpc/Kconfig
arch/powerpc/kernel/stacktrace.c
arch/powerpc/mm/slice.c
arch/ppc/kernel/smp.c
Diffstat (limited to 'drivers/i2c/chips/pca9539.c')
-rw-r--r-- | drivers/i2c/chips/pca9539.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index f43c4e79b55e..58ab7f26be26 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c | |||
@@ -113,7 +113,7 @@ static int pca9539_attach_adapter(struct i2c_adapter *adapter) | |||
113 | /* This function is called by i2c_probe */ | 113 | /* This function is called by i2c_probe */ |
114 | static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) | 114 | static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) |
115 | { | 115 | { |
116 | struct i2c_client *new_client; | 116 | struct i2c_client *client; |
117 | struct pca9539_data *data; | 117 | struct pca9539_data *data; |
118 | int err = 0; | 118 | int err = 0; |
119 | 119 | ||
@@ -127,29 +127,28 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) | |||
127 | goto exit; | 127 | goto exit; |
128 | } | 128 | } |
129 | 129 | ||
130 | new_client = &data->client; | 130 | client = &data->client; |
131 | i2c_set_clientdata(new_client, data); | 131 | i2c_set_clientdata(client, data); |
132 | new_client->addr = address; | 132 | client->addr = address; |
133 | new_client->adapter = adapter; | 133 | client->adapter = adapter; |
134 | new_client->driver = &pca9539_driver; | 134 | client->driver = &pca9539_driver; |
135 | new_client->flags = 0; | ||
136 | 135 | ||
137 | if (kind < 0) { | 136 | if (kind < 0) { |
138 | /* Detection: the pca9539 only has 8 registers (0-7). | 137 | /* Detection: the pca9539 only has 8 registers (0-7). |
139 | A read of 7 should succeed, but a read of 8 should fail. */ | 138 | A read of 7 should succeed, but a read of 8 should fail. */ |
140 | if ((i2c_smbus_read_byte_data(new_client, 7) < 0) || | 139 | if ((i2c_smbus_read_byte_data(client, 7) < 0) || |
141 | (i2c_smbus_read_byte_data(new_client, 8) >= 0)) | 140 | (i2c_smbus_read_byte_data(client, 8) >= 0)) |
142 | goto exit_kfree; | 141 | goto exit_kfree; |
143 | } | 142 | } |
144 | 143 | ||
145 | strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE); | 144 | strlcpy(client->name, "pca9539", I2C_NAME_SIZE); |
146 | 145 | ||
147 | /* Tell the I2C layer a new client has arrived */ | 146 | /* Tell the I2C layer a new client has arrived */ |
148 | if ((err = i2c_attach_client(new_client))) | 147 | if ((err = i2c_attach_client(client))) |
149 | goto exit_kfree; | 148 | goto exit_kfree; |
150 | 149 | ||
151 | /* Register sysfs hooks */ | 150 | /* Register sysfs hooks */ |
152 | err = sysfs_create_group(&new_client->dev.kobj, | 151 | err = sysfs_create_group(&client->dev.kobj, |
153 | &pca9539_defattr_group); | 152 | &pca9539_defattr_group); |
154 | if (err) | 153 | if (err) |
155 | goto exit_detach; | 154 | goto exit_detach; |
@@ -157,7 +156,7 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) | |||
157 | return 0; | 156 | return 0; |
158 | 157 | ||
159 | exit_detach: | 158 | exit_detach: |
160 | i2c_detach_client(new_client); | 159 | i2c_detach_client(client); |
161 | exit_kfree: | 160 | exit_kfree: |
162 | kfree(data); | 161 | kfree(data); |
163 | exit: | 162 | exit: |