--- zzzz-none-000/linux-3.10.107/drivers/rtc/rtc-isl12022.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/rtc/rtc-isl12022.c 2021-02-04 17:41:59.000000000 +0000 @@ -16,6 +16,9 @@ #include #include #include +#include +#include +#include #define DRV_VERSION "0.1" @@ -148,12 +151,7 @@ tm->tm_sec, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); - /* The clock can give out invalid datetime, but we cannot return - * -EINVAL otherwise hwclock will refuse to set the time on bootup. */ - if (rtc_valid_tm(tm) < 0) - dev_err(&client->dev, "retrieved date and time is invalid.\n"); - - return 0; + return rtc_valid_tm(tm); } static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm) @@ -267,16 +265,17 @@ isl12022->rtc = devm_rtc_device_register(&client->dev, isl12022_driver.driver.name, &isl12022_rtc_ops, THIS_MODULE); - if (IS_ERR(isl12022->rtc)) - return PTR_ERR(isl12022->rtc); - - return 0; + return PTR_ERR_OR_ZERO(isl12022->rtc); } -static int isl12022_remove(struct i2c_client *client) -{ - return 0; -} +#ifdef CONFIG_OF +static const struct of_device_id isl12022_dt_match[] = { + { .compatible = "isl,isl12022" }, /* for backward compat., don't use */ + { .compatible = "isil,isl12022" }, + { }, +}; +MODULE_DEVICE_TABLE(of, isl12022_dt_match); +#endif static const struct i2c_device_id isl12022_id[] = { { "isl12022", 0 }, @@ -287,9 +286,11 @@ static struct i2c_driver isl12022_driver = { .driver = { .name = "rtc-isl12022", +#ifdef CONFIG_OF + .of_match_table = of_match_ptr(isl12022_dt_match), +#endif }, .probe = isl12022_probe, - .remove = isl12022_remove, .id_table = isl12022_id, };