15 Sep, 2020

1 commit

  • ds1685_rtc_begin_data_access() tried to access an extended register before
    enabling access to it by switching to bank 1. Depending on content in NVRAM
    this could lead to an endless loop. While at it fix also switch back to
    bank 0 in ds1685_rtc_end_data_access().

    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Alexandre Belloni
    Acked-by: Joshua Kinard
    Link: https://lore.kernel.org/r/20200910084124.138560-1-tsbogend@alpha.franken.de

    Thomas Bogendoerfer
     

27 Nov, 2019

2 commits

  • Fix the following parsing errors when building with W=1:
    drivers/rtc/rtc-ds1685.c:1053: error: Cannot parse struct or union!
    drivers/rtc/rtc-ds1685.c:1062: error: Cannot parse struct or union!
    drivers/rtc/rtc-ds1685.c:1363: warning: cannot understand function prototype: 'struct platform_driver ds1685_rtc_driver = '

    Cc: Joshua Kinard
    Link: https://lore.kernel.org/r/20191122102212.400158-5-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Fix the following warnings:
    drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_read_time’:
    drivers/rtc/rtc-ds1685.c:264:5: warning: variable ‘ctrlb’ set but not used [-Wunused-but-set-variable]
    264 | u8 ctrlb, century;
    | ^~~~~
    drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_proc’:
    drivers/rtc/rtc-ds1685.c:758:19: warning: variable ‘ctrlc’ set but not used [-Wunused-but-set-variable]
    758 | u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8];
    | ^~~~~
    Cc: Joshua Kinard
    Acked-By: Joshua Kinard
    Link: https://lore.kernel.org/r/20191122102212.400158-4-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     

16 Oct, 2019

1 commit

  • SGI Octane (IP30) doesn't have RTC register directly mapped into CPU
    address space, but accesses RTC registers with an address and data
    register. This is now supported by additional access functions, which
    are selected by a new field in platform data. Removed plat_read/plat_write
    since there is no user and their usage could introduce lifetime issue,
    when functions are placed in different modules.

    Signed-off-by: Thomas Bogendoerfer
    Acked-by: Joshua Kinard
    Reviewed-by: Joshua Kinard
    Link: https://lore.kernel.org/r/20191014214621.25257-1-tbogendoerfer@suse.de
    Signed-off-by: Alexandre Belloni

    Thomas Bogendoerfer
     

14 Oct, 2019

2 commits


19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

17 Apr, 2019

2 commits

  • Handling of extended interrupts (kickstart, wake-up, ram-clear) was
    moved off to a work queue, but the interrupts aren't acknowledged
    in the interrupt handler. This leads to a deadlock, if driver
    is used with interrupts. To fix this we use a threaded interrupt, get rid
    of the work queue and do locking with just the rtc mutex lock.

    Fixes: aaaf5fbf56f1 ("rtc: add driver for DS1685 family of real time clocks")
    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Alexandre Belloni

    Thomas Bogendoerfer
     
  • ds1685_rtc_begin_ctrl_access/ds1685_rtc_end_ctrl_access aren't used,
    so get rid of it.

    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Alexandre Belloni

    Thomas Bogendoerfer
     

12 Apr, 2019

1 commit


22 Oct, 2018

1 commit


28 Sep, 2018

3 commits


20 Jun, 2018

2 commits


01 Jun, 2018

2 commits


04 May, 2018

1 commit

  • We should get drvdata from struct device directly. Going via
    platform_device is an unneeded step back and forth.

    Signed-off-by: Wolfram Sang
    Acked-by: Michal Simek (for zynqmp)
    Signed-off-by: Alexandre Belloni

    Wolfram Sang
     

02 Mar, 2018

1 commit


09 Jul, 2016

1 commit


04 Jun, 2016

1 commit


20 May, 2016

2 commits

  • objtool reports the following warning:

    drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_poweroff() falls through to next function ds1685_rtc_work_queue()

    Similar to commit 361c6ed6b153 ("rtc: ds1685: actually spin forever in
    poweroff error path"), there's another unreachable() annotation which is
    actually reachable, which we missed the first time.

    Actually spin forever to be consistent with the comment and to make the
    unreachable() annotation guaranteed to be unreachable.

    Reported-by: kbuild test robot
    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Alexandre Belloni

    Josh Poimboeuf
     
  • Many drivers are defining a DRV_VERSION. This is often only used for
    MODULE_VERSION and sometimes to print an info message at probe time. This
    is kind of pointless as they are all versionned with the kernel anyway.
    Also the core will print a message when a new rtc is found.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     

15 Mar, 2016

2 commits

  • objtool reports the following warnings:

    drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_work_queue()+0x0: duplicate frame pointer save
    drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_work_queue()+0x3: duplicate frame pointer setup
    drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_work_queue()+0x0: frame pointer state mismatch

    The warning message needs to be improved, but what it really means in
    this case is that ds1685_rtc_poweroff() has a possible code path where
    it can actually fall through to the next function in the object code,
    ds1685_rtc_work_queue().

    The bug is caused by the use of the unreachable() macro in a place which
    is actually reachable. That causes gcc to assume that the printk()
    immediately before the unreachable() macro never returns, when in fact
    it does. So gcc places the printk() at the very end of the function's
    object code. When the printk() returns, the next function starts
    executing.

    The surrounding comment and printk message state that the code should
    spin forever, which explains the unreachable() statement. However the
    actual spin code is missing.

    Reported-by: kbuild test robot
    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Alexandre Belloni

    Josh Poimboeuf
     
  • We call spin_lock_irqrestore with "flags" set to zero instead of to the
    value from spin_lock_irqsave().

    Fixes: aaaf5fbf56f1 ('rtc: add driver for DS1685 family of real time clocks')
    Signed-off-by: Dan Carpenter
    Signed-off-by: Alexandre Belloni

    Dan Carpenter
     

12 Jan, 2016

2 commits

  • ...and don't do it wrong.

    "not ok or N/A" has length 13. Add the trailing newline, and the
    snprintf return value will be 14. However, we lied to snprintf and
    told it that only 13 bytes were available. Hence snprintf has only
    written "not ok or N/" and a trailing '\0' to the buffer. Next we
    continue lying, this time to the upper sysfs layer, claiming that we
    wrote 14 meaningful bytes to the buffer. That'll make the upper layer
    copy "not ok or N/" plus two nul bytes to user space (one nul byte
    from snprintf, the other since sysfs takes care to clear the buffer
    before giving it to the ->show method).

    In the other cases, the claimed buffer size is closer to sufficient,
    but we'll still get a nul byte instead of a newline written to user
    space. There's absolutely no reason to try to predict the output
    size, and there's plenty of room in the buffer, so just use sprintf.

    Signed-off-by: Rasmus Villemoes
    Signed-off-by: Alexandre Belloni

    Rasmus Villemoes
     
  • This makes the generated code slightly smaller.

    Signed-off-by: Rasmus Villemoes
    Signed-off-by: Alexandre Belloni

    Rasmus Villemoes
     

05 Sep, 2015

1 commit

  • Use module_platform_driver for drivers whose init and exit functions
    only register and unregister, respectively.

    A simplified version of the Coccinelle semantic patch that performs
    this transformation is as follows:

    @a@
    identifier f, x;
    @@
    -static f(...) { return platform_driver_register(&x); }

    @b depends on a@
    identifier e, a.x;
    @@
    -static e(...) { platform_driver_unregister(&x); }

    @c depends on a && b@
    identifier a.f;
    declarer name module_init;
    @@
    -module_init(f);

    @d depends on a && b && c@
    identifier b.e, a.x;
    declarer name module_exit;
    declarer name module_platform_driver;
    @@
    -module_exit(e);
    +module_platform_driver(x);

    Signed-off-by: Vaishali Thakkar
    Signed-off-by: Alexandre Belloni

    Vaishali Thakkar
     

17 Apr, 2015

3 commits

  • Neaten the logging a bit by adding #define pr_fmt

    Miscellanea:

    o Remove __FILE__/__func__ uses
    o Coalesce formats adding missing spaces
    o Align arguments
    o (rtc-cmos) Integrated 2 consecutive messages

    Signed-off-by: Joe Perches
    Acked-by: Alexandre Belloni
    Cc: Alessandro Zummo
    Cc: Joshua Kinard
    Cc: Chanwoo Choi
    Reviewed-by: Krzysztof Kozlowski
    Tested-by: Krzysztof Kozlowski
    Cc: Aaro Koskinen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Fix two minor sparse warnings:

    CHECK drivers/rtc/rtc-ds1685.c
    drivers/rtc/rtc-ds1685.c:2178:1: warning: function 'ds1685_rtc_poweroff' with external linkage has definition
    drivers/rtc/rtc-ds1685.c:802:23: warning: Using plain integer as NULL pointer

    Fixes: aaaf5fbf56f1 ("rtc: add driver for DS1685 family of real time clocks")
    Signed-off-by: Joshua Kinard
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joshua Kinard
     
  • The rtc driver core now sets the platform_driver 'owner' property, so
    remove the assignment from the DS1685 driver.

    Fixes: aaaf5fbf56f1: "rtc: add driver for DS1685 family of real time clocks"
    Signed-off-by: Joshua Kinard
    Reported-by: kbuild test robot
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joshua Kinard
     

01 Mar, 2015

3 commits

  • Fix a conditional statement checking for NULL in both
    ds1685_rtc_sysfs_time_regs_show and ds1685_rtc_sysfs_time_regs_store
    that was using a logical AND when it should be using a logical OR so
    that we fail out of the function properly if the condition ever
    evaluates to true.

    Fixes: aaaf5fbf56f1 ("rtc: add driver for DS1685 family of real time clocks")
    Signed-off-by: Joshua Kinard
    Reported-by: Dan Carpenter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joshua Kinard
     
  • drivers/rtc/rtc-ds1685.c: In function `ds1685_rtc_read_alarm':
    drivers/rtc/rtc-ds1685.c:402: warning: comparison is always true due to limited range of data type
    drivers/rtc/rtc-ds1685.c:409: warning: comparison is always true due to limited range of data type
    drivers/rtc/rtc-ds1685.c:416: warning: comparison is always true due to limited range of data type
    drivers/rtc/rtc-ds1685.c: In function `ds1685_rtc_set_alarm':
    drivers/rtc/rtc-ds1685.c:475: warning: comparison is always true due to limited range of data type
    drivers/rtc/rtc-ds1685.c:478: warning: comparison is always true due to limited range of data type
    drivers/rtc/rtc-ds1685.c:481: warning: comparison is always true due to limited range of data type

    u8 cannot contain a value larger than 0xff, hence drop the checks.
    Wrapping the checks in unlikely() indicated some sense of humor, though ;-)

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Joshua Kinard
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     
  • The newly added ds1685 driver causes a build error when enabled without
    CONFIG_RTC_INTF_DEV:

    drivers/rtc/rtc-ds1685.c:919:22: error: 'ds1685_rtc_alarm_irq_enable' undeclared here (not in a function)
    .alarm_irq_enable = ds1685_rtc_alarm_irq_enable,

    Apparently the driver was incorrectly changed to reflect the interface
    change from 16380c153a69c ("RTC: Convert rtc drivers to use the
    alarm_irq_enable method"), which removed the respective #ifdef from all
    other rtc drivers.

    This does the same change that was merged for the other drivers before and
    removes the #ifdef, allowing the interrupts to be enabled through the
    in-kernel rtc interface independent of the existence of /dev/rtc.

    Fixes: aaaf5fbf56f ("rtc: add driver for DS1685 family of real time clocks")
    Signed-off-by: Arnd Bergmann
    Acked-by: Joshua Kinard
    Cc: Ralf Baechle
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

17 Feb, 2015

1 commit

  • This adds a driver for the Dallas/Maxim DS1685-family of RTC chips. It
    supports the DS1685/DS1687, DS1688/DS1691, DS1689/DS1693, DS17285/DS17287,
    DS17485/DS17487, and DS17885/DS17887 RTC chips. These chips are commonly
    found in SGI O2 and SGI Octane systems. It was originally derived from a
    driver patch submitted by Matthias Fuchs many years ago for use in
    EPPC-405-UC modules, which also used these RTCs. In addition to the
    time-keeping functions, this RTC also handles the shutdown mechanism of
    the O2 and Octane and acts as a partial NVRAM for the boot PROMS in these
    systems.

    Verified on both an SGI O2 and an SGI Octane.

    Signed-off-by: Joshua Kinard
    Cc: Ralf Baechle
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joshua Kinard