aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLaurent Pinchart <laurentp@cse-semaphore.com>2008-10-16 01:02:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:39 -0400
commit5d5b4d74f9ae85bbd558a708678b6927f962e75d (patch)
treebead77fa3632aeca986a8a097143ad58b88efe85 /drivers
parent8d7b48e0bc5fa01a818eac713d4cb0763090cd0e (diff)
rtc-pcf8563: remove client validation
Validating clients with black magic register checks doesn't make much sense for new-style i2c driver and has been known to fail on valid NXP pcf8563 chips. This patch removes the client validation code. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-pcf8563.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 748a502a6355..a829f20ad6d6 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -179,58 +179,6 @@ struct pcf8563_limit
179 unsigned char max; 179 unsigned char max;
180}; 180};
181 181
182static int pcf8563_validate_client(struct i2c_client *client)
183{
184 int i;
185
186 static const struct pcf8563_limit pattern[] = {
187 /* register, mask, min, max */
188 { PCF8563_REG_SC, 0x7F, 0, 59 },
189 { PCF8563_REG_MN, 0x7F, 0, 59 },
190 { PCF8563_REG_HR, 0x3F, 0, 23 },
191 { PCF8563_REG_DM, 0x3F, 0, 31 },
192 { PCF8563_REG_MO, 0x1F, 0, 12 },
193 };
194
195 /* check limits (only registers with bcd values) */
196 for (i = 0; i < ARRAY_SIZE(pattern); i++) {
197 int xfer;
198 unsigned char value;
199 unsigned char buf = pattern[i].reg;
200
201 struct i2c_msg msgs[] = {
202 { client->addr, 0, 1, &buf },
203 { client->addr, I2C_M_RD, 1, &buf },
204 };
205
206 xfer = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
207
208 if (xfer != ARRAY_SIZE(msgs)) {
209 dev_err(&client->dev,
210 "%s: could not read register 0x%02X\n",
211 __func__, pattern[i].reg);
212
213 return -EIO;
214 }
215
216 value = BCD2BIN(buf & pattern[i].mask);
217
218 if (value > pattern[i].max ||
219 value < pattern[i].min) {
220 dev_dbg(&client->dev,
221 "%s: pattern=%d, reg=%x, mask=0x%02x, min=%d, "
222 "max=%d, value=%d, raw=0x%02X\n",
223 __func__, i, pattern[i].reg, pattern[i].mask,
224 pattern[i].min, pattern[i].max,
225 value, buf);
226
227 return -ENODEV;
228 }
229 }
230
231 return 0;
232}
233
234static int pcf8563_rtc_read_time(struct device *dev, struct rtc_time *tm) 182static int pcf8563_rtc_read_time(struct device *dev, struct rtc_time *tm)
235{ 183{
236 return pcf8563_get_datetime(to_i2c_client(dev), tm); 184 return pcf8563_get_datetime(to_i2c_client(dev), tm);
@@ -262,12 +210,6 @@ static int pcf8563_probe(struct i2c_client *client,
262 if (!pcf8563) 210 if (!pcf8563)
263 return -ENOMEM; 211 return -ENOMEM;
264 212
265 /* Verify the chip is really an PCF8563 */
266 if (pcf8563_validate_client(client) < 0) {
267 err = -ENODEV;
268 goto exit_kfree;
269 }
270
271 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); 213 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
272 214
273 pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name, 215 pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name,