OSDN Git Service

uclinux-h8/linux.git
6 years agortc: pcf85063: stop validating rtc_time in .read_time
Alexandre Belloni [Wed, 21 Feb 2018 15:07:34 +0000 (16:07 +0100)]
rtc: pcf85063: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: max6900: remove useless indirection
Alexandre Belloni [Wed, 21 Feb 2018 15:04:27 +0000 (16:04 +0100)]
rtc: max6900: remove useless indirection

max6900_i2c_read_time and max6900_i2c_set_time are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: max6900: stop validating rtc_time in .read_time
Alexandre Belloni [Wed, 21 Feb 2018 15:01:52 +0000 (16:01 +0100)]
rtc: max6900: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rs5c372: remove useless indirection
Alexandre Belloni [Wed, 21 Feb 2018 14:47:14 +0000 (15:47 +0100)]
rtc: rs5c372: remove useless indirection

rs5c372_get_datetime and rs5c372_set_datetime are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rs5c372: stop validating rtc_time in .read_time
Alexandre Belloni [Wed, 21 Feb 2018 14:43:53 +0000 (15:43 +0100)]
rtc: rs5c372: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rs5c372: remove useless message
Alexandre Belloni [Wed, 21 Feb 2018 14:42:32 +0000 (15:42 +0100)]
rtc: rs5c372: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: s35390a: remove useless indirection
Alexandre Belloni [Wed, 21 Feb 2018 13:00:18 +0000 (14:00 +0100)]
rtc: s35390a: remove useless indirection

s35390a_set_datetime, s35390a_get_datetime, s35390a_set_alarm and
s35390a_read_alarm are only used after casting dev to an i2c_client. Remove
that useless indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: s35390a: stop validating rtc_time in .read_time
Alexandre Belloni [Wed, 21 Feb 2018 12:54:46 +0000 (13:54 +0100)]
rtc: s35390a: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: s35390a: remove useless message
Alexandre Belloni [Wed, 21 Feb 2018 12:52:35 +0000 (13:52 +0100)]
rtc: s35390a: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rk808: fix possible race condition
Alexandre Belloni [Wed, 21 Feb 2018 10:57:05 +0000 (11:57 +0100)]
rtc: rk808: fix possible race condition

The probe function is not allowed to fail after registering the RTC because
the following may happen:

CPU0:                                CPU1:
sys_load_module()
 do_init_module()
  do_one_initcall()
   cmos_do_probe()
    rtc_device_register()
     __register_chrdev()
     cdev->owner = struct module*
                                     open("/dev/rtc0")
    rtc_device_unregister()
  module_put()
  free_module()
   module_free(mod->module_core)
   /* struct module *module is now
      freed */
                                      chrdev_open()
                                       spin_lock(cdev_lock)
                                       cdev_get()
                                        try_module_get()
                                         module_is_live()
                                         /* dereferences already
                                            freed struct module* */

Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc
as late as possible.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rk808: remove useless debug message
Alexandre Belloni [Wed, 21 Feb 2018 10:48:46 +0000 (11:48 +0100)]
rtc: rk808: remove useless debug message

At probe time, printing a message when the time is invalid doesn't have
much value. Also, as the comment suggest, this is a leftover from
development wherhe this was used to set the RTc to a default time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rx8581: remove useless message
Alexandre Belloni [Tue, 20 Feb 2018 23:25:18 +0000 (00:25 +0100)]
rtc: rx8581: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rx4581: remove useless message
Alexandre Belloni [Tue, 20 Feb 2018 23:23:31 +0000 (00:23 +0100)]
rtc: rx4581: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: pm8xxx: remove useless message
Alexandre Belloni [Tue, 20 Feb 2018 23:10:41 +0000 (00:10 +0100)]
rtc: pm8xxx: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: abx80x: remove useless message
Alexandre Belloni [Tue, 20 Feb 2018 22:42:27 +0000 (23:42 +0100)]
rtc: abx80x: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tegra: stop validating rtc_time in .set_time
Alexandre Belloni [Wed, 21 Feb 2018 10:03:49 +0000 (11:03 +0100)]
rtc: tegra: stop validating rtc_time in .set_time

The RTC core is always validating the rtc_time struct before calling
.set_time. It is not necessary to do it again in .set_time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: spear: stop validating rtc_time in .set_time and .set_alarm
Alexandre Belloni [Wed, 21 Feb 2018 10:23:19 +0000 (11:23 +0100)]
rtc: spear: stop validating rtc_time in .set_time and .set_alarm

The RTC core is always validating the rtc_time struct before calling
.set_time or .set_alarm. It is not necessary to do it again.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: omap: stop validating rtc_time in .set_time and .set_alarm
Alexandre Belloni [Wed, 21 Feb 2018 10:33:37 +0000 (11:33 +0100)]
rtc: omap: stop validating rtc_time in .set_time and .set_alarm

The RTC core is always validating the rtc_time struct before calling
.set_time or .set_alarm. It is not necessary to do it again.
Also, rtc_time_to_tm never generates an invalid rtc_tm (it can be out of
range though).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: max77686: stop validating rtc_time in .read_time
Alexandre Belloni [Tue, 20 Feb 2018 23:05:20 +0000 (00:05 +0100)]
rtc: max77686: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: m41t93: stop validating rtc_time in .read_time
Alexandre Belloni [Tue, 20 Feb 2018 23:02:08 +0000 (00:02 +0100)]
rtc: m41t93: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: isl12022: remove useless indirection
Alexandre Belloni [Tue, 20 Feb 2018 22:55:40 +0000 (23:55 +0100)]
rtc: isl12022: remove useless indirection

isl12022_get_datetime and isl12022_set_datetime are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: sc27xx: stop validating rtc_time in .read_time
Alexandre Belloni [Mon, 19 Feb 2018 15:24:19 +0000 (16:24 +0100)]
rtc: sc27xx: stop validating rtc_time in .read_time

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: r7301: stop validating rtc_time in .read_time
Alexandre Belloni [Tue, 20 Feb 2018 23:18:23 +0000 (00:18 +0100)]
rtc: r7301: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: nuc900: stop validating rtc_time in .read_time
Alexandre Belloni [Wed, 21 Feb 2018 10:27:10 +0000 (11:27 +0100)]
rtc: nuc900: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: diasemi: stop validating rtc_time in .read_time
Alexandre Belloni [Fri, 2 Mar 2018 09:08:47 +0000 (10:08 +0100)]
rtc: diasemi: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: cpcap: stop validating rtc_time in .read_time
Alexandre Belloni [Mon, 19 Feb 2018 15:23:57 +0000 (16:23 +0100)]
rtc: cpcap: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ab-b5ze-s3: stop validating rtc_time in .read_time
Alexandre Belloni [Mon, 19 Feb 2018 15:23:54 +0000 (16:23 +0100)]
rtc: ab-b5ze-s3: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stop validating rtc_time in .read_time
Alexandre Belloni [Mon, 19 Feb 2018 15:23:56 +0000 (16:23 +0100)]
rtc: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stop validating rtc_time after rtc_time_to_tm
Alexandre Belloni [Mon, 19 Feb 2018 15:23:55 +0000 (16:23 +0100)]
rtc: stop validating rtc_time after rtc_time_to_tm

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stop validating rtc_time after rtc_time64_to_tm
Alexandre Belloni [Mon, 19 Feb 2018 15:23:55 +0000 (16:23 +0100)]
rtc: stop validating rtc_time after rtc_time64_to_tm

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stk17ta8: let the core handle invalid time
Alexandre Belloni [Sun, 18 Feb 2018 22:36:18 +0000 (23:36 +0100)]
rtc: stk17ta8: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rs5c348: let the core handle invalid time
Alexandre Belloni [Tue, 20 Feb 2018 23:20:43 +0000 (00:20 +0100)]
rtc: rs5c348: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: cmos: let the core handle invalid time
Alexandre Belloni [Wed, 21 Feb 2018 10:44:26 +0000 (11:44 +0100)]
rtc: cmos: let the core handle invalid time

Setting the rtc to a valid time when the time is invalid is a bad practice,
because then userspace doesn't know it shouldn't trust the RTC.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1553: let the core handle invalid time
Alexandre Belloni [Tue, 20 Feb 2018 22:43:09 +0000 (23:43 +0100)]
rtc: ds1553: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1511: let the core handle invalid time
Alexandre Belloni [Tue, 20 Feb 2018 21:05:29 +0000 (22:05 +0100)]
rtc: ds1511: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tx4939: avoid unintended sign extension on a 24 bit shift
Colin Ian King [Thu, 15 Feb 2018 19:36:14 +0000 (19:36 +0000)]
rtc: tx4939: avoid unintended sign extension on a 24 bit shift

The shifting of buf[5] by 24 bits to the left will be promoted to
a 32 bit signed int and then sign-extended to an unsigned long. If
the top bit of buf[5] is set then all then all the upper bits sec
end up as also being set because of the sign-extension. Fix this by
casting buf[5] to an unsigned long before the shift.

Detected by CoverityScan, CID#1465292 ("Unintended sign extension")

Fixes: 0e1492330cd2 ("rtc: add rtc-tx4939 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agoMAINTAINERS: rtc: update my email address
Alexandre Belloni [Fri, 16 Feb 2018 10:06:00 +0000 (11:06 +0100)]
MAINTAINERS: rtc: update my email address

Free Electrons is now Bootlin.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agochar: rtc: remove unused rtc_control() API
Alexandre Belloni [Tue, 6 Feb 2018 22:12:26 +0000 (23:12 +0100)]
char: rtc: remove unused rtc_control() API

Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the
rtc_register/rtc_control/rtc_unregister API is unused. As it is highly
unlikely to be needed again, remove it.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: mxc_v2: Fix _iomem pointer notation
Fabio Estevam [Mon, 12 Feb 2018 02:38:46 +0000 (00:38 -0200)]
rtc: mxc_v2: Fix _iomem pointer notation

Fix the iomem pointer notation in order to fix the following sparse
warnings:

drivers/rtc/rtc-mxc_v2.c:280:18: warning: incorrect type in argument 1 (different address spaces)
drivers/rtc/rtc-mxc_v2.c:280:18:    expected void const volatile [noderef] <asn:2>*addr
drivers/rtc/rtc-mxc_v2.c:280:18:    got void *[noderef] <asn:2>ioaddr
drivers/rtc/rtc-mxc_v2.c:329:44: warning: incorrect type in argument 1 (different address spaces)
drivers/rtc/rtc-mxc_v2.c:329:44:    expected void *[noderef] <asn:2>ioaddr
drivers/rtc/rtc-mxc_v2.c:329:44:    got void [noderef] <asn:2>*
drivers/rtc/rtc-mxc_v2.c:339:44: warning: incorrect type in argument 1 (different address spaces)
drivers/rtc/rtc-mxc_v2.c:339:44:    expected void *[noderef] <asn:2>ioaddr
drivers/rtc/rtc-mxc_v2.c:339:44:    got void [noderef] <asn:2>*

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: isl1208: Fix unintended clear of SR bits
Denis Osterland [Tue, 23 Jan 2018 12:17:58 +0000 (13:17 +0100)]
rtc: isl1208: Fix unintended clear of SR bits

After successful
sr = isl1208_i2c_set_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN);
sr will be 0.
As a result
sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR,
sr & ~ISL1208_REG_SR_WRTC);
is equal to
sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, 0);
which clears all flags in SR.

Add an additional read of SR, to have value of SR in sr again.

Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tx4939: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:59 +0000 (23:47 +0100)]
rtc: tx4939: use generic nvmem

Instead of adding a binary sysfs attribute from the driver, use the core to
register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tx4939: fix possible race condition
Alexandre Belloni [Mon, 12 Feb 2018 22:47:58 +0000 (23:47 +0100)]
rtc: tx4939: fix possible race condition

The probe function is not allowed to fail after registering the RTC. Call
rtc_register_device() at the end.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tx4939: switch to rtc_register_device
Alexandre Belloni [Mon, 12 Feb 2018 22:47:57 +0000 (23:47 +0100)]
rtc: tx4939: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tx4939: extend test coverage
Alexandre Belloni [Mon, 12 Feb 2018 22:47:56 +0000 (23:47 +0100)]
rtc: tx4939: extend test coverage

The rtc-tx4939 driver now compiles correctly on other architectures, add
COMPILE_TEST to improve code coverage.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: tx4939: remove arch/mips dependency
Alexandre Belloni [Mon, 12 Feb 2018 22:47:55 +0000 (23:47 +0100)]
rtc: tx4939: remove arch/mips dependency

Copy RTC definitions from arch/mips/include/asm/txx9/tx4939.h to the RTC
driver so it doesn't depend on arch/mips anymore.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stk17ta8: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:54 +0000 (23:47 +0100)]
rtc: stk17ta8: use generic nvmem

Instead of adding a binary sysfs attribute from the driver, use the core to
register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stk17ta8: fix possible race condition
Alexandre Belloni [Mon, 12 Feb 2018 22:47:53 +0000 (23:47 +0100)]
rtc: stk17ta8: fix possible race condition

The probe function is not allowed to fail after registering the RTC. Call
rtc_register_device() at the end.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stk17ta8: switch to rtc_register_device
Alexandre Belloni [Mon, 12 Feb 2018 22:47:52 +0000 (23:47 +0100)]
rtc: stk17ta8: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: stk17ta8: make alarms useful
Alexandre Belloni [Mon, 12 Feb 2018 22:47:51 +0000 (23:47 +0100)]
rtc: stk17ta8: make alarms useful

Currently, the IRQs are disabled when the rtc driver is removed (e.g. when
shutting down the platform).
This means that the RTC will be unable to wakeup the platform.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rp5c01: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:50 +0000 (23:47 +0100)]
rtc: rp5c01: use generic nvmem

Instead of adding a binary sysfs attribute from the driver, use the core to
register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rp5c01: fix possible race condition
Alexandre Belloni [Mon, 12 Feb 2018 22:47:49 +0000 (23:47 +0100)]
rtc: rp5c01: fix possible race condition

The probe function is not allowed to fail after registering the RTC because
the following may happen:

CPU0:                                CPU1:
sys_load_module()
 do_init_module()
  do_one_initcall()
   cmos_do_probe()
    rtc_device_register()
     __register_chrdev()
     cdev->owner = struct module*
                                     open("/dev/rtc0")
    rtc_device_unregister()
  module_put()
  free_module()
   module_free(mod->module_core)
   /* struct module *module is now
      freed */
                                      chrdev_open()
                                       spin_lock(cdev_lock)
                                       cdev_get()
                                        try_module_get()
                                         module_is_live()
                                         /* dereferences already
                                            freed struct module* */

Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc
as late as possible.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1742: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:48 +0000 (23:47 +0100)]
rtc: ds1742: use generic nvmem

Instead of adding a binary sysfs attribute from the driver (which suffers
from a race condition as the attribute appears after the device), use the
core to register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1742: switch to rtc_register_device
Alexandre Belloni [Mon, 12 Feb 2018 22:47:47 +0000 (23:47 +0100)]
rtc: ds1742: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: cmos: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:46 +0000 (23:47 +0100)]
rtc: cmos: use generic nvmem

Instead of adding a binary sysfs attribute from the driver, use the
core to register an nvmem device. This allows to use the in-kernel
interface to access the nvram.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: cmos: fix possible race condition
Alexandre Belloni [Mon, 12 Feb 2018 22:47:45 +0000 (23:47 +0100)]
rtc: cmos: fix possible race condition

The probe function is not allowed to fail after registering the RTC because
the following may happen:

CPU0:                                CPU1:
sys_load_module()
 do_init_module()
  do_one_initcall()
   cmos_do_probe()
    rtc_device_register()
     __register_chrdev()
     cdev->owner = struct module*
                                     open("/dev/rtc0")
    rtc_device_unregister()
  module_put()
  free_module()
   module_free(mod->module_core)
   /* struct module *module is now
      freed */
                                      chrdev_open()
                                       spin_lock(cdev_lock)
                                       cdev_get()
                                        try_module_get()
                                         module_is_live()
                                         /* dereferences already
                                            freed struct module* */

Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc
as late as possible.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1553: make alarms useful
Alexandre Belloni [Mon, 12 Feb 2018 22:47:44 +0000 (23:47 +0100)]
rtc: ds1553: make alarms useful

Currently, the IRQs are disabled when the rtc driver is removed (e.g. when
shutting down the platform).
This means that the RTC will be unable to wakeup the platform.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1553: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:43 +0000 (23:47 +0100)]
rtc: ds1553: use generic nvmem

Instead of adding a binary sysfs attribute from the driver (which suffers
from a race condition as the attribute appears after the device), use the
core to register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1553: switch to rtc_register_device
Alexandre Belloni [Mon, 12 Feb 2018 22:47:42 +0000 (23:47 +0100)]
rtc: ds1553: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: sirfsoc: remove useless sirfsoc_rtc_ioctl
Alexandre Belloni [Mon, 12 Feb 2018 22:47:41 +0000 (23:47 +0100)]
rtc: sirfsoc: remove useless sirfsoc_rtc_ioctl

sirfsoc_rtc_ioctl() doesn't implement any actual ioctl, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: m48t59: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:40 +0000 (23:47 +0100)]
rtc: m48t59: use generic nvmem

Instead of adding a binary sysfs attribute from the driver (which suffers
from a race condition as the attribute appears after the device), use the
core to register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: m48t59: switch to rtc_register_device
Alexandre Belloni [Mon, 12 Feb 2018 22:47:39 +0000 (23:47 +0100)]
rtc: m48t59: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1343: use generic nvmem
Alexandre Belloni [Mon, 12 Feb 2018 22:47:38 +0000 (23:47 +0100)]
rtc: ds1343: use generic nvmem

Instead of adding a binary sysfs attribute from the driver (which suffers
from a race condition as the attribute appears after the device), use the
core to register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1343: remove undocumented and useless sysfs files
Alexandre Belloni [Mon, 12 Feb 2018 22:47:37 +0000 (23:47 +0100)]
rtc: ds1343: remove undocumented and useless sysfs files

A documented ABI already exists to get information about the alarm. It is
the only one that is used.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1343: switch to rtc_register_device
Alexandre Belloni [Mon, 12 Feb 2018 22:47:36 +0000 (23:47 +0100)]
rtc: ds1343: switch to rtc_register_device

This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1343: simplify regmap initialization
Alexandre Belloni [Mon, 12 Feb 2018 22:47:35 +0000 (23:47 +0100)]
rtc: ds1343: simplify regmap initialization

Avoid using memset as gcc can properly initialize structures.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: remove nvmem_config
Alexandre Belloni [Mon, 12 Feb 2018 22:47:34 +0000 (23:47 +0100)]
rtc: remove nvmem_config

Because nvmem_config is only used and copied at nvmem registration, remove
it from struct rtc_device.

All the rtc drivers using nvmem are now calling rtc_nvmem_register
directly.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rv8803: fix possible race condition
Alexandre Belloni [Mon, 12 Feb 2018 22:47:33 +0000 (23:47 +0100)]
rtc: rv8803: fix possible race condition

The probe function is not allowed to fail after registering the RTC. Call
rtc_register_device() at the end.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rv8803: put struct nvmem_config on the stack
Alexandre Belloni [Mon, 12 Feb 2018 22:47:32 +0000 (23:47 +0100)]
rtc: rv8803: put struct nvmem_config on the stack

Avoid allocating memory for struct nvmem_config.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: rv8803: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:31 +0000 (23:47 +0100)]
rtc: rv8803: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: pcf85363: put struct nvmem_config on the stack
Alexandre Belloni [Mon, 12 Feb 2018 22:47:30 +0000 (23:47 +0100)]
rtc: pcf85363: put struct nvmem_config on the stack

Avoid allocating memory for struct nvmem_config.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: pcf85363: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:29 +0000 (23:47 +0100)]
rtc: pcf85363: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: omap: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:28 +0000 (23:47 +0100)]
rtc: omap: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: m48t86: put m48t86_nvmem_cfg on the stack
Alexandre Belloni [Mon, 12 Feb 2018 22:47:27 +0000 (23:47 +0100)]
rtc: m48t86: put m48t86_nvmem_cfg on the stack

Move m48t86_nvmem_cfg to the stack of m48t86_rtc_probe. This results in a
very small code size reduction and make it safer on systems with two
similar RTCs:

   text    data     bss     dec     hex filename
   1733     164       0    1897     769 drivers/rtc/rtc-m48t86.o.before
   1793     100       0    1893     765 drivers/rtc/rtc-m48t86.o.after

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: m48t86: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:26 +0000 (23:47 +0100)]
rtc: m48t86: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1511: put ds1511_nvmem_cfg on the stack
Alexandre Belloni [Mon, 12 Feb 2018 22:47:25 +0000 (23:47 +0100)]
rtc: ds1511: put ds1511_nvmem_cfg on the stack

Move ds1511_nvmem_cfg to the stack of ds1511_rtc_probe. This results in a
very small code size reduction and make it safer on systems with two
similar RTCs:

   text    data     bss     dec     hex filename
   2128     164       4    2296     8f8 drivers/rtc/rtc-ds1511.o.before
   2175     100       4    2279     8e7 drivers/rtc/rtc-ds1511.o.after

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1511: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:24 +0000 (23:47 +0100)]
rtc: ds1511: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1307: put struct nvmem_config on the stack
Alexandre Belloni [Mon, 12 Feb 2018 22:47:23 +0000 (23:47 +0100)]
rtc: ds1307: put struct nvmem_config on the stack

Avoid allocating memory for struct nvmem_config as it is only necessary at
the nvmem registration.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1307: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:22 +0000 (23:47 +0100)]
rtc: ds1307: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1305: put ds1305_nvmem_cfg on the stack
Alexandre Belloni [Mon, 12 Feb 2018 22:47:21 +0000 (23:47 +0100)]
rtc: ds1305: put ds1305_nvmem_cfg on the stack

This makes to code safer on system using two similar RTCs.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1305: call rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:20 +0000 (23:47 +0100)]
rtc: ds1305: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: export rtc_nvmem_register() to drivers
Alexandre Belloni [Mon, 12 Feb 2018 22:47:19 +0000 (23:47 +0100)]
rtc: export rtc_nvmem_register() to drivers

Export rtc_nvmem_register() so it can be called from drivers instead of
only the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: nvmem: allow registering the nvmem device before the rtc
Alexandre Belloni [Wed, 28 Feb 2018 20:58:02 +0000 (21:58 +0100)]
rtc: nvmem: allow registering the nvmem device before the rtc

Switch the parent of the nvmem device to the parent of the rtc device so it
can be registered before the RTC.

This is a small change in the ABI as the nvmem moves out of the
/sys/class/rtc/rtcX folder to be under the parent device folder (that is
where the previous nvram files where registered).

However, it is still available under its correct location,
/sys/bus/nvmem/devices which is the one that should be used by userspace
applications.

The other benefit is that the nvmem device can stay registered even if the
rtc registration fails. Or it is possible to not register the rtc if the
nvmem registration failed.

Finally, it makes a lot of sense for devices that actually have different
i2c or spi addresses for the RTC and the EEPROM. That is basically how it
would end up when using MFD or even completely separate devices.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: nvmem: disallow registering nvmem more than once
Alexandre Belloni [Mon, 12 Feb 2018 22:47:18 +0000 (23:47 +0100)]
rtc: nvmem: disallow registering nvmem more than once

Make rtc_nvmem_register return -EBUSY when an nvmem is already registered
for that RTC.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: nvmem: return error values
Alexandre Belloni [Mon, 12 Feb 2018 22:47:17 +0000 (23:47 +0100)]
rtc: nvmem: return error values

In case of error, make rtc_nvmem_register() able to return an error value
to its caller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: nvmem: pass nvmem_config to rtc_nvmem_register()
Alexandre Belloni [Mon, 12 Feb 2018 22:47:16 +0000 (23:47 +0100)]
rtc: nvmem: pass nvmem_config to rtc_nvmem_register()

To be able to remove nvmem_config from struct rtc_device, pass it as a
parameter to rtc_nvmem_register.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: documentation: correct nvmem date and version
Alexandre Belloni [Mon, 12 Feb 2018 22:47:15 +0000 (23:47 +0100)]
rtc: documentation: correct nvmem date and version

The nvmem interface appaeared in linux 4.13

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: ds1302: remove redundant initializations of pointer bp
Colin Ian King [Tue, 23 Jan 2018 10:17:27 +0000 (10:17 +0000)]
rtc: ds1302: remove redundant initializations of pointer bp

Pointe bp is being initialized and this value is never read, it
is being updated to the same value later just before it is going to
be used. Remove the initialization as it is never read and keep
the setting of bp closer to the use of bp.

Cleans up clang warnings:
drivers/rtc/rtc-ds1302.c:115:7: warning: Value stored to 'bp' during
its initialization is never read
drivers/rtc/rtc-ds1302.c:46:7: warning: Value stored to 'bp' during
its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: goldfish: Add missing MODULE_LICENSE
James Hogan [Tue, 16 Jan 2018 14:45:21 +0000 (14:45 +0000)]
rtc: goldfish: Add missing MODULE_LICENSE

Fix the following warning in MIPS allmodconfig by adding a
MODULE_LICENSE() at the end of rtc-goldfish.c, based on the file header
comment which says GNU General Public License version 2:

WARNING: modpost: missing MODULE_LICENSE() in drivers/rtc/rtc-goldfish.o

Fixes: f22d9cdcb5eb ("rtc: goldfish: Add RTC driver for Android emulator")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Miodrag Dinic <miodrag.dinic@mips.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: linux-rtc@vger.kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: Fix overflow when converting time64_t to rtc_time
Baolin Wang [Mon, 25 Dec 2017 11:10:37 +0000 (19:10 +0800)]
rtc: Fix overflow when converting time64_t to rtc_time

If we convert one large time values to rtc_time, in the original formula
'days * 86400' can be overflowed in 'unsigned int' type to make the formula
get one incorrect remain seconds value. Thus we can use div_s64_rem()
function to avoid this situation.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agortc: Add tracepoints for RTC system
Baolin Wang [Thu, 14 Dec 2017 05:31:43 +0000 (13:31 +0800)]
rtc: Add tracepoints for RTC system

It will be more helpful to add some tracepoints to track RTC actions when
debugging RTC driver. Below sample is that we set/read the RTC time, then
set 2 alarms, so we can see the trace logs:

set/read RTC time:
kworker/0:1-67 [000] 21.814245: rtc_set_time: UTC (1510301580) (0)
kworker/0:1-67 [000] 21.814312: rtc_read_time: UTC (1510301580) (0)

set the first alarm timer:
kworker/0:1-67 [000] 21.829238: rtc_timer_enqueue: RTC timer:(ffffffc15eb49bc8) expires:1510301700000000000 period:0
kworker/0:1-67 [000] 22.018279: rtc_set_alarm: UTC (1510301700) (0)

set the second alarm timer:
kworker/0:1-67 [000] 22.230284: rtc_timer_enqueue: RTC timer:(ffffff80088e6430) expires:1510301820000000000 period:0

the first alarm timer was expired:
kworker/0:1-67 [000] 145.155584: rtc_timer_dequeue: RTC timer:(ffffffc15eb49bc8) expires:1510301700000000000 period:0
kworker/0:1-67 [000] 145.155593: rtc_timer_fired: RTC timer:(ffffffc15eb49bc8) expires:1510301700000000000 period:0
kworker/0:1-67 [000] 145.172504: rtc_set_alarm: UTC (1510301820) (0)

the second alarm timer was expired:
kworker/0:1-67 [000] 269.102353: rtc_timer_dequeue: RTC timer:(ffffff80088e6430) expires:1510301820000000000 period:0
kworker/0:1-67 [000] 269.102360: rtc_timer_fired: RTC timer:(ffffff80088e6430) expires:1510301820000000000 period:0

disable alarm irq:
kworker/0:1-67 [000] 269.102469: rtc_alarm_irq_enable: disable RTC alarm IRQ (0)

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
6 years agoLinux 4.16-rc1 v4.16-rc1
Linus Torvalds [Sun, 11 Feb 2018 23:04:29 +0000 (15:04 -0800)]
Linux 4.16-rc1

6 years agounify {de,}mangle_poll(), get rid of kernel-side POLL...
Al Viro [Thu, 1 Feb 2018 20:13:18 +0000 (15:13 -0500)]
unify {de,}mangle_poll(), get rid of kernel-side POLL...

except, again, POLLFREE and POLL_BUSY_LOOP.

With this, we finally get to the promised end result:

 - POLL{IN,OUT,...} are plain integers and *not* in __poll_t, so any
   stray instances of ->poll() still using those will be caught by
   sparse.

 - eventpoll.c and select.c warning-free wrt __poll_t

 - no more kernel-side definitions of POLL... - userland ones are
   visible through the entire kernel (and used pretty much only for
   mangle/demangle)

 - same behavior as after the first series (i.e. sparc et.al. epoll(2)
   working correctly).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agovfs: do bulk POLL* -> EPOLL* replacement
Linus Torvalds [Sun, 11 Feb 2018 22:34:03 +0000 (14:34 -0800)]
vfs: do bulk POLL* -> EPOLL* replacement

This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
        L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
        for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
    done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do.  But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agoMerge branch 'work.poll2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sun, 11 Feb 2018 21:57:19 +0000 (13:57 -0800)]
Merge branch 'work.poll2' of git://git./linux/kernel/git/viro/vfs

Pull more poll annotation updates from Al Viro:
 "This is preparation to solving the problems you've mentioned in the
  original poll series.

  After this series, the kernel is ready for running

      for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
            L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
            for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
      done

  as a for bulk search-and-replace.

  After that, the kernel is ready to apply the patch to unify
  {de,}mangle_poll(), and then get rid of kernel-side POLL... uses
  entirely, and we should be all done with that stuff.

  Basically, that's what you suggested wrt KPOLL..., except that we can
  use EPOLL... instead - they already are arch-independent (and equal to
  what is currently kernel-side POLL...).

  After the preparations (in this series) switch to returning EPOLL...
  from ->poll() instances is completely mechanical and kernel-side
  POLL... can go away. The last step (killing kernel-side POLL... and
  unifying {de,}mangle_poll() has to be done after the
  search-and-replace job, since we need userland-side POLL... for
  unified {de,}mangle_poll(), thus the cherry-pick at the last step.

  After that we will have:

   - POLL{IN,OUT,...} *not* in __poll_t, so any stray instances of
     ->poll() still using those will be caught by sparse.

   - eventpoll.c and select.c warning-free wrt __poll_t

   - no more kernel-side definitions of POLL... - userland ones are
     visible through the entire kernel (and used pretty much only for
     mangle/demangle)

   - same behavior as after the first series (i.e. sparc et.al. epoll(2)
     working correctly)"

* 'work.poll2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  annotate ep_scan_ready_list()
  ep_send_events_proc(): return result via esed->res
  preparation to switching ->poll() to returning EPOLL...
  add EPOLLNVAL, annotate EPOLL... and event_poll->event
  use linux/poll.h instead of asm/poll.h
  xen: fix poll misannotation
  smc: missing poll annotations

6 years agoMerge tag 'xtensa-20180211' of git://github.com/jcmvbkbc/linux-xtensa
Linus Torvalds [Sun, 11 Feb 2018 21:54:52 +0000 (13:54 -0800)]
Merge tag 'xtensa-20180211' of git://github.com/jcmvbkbc/linux-xtensa

Pull xtense fix from Max Filippov:
 "Build fix for xtensa architecture with KASAN enabled"

* tag 'xtensa-20180211' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: fix build with KASAN

6 years agoMerge tag 'nios2-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan...
Linus Torvalds [Sun, 11 Feb 2018 21:52:32 +0000 (13:52 -0800)]
Merge tag 'nios2-v4.16-rc1' of git://git./linux/kernel/git/lftan/nios2

Pull nios2 update from Ley Foon Tan:

 - clean up old Kconfig options from defconfig

 - remove leading 0x and 0s from bindings notation in dts files

* tag 'nios2-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
  nios2: defconfig: Cleanup from old Kconfig options
  nios2: dts: Remove leading 0x and 0s from bindings notation

6 years agoxtensa: fix build with KASAN
Max Filippov [Sun, 11 Feb 2018 09:07:54 +0000 (01:07 -0800)]
xtensa: fix build with KASAN

The commit 917538e212a2 ("kasan: clean up KASAN_SHADOW_SCALE_SHIFT
usage") removed KASAN_SHADOW_SCALE_SHIFT definition from
include/linux/kasan.h and added it to architecture-specific headers,
except for xtensa. This broke the xtensa build with KASAN enabled.
Define KASAN_SHADOW_SCALE_SHIFT in arch/xtensa/include/asm/kasan.h

Reported by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 917538e212a2 ("kasan: clean up KASAN_SHADOW_SCALE_SHIFT usage")
Acked-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
6 years agonios2: defconfig: Cleanup from old Kconfig options
Krzysztof Kozlowski [Sun, 11 Feb 2018 15:01:17 +0000 (23:01 +0800)]
nios2: defconfig: Cleanup from old Kconfig options

Remove old, dead Kconfig option INET_LRO. It is gone since
commit 7bbf3cae65b6 ("ipv4: Remove inet_lro library").

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agonios2: dts: Remove leading 0x and 0s from bindings notation
Mathieu Malaterre [Sun, 11 Feb 2018 14:59:18 +0000 (22:59 +0800)]
nios2: dts: Remove leading 0x and 0s from bindings notation

Improve the DTS files by removing all the leading "0x" and zeros to fix the
following dtc warnings:

Warning (unit_address_format): Node /XXX unit name should not have leading "0x"

and

Warning (unit_address_format): Node /XXX unit name should not have leading 0s

Converted using the following command:

find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -E -i -e "s/@0x([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" -e "s/@0+([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" {} +

For simplicity, two sed expressions were used to solve each warnings separately.

To make the regex expression more robust a few other issues were resolved,
namely setting unit-address to lower case, and adding a whitespace before the
the opening curly brace:

https://elinux.org/Device_Tree_Linux#Linux_conventions

This is a follow up to commit 4c9847b7375a ("dt-bindings: Remove leading 0x from bindings notation")

Reported-by: David Daney <ddaney@caviumnetworks.com>
Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mathieu Malaterre <malat@debian.org>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoMerge tag 'pci-v4.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
Linus Torvalds [Sat, 10 Feb 2018 22:08:26 +0000 (14:08 -0800)]
Merge tag 'pci-v4.16-fixes-1' of git://git./linux/kernel/git/helgaas/pci

Pull PCI fix from Bjorn Helgaas:
 "Fix a POWER9/powernv INTx regression from the merge window (Alexey
  Kardashevskiy)"

* tag 'pci-v4.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  powerpc/pci: Fix broken INTx configuration via OF