13 Aug, 2019

1 commit

  • We don't need dev_err() messages when platform_get_irq() fails now that
    platform_get_irq() prints an error message itself when something goes
    wrong. Let's remove these prints with a simple semantic patch.

    //
    @@
    expression ret;
    struct platform_device *E;
    @@

    ret =
    (
    platform_get_irq(E, ...)
    |
    platform_get_irq_byname(E, ...)
    );

    if ( \( ret < 0 \| ret

    While we're here, remove braces on if statements that only have one
    statement (manually).

    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: linux-rtc@vger.kernel.org
    Cc: Greg Kroah-Hartman
    Signed-off-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20190730181557.90391-40-swboyd@chromium.org
    Signed-off-by: Alexandre Belloni

    Stephen Boyd
     

02 Mar, 2018

1 commit


02 Sep, 2016

1 commit

  • Check for rtc_class_ops structures that are only passed to
    devm_rtc_device_register, rtc_device_register,
    platform_device_register_data, all of which declare the corresponding
    parameter as const. Declare rtc_class_ops structures that have these
    properties as const.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct rtc_class_ops i@p = { ... };

    @ok@
    identifier r.i;
    expression e1,e2,e3,e4;
    position p;
    @@
    (
    devm_rtc_device_register(e1,e2,&i@p,e3)
    |
    rtc_device_register(e1,e2,&i@p,e3)
    |
    platform_device_register_data(e1,e2,e3,&i@p,e4)
    )

    @bad@
    position p != {r.p,ok.p};
    identifier r.i;
    @@
    i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct rtc_class_ops i = { ... };
    //

    Signed-off-by: Julia Lawall
    Acked-by: Baruch Siach
    Acked-by: Hans Ulli Kroll
    Acked-by: Linus Walleij
    Acked-by: Thierry Reding
    Signed-off-by: Alexandre Belloni

    Julia Lawall
     

25 Jun, 2015

1 commit

  • Remove unneeded error handling on the result of a call to
    platform_get_resource when the value is passed to devm_ioremap_resource.

    Move the call to platform_get_resource adjacent to the call to
    devm_ioremap_resource to make the connection between them more clear.

    A simplified version of the semantic patch that makes this change is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    expression pdev,res,n,e,e1;
    expression ret != 0;
    identifier l;
    @@

    - res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    ... when != res
    - if (res == NULL) { ... \(goto l;\|return ret;\) }
    ... when != res
    + res = platform_get_resource(pdev, IORESOURCE_MEM, n);
    e = devm_ioremap_resource(e1, res);
    //

    Signed-off-by: Julia Lawall
    [viresh.kumar@linaro.org: acked rtc-spear]
    Acked-by: Viresh Kumar
    Signed-off-by: Alexandre Belloni

    Julia Lawall
     

04 Apr, 2014

1 commit


04 Jul, 2013

1 commit

  • The driver core clears the driver data to NULL after device_release or
    on probe failure, since commit 0998d063100 ("device-core: Ensure drvdata
    = NULL when no driver is bound"). Thus, it is not needed to manually
    clear the device driver data to NULL.

    Signed-off-by: Jingoo Han
    Acked-by: Viresh Kumar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jingoo Han
     

30 Apr, 2013

2 commits


23 Jan, 2013

1 commit

  • Convert all uses of devm_request_and_ioremap() to the newly introduced
    devm_ioremap_resource() which provides more consistent error handling.

    devm_ioremap_resource() provides its own error messages so all explicit
    error messages can be removed from the failure code paths.

    Signed-off-by: Thierry Reding
    Acked-by: Viresh Kumar
    Cc: Alessandro Zummo
    Signed-off-by: Greg Kroah-Hartman

    Thierry Reding
     

04 Jan, 2013

1 commit

  • CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
    markings need to be removed.

    This change removes the use of __devinit, __devexit_p, __devinitdata,
    __devinitconst, and __devexit from these drivers.

    Based on patches originally written by Bill Pemberton, but redone by me
    in order to handle some of the coding style issues better, by hand.

    Cc: Bill Pemberton
    Cc: Alessandro Zummo
    Cc: Srinidhi Kasagar
    Cc: Linus Walleij
    Cc: Mike Frysinger
    Cc: Wan ZongShun
    Cc: Guan Xuetao
    Cc: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

18 Dec, 2012

3 commits

  • The applications can set the RTC hardware to trigger interrupts in one
    of three modes:
    * AIE: Alarm interrupt
    * UIE: Update interrupt (ie: once per second)
    * PIE: Periodic interrupt (sub-second irqs)

    The above defined 3 modes are to be supported in the RTC HW in form of
    interrupts. The SPEAr RTC hardware does not support the later two modes.

    There have been refinements in the RTC core in mainline related to
    use of timer queue infrastructure to manage events in RTC. Please refer
    the below mentioned patch for details:
    * RTC: Rework RTC code to use timerqueue for events
    * SHA ID: 6610e0893b8bc6f59b14fed7f089c5997f035f88

    There have been provisions added to support hardware that do not have
    support the UIE mode. Please refer the following patch.
    * rtc: Provide flag for rtc devices that don't support UIE
    * SHA ID: 4a649903f91232d02284d53724b0a45728111767

    The patch makes use of the provision defined in the above patch to
    update the hardware status of UIE mode.

    Signed-off-by: Deepak Sikri
    Signed-off-by: Viresh Kumar
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Deepak Sikri
     
  • clk_{un}prepare is mandatory for platforms using common clock framework.
    Because for SPEAr we don't do anything in clk_{un}prepare() calls, just
    call them once in probe/remove.

    Signed-off-by: Deepak Sikri
    Signed-off-by: Viresh Kumar
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Deepak Sikri
     
  • Free the rtc-spear driver from tension of freeing resources :) devm_*
    derivatives of multiple routines are used while allocating resources,
    which would be freed automatically by kernel.

    Signed-off-by: Viresh Kumar
    Cc: Deepak Sikri
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Viresh Kumar
     

06 Oct, 2012

1 commit

  • There are several comparisons of a unsigned int to less than zero int
    spear RTC driver. Such a check will always be true. In all these cases a
    signed int is assigned to the unsigned variable, which is checked, before.
    So the right fix is to make the checked variable signed as well. In one
    case the check can be dropped completely, because all it does it returns
    'err' if 'err' is less than zero, otherwise it returns 0. Since in this
    particular case 'err' is always either 0 or less this is the same as just
    returning 'err'.

    The issue has been found using the following coccinelle semantic patch:

    //
    @@
    type T;
    unsigned T i;
    @@
    (
    *i < 0
    |
    *i >= 0
    )
    //

    Signed-off-by: Lars-Peter Clausen
    Cc: Viresh Kumar
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lars-Peter Clausen
     

12 Jul, 2012

1 commit


30 May, 2012

1 commit

  • SPEAr platforms now support DT and so must convert all drivers support DT.
    This patch adds DT probing support for rtc and updates its documentation
    too.

    Signed-off-by: Viresh Kumar
    Cc: Stefan Roese
    Cc: Arnd Bergmann
    Cc: Alessandro Zummo
    Cc: Rajeev Kumar
    Cc: Rob Herring
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Viresh Kumar
     

24 Mar, 2012

3 commits

  • rtc_device_register() calls rtc-spear routines internally. These
    routines call dev_get_drvdata() to get struct spear_rtc_config.
    Currently, platform_set_drvdata is called after rtc device is
    registered. This causes system to crash, as dev_get_drvdata returns
    NULL.

    For this we need to call platform_set_drvdata() before registering rtc
    device. This requires further cleanup, that leads to removal of
    dev_set_drvdata on rtc->dev, which was just not required at all.

    Also, we change the parameter to request_irq and pass pointer to config
    instead of pointer to rtc struct.

    This patch brings all above changes.

    Signed-off-by: Viresh Kumar
    Cc: Shiraz Hashim
    Cc: Deepak Sikri
    Acked-by: Rajeev Kumar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Viresh Kumar
     
  • Define API for '.alarm_irq_enable' to enable and disable alarm irq. This
    is required by the framework else RTC_AIE_ON and RTC_AIE_OFF ioctls
    return errors.

    Signed-off-by: Shiraz Hashim
    Signed-off-by: Viresh Kumar
    Cc: Deepak Sikri
    Acked-by: Rajeev Kumar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shiraz Hashim
     
  • Handle the fix for unbalanced irq for the cases when enable_irq_wake
    fails, and a warning related to same is displayed on the console. The
    workaround is handled at the driver level.

    Signed-off-by: Deepak Sikri
    Signed-off-by: Viresh Kumar
    Acked-by: Rajeev Kumar
    Cc: Shiraz Hashim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Deepak Sikri
     

11 Jan, 2012

1 commit

  • This patch converts the drivers in drivers/rtc/* to use the
    module_platform_driver() macro which makes the code smaller and a bit
    simpler.

    Signed-off-by: Axel Lin
    Acked-by: Mark Brown
    Acked-by: Mike Frysinger
    Acked-by: Guan Xuetao
    Acked-by: Linus Walleij
    Acked-by: Haojian Zhuang
    Cc: Alessandro Zummo
    Cc: Srinidhi Kasagar
    Cc: Lars-Peter Clausen
    Cc: Ben Dooks
    Cc: John Stultz
    Acked-by: Jean-Christophe PLAGNIOL-VILLARD
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     

27 May, 2011

1 commit