--- zzzz-none-000/linux-3.10.107/drivers/rtc/rtc-isl1208.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/rtc/rtc-isl1208.c 2021-02-04 17:41:59.000000000 +0000 @@ -144,11 +144,7 @@ static int isl1208_i2c_get_sr(struct i2c_client *client) { - int sr = i2c_smbus_read_byte_data(client, ISL1208_REG_SR); - if (sr < 0) - return -EIO; - - return sr; + return i2c_smbus_read_byte_data(client, ISL1208_REG_SR); } static int @@ -374,22 +370,15 @@ struct rtc_time *alarm_tm = &alarm->time; u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, }; const int offs = ISL1208_REG_SCA; - unsigned long rtc_secs, alarm_secs; struct rtc_time rtc_tm; int err, enable; err = isl1208_i2c_read_time(client, &rtc_tm); if (err) return err; - err = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (err) - return err; - err = rtc_tm_to_time(alarm_tm, &alarm_secs); - if (err) - return err; /* If the alarm time is before the current time disable the alarm */ - if (!alarm->enabled || alarm_secs <= rtc_secs) + if (!alarm->enabled || rtc_tm_sub(alarm_tm, &rtc_tm) <= 0) enable = 0x00; else enable = 0x80; @@ -647,10 +636,11 @@ "chip found, driver version " DRV_VERSION "\n"); if (client->irq > 0) { - rc = request_threaded_irq(client->irq, NULL, - isl1208_rtc_interrupt, - IRQF_SHARED, - isl1208_driver.driver.name, client); + rc = devm_request_threaded_irq(&client->dev, client->irq, NULL, + isl1208_rtc_interrupt, + IRQF_SHARED | IRQF_ONESHOT, + isl1208_driver.driver.name, + client); if (!rc) { device_init_wakeup(&client->dev, 1); enable_irq_wake(client->irq); @@ -662,20 +652,18 @@ } } - rtc = rtc_device_register(isl1208_driver.driver.name, - &client->dev, &isl1208_rtc_ops, + rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name, + &isl1208_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc)) { - rc = PTR_ERR(rtc); - goto exit_free_irq; - } + if (IS_ERR(rtc)) + return PTR_ERR(rtc); i2c_set_clientdata(client, rtc); rc = isl1208_i2c_get_sr(client); if (rc < 0) { dev_err(&client->dev, "reading status failed\n"); - goto exit_unregister; + return rc; } if (rc & ISL1208_REG_SR_RTCF) @@ -684,28 +672,15 @@ rc = sysfs_create_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); if (rc) - goto exit_unregister; + return rc; return 0; - -exit_unregister: - rtc_device_unregister(rtc); -exit_free_irq: - if (client->irq) - free_irq(client->irq, client); - - return rc; } static int isl1208_remove(struct i2c_client *client) { - struct rtc_device *rtc = i2c_get_clientdata(client); - sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files); - rtc_device_unregister(rtc); - if (client->irq) - free_irq(client->irq, client); return 0; }