rtc-pcf8563: Remove client validation
Subsystems (2)
PATCH 1/1 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.
--- drivers/rtc/rtc-pcf8563.c | 58 --------------------------------------------- 1 files changed, 0 insertions(+), 58 deletions(-)
drivers/rtc/rtc-pcf8563.c +0 -58
@@ -179,58 +179,6 @@ struct pcf8563_limitunsigned char max; }; -static int pcf8563_validate_client (struct i2c_client *client) -{ -int i; - -static const struct pcf8563_limit pattern[] = { -/* register, mask, min, max */ - {PCF8563_REG_SC ,0x7F ,0 ,59 }, - {PCF8563_REG_MN ,0x7F ,0 ,59 }, - {PCF8563_REG_HR ,0x3F ,0 ,23 }, - {PCF8563_REG_DM ,0x3F ,0 ,31 }, - {PCF8563_REG_MO ,0x1F ,0 ,12 }, - }; - -/* check limits (only registers with bcd values) */ -for (i =0 ; i <ARRAY_SIZE (pattern); i++) { -int xfer; -unsigned char value; -unsigned char buf = pattern[i].reg; - -struct i2c_msg msgs[] = { - { client->addr,0 ,1 , &buf }, - { client->addr,I2C_M_RD ,1 , &buf }, - }; - - xfer =i2c_transfer (client->adapter, msgs,ARRAY_SIZE (msgs)); - -if (xfer !=ARRAY_SIZE (msgs)) { -dev_err (&client->dev, -"%s: could not read register 0x%02X\n" , - __func__, pattern[i].reg); - -return -EIO ; - } - - value =BCD2BIN (buf & pattern[i].mask); - -if (value > pattern[i].max || - value < pattern[i].min) { -dev_dbg (&client->dev, -"%s: pattern=%d, reg=%x, mask=0x%02x, min=%d, " -"max=%d, value=%d, raw=0x%02X\n" , - __func__, i, pattern[i].reg, pattern[i].mask, - pattern[i].min, pattern[i].max, - value, buf); - -return -ENODEV ; - } - } - -return 0 ; -} -static int pcf8563_rtc_read_time (struct device *dev,struct rtc_time *tm) {return pcf8563_get_datetime (to_i2c_client (dev), tm);
@@ -262,12 +210,6 @@ static int pcf8563_probe(struct i2c_client *client,if (!pcf8563)return -ENOMEM ; -/* Verify the chip is really an PCF8563 */ -if (pcf8563_validate_client (client) <0 ) { - err = -ENODEV ; - goto exit_kfree; - } -dev_info (&client->dev,"chip found, driver version " DRV_VERSION "\n" ); pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name,
Signature · 18 lines
1.5.0 -- Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75 _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Jean Delvare
Acked-byQuoted 9 lines · Laurent Pinchart
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.
--- drivers/rtc/rtc-pcf8563.c | 58 --------------------------------------------- 1 files changed, 0 insertions(+), 58 deletions(-)(...)
Thanks,
Signature · 6 lines
Jean Delvare _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
Hi Alexander,
Quoted 5 lines · Jean Delvare
Quoted 4 lines · Laurent Pinchart
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.
Quoted 7 lines
Quoted 5 lines
--- drivers/rtc/rtc-pcf8563.c | 58 --------------------------------------------- 1 files changed, 0 insertions(+), 58 deletions(-)(...)
Acked-by Jean Delvare <[email protected]>
Could you please push the patch for inclusion in 2.6.27 ?
Best regards,
Signature · 9 lines
Laurent Pinchart CSE Semaphore Belgium Chaussee de Bruxelles, 732A B-1410 Waterloo Belgium T +32 (2) 387 42 59 F +32 (2) 387 42 75
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
Quoted 8 lines · Laurent Pinchart
Hi Alexander,
Quoted 4 lines · Jean Delvare
Quoted 3 lines · Laurent Pinchart
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.
I've hit this same problem with the rtc8564. When the chips are first installed the registers haven't been initialized. This check makes the driver load fail which prevents the user space clock app from running and initializing the registers. The work around was to set the initial time from uboot.
Signature · 7 lines
Jon Smirl [email protected] _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c