04 Dec, 2019

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "A lot of unnecessary code removal in here that ends up decreasing the
    number of lines in the subsystem. The ds1343 and ds1347 drivers got
    cleaned up. The rest are the usual fixes and new features.

    Subsystem:
    - fix warnings and errors with make W=1
    - UIE are now disabled while setting the RTC time
    - UIE are now disallowed when the RTC time is not set.

    Drivers:
    - remove unecessary .remove callbacks
    - Set RTC range for cros-ec, ds1343, ds1347, m41t80, s35390a, vt8500
    - Use devm_platform_ioremap_resource where applicable
    - rv3028: add clock out support"

    * tag 'rtc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (81 commits)
    rtc: Fix Kconfig indentation
    rtc: xgene: Remove unused struct device in struct xgene_rtc_dev
    rtc: sun6i: Remove struct device from sun6i_rtc_dev
    rtc: st-lpc: Remove struct resource from struct st_rtc
    rtc: pcf8523: Remove struct pcf8523
    rtc: meson: remove redundant assignment to variable retries
    rtc: v3020: remove set but unused variable
    rtc: tegra: remove set but unused variable
    rtc: pm8xxx: update kerneldoc for struct pm8xxx_rtc
    rtc: m41t80: remove excess kerneldoc
    rtc: ds1685: fix build error with make W=1
    rtc: ds1685: remove set but unused variables
    rtc: ds1374: remove unused variable
    rtc: sysfs: fix hctosys_show kerneldoc
    rtc: interface: fix kerneldoc comments
    rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions
    rtc: msm6242: Fix reading of 10-hour digit
    rtc: tps65910: allow using RTC without alarm interrupt
    rtc: fsl-ftm-alarm: remove select FSL_RCPM and default y from Kconfig
    rtc: pcf8563: Constify clkout_rates
    ...

    Linus Torvalds
     

27 Nov, 2019

1 commit


23 Oct, 2019

1 commit

  • All watchdog drivers implement the same set of ioctl commands, and
    fortunately all of them are compatible between 32-bit and 64-bit
    architectures.

    Modern drivers always go through drivers/watchdog/wdt.c as an abstraction
    layer, but older ones implement their own file_operations on a character
    device for this.

    Move the handling from fs/compat_ioctl.c into the individual drivers.

    Note that most of the legacy drivers will never be used on 64-bit
    hardware, because they are for an old 32-bit SoC implementation, but
    doing them all at once is safer than trying to guess which ones do
    or do not need the compat_ioctl handling.

    Reviewed-by: Guenter Roeck
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

07 Oct, 2019

1 commit

  • This is a standard BCD RTC that will fail in 2100. The century bits don't
    help because 2100 will be considered a leap year while it is not.

    Link: https://lore.kernel.org/r/20191003213544.5359-1-alexandre.belloni@bootlin.com
    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     

18 Jul, 2019

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "A quiet cycle this time.

    - ds1307: properly handle oscillator failure flags

    - imx-sc: alarm support

    - pcf2123: alarm support, correct offset handling

    - sun6i: add R40 support

    - simplify getting the adapter of an i2c client"

    * tag 'rtc-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (37 commits)
    rtc: wm831x: Add IRQF_ONESHOT flag
    rtc: stm32: remove one condition check in stm32_rtc_set_alarm()
    rtc: pcf2123: Fix build error
    rtc: interface: Change type of 'count' from int to u64
    rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
    rtc: pcf8563: Fix interrupt trigger method
    rtc: pcf2123: fix negative offset rounding
    rtc: pcf2123: add alarm support
    rtc: pcf2123: use %ptR
    rtc: pcf2123: port to regmap
    rtc: pcf2123: remove sysfs register view
    rtc: rx8025: simplify getting the adapter of a client
    rtc: rx8010: simplify getting the adapter of a client
    rtc: rv8803: simplify getting the adapter of a client
    rtc: m41t80: simplify getting the adapter of a client
    rtc: fm3130: simplify getting the adapter of a client
    rtc: tegra: Drop MODULE_ALIAS
    rtc: sun6i: Add R40 compatible
    dt-bindings: rtc: sun6i: Add the R40 RTC compatible
    dt-bindings: rtc: Convert Allwinner A31 RTC to a schema
    ...

    Linus Torvalds
     

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
     

09 Jun, 2019

1 commit


06 May, 2019

1 commit

  • Using scripts/coccinelle/api/stream_open.cocci added in 10dce8af3422
    ("fs: stream_open - opener for stream-like files so that read and write
    can run simultaneously without deadlock"), search and convert to
    stream_open all in-kernel nonseekable_open users for which read and
    write actually do not depend on ppos and where there is no other methods
    in file_operations which assume @offset access.

    I've verified each generated change manually - that it is correct to convert -
    and each other nonseekable_open instance left - that it is either not correct
    to convert there, or that it is not converted due to current stream_open.cocci
    limitations. The script also does not convert files that should be valid to
    convert, but that currently have .llseek = noop_llseek or generic_file_llseek
    for unknown reason despite file being opened with nonseekable_open (e.g.
    drivers/input/mousedev.c)

    Among cases converted 14 were potentially vulnerable to read vs write deadlock
    (see details in 10dce8af3422):

    drivers/char/pcmcia/cm4000_cs.c:1685:7-23: ERROR: cm4000_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/gnss/core.c:45:1-17: ERROR: gnss_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/hid/uhid.c:635:1-17: ERROR: uhid_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/infiniband/core/user_mad.c:988:1-17: ERROR: umad_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/input/evdev.c:527:1-17: ERROR: evdev_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/input/misc/uinput.c:401:1-17: ERROR: uinput_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/isdn/capi/capi.c:963:8-24: ERROR: capi_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/leds/uleds.c:77:1-17: ERROR: uleds_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/media/rc/lirc_dev.c:198:1-17: ERROR: lirc_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/s390/char/fs3270.c:488:1-17: ERROR: fs3270_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/usb/misc/ldusb.c:310:1-17: ERROR: ld_usb_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/xen/evtchn.c:667:8-24: ERROR: evtchn_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    net/batman-adv/icmp_socket.c:80:1-17: ERROR: batadv_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    net/rfkill/core.c:1146:8-24: ERROR: rfkill_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.

    and the rest were just safe to convert to stream_open because their read and
    write do not use ppos at all and corresponding file_operations do not
    have methods that assume @offset file access(*):

    arch/powerpc/platforms/52xx/mpc52xx_gpt.c:631:8-24: WARNING: mpc52xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_ibox_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_ibox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_mbox_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_mbox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_wbox_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_wbox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/um/drivers/harddog_kern.c:88:8-24: WARNING: harddog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/x86/kernel/cpu/microcode/core.c:430:33-49: WARNING: microcode_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/ds1620.c:215:8-24: WARNING: ds1620_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/dtlk.c:301:1-17: WARNING: dtlk_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/ipmi/ipmi_watchdog.c:840:9-25: WARNING: ipmi_wdog_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/pcmcia/scr24x_cs.c:95:8-24: WARNING: scr24x_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/tb0219.c:246:9-25: WARNING: tb0219_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/firewire/nosy.c:306:8-24: WARNING: nosy_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/hwmon/fschmd.c:840:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/hwmon/w83793.c:1344:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/infiniband/core/ucma.c:1747:8-24: WARNING: ucma_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/infiniband/core/ucm.c:1178:8-24: WARNING: ucm_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/infiniband/core/uverbs_main.c:1086:8-24: WARNING: uverbs_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/input/joydev.c:282:1-17: WARNING: joydev_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/pci/switch/switchtec.c:393:1-17: WARNING: switchtec_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/platform/chrome/cros_ec_debugfs.c:135:8-24: WARNING: cros_ec_console_log_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/rtc/rtc-ds1374.c:470:9-25: WARNING: ds1374_wdt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/rtc/rtc-m41t80.c:805:9-25: WARNING: wdt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/s390/char/tape_char.c:293:2-18: WARNING: tape_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/s390/char/zcore.c:194:8-24: WARNING: zcore_reipl_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/s390/crypto/zcrypt_api.c:528:8-24: WARNING: zcrypt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/spi/spidev.c:594:1-17: WARNING: spidev_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/staging/pi433/pi433_if.c:974:1-17: WARNING: pi433_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/acquirewdt.c:203:8-24: WARNING: acq_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/advantechwdt.c:202:8-24: WARNING: advwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/alim1535_wdt.c:252:8-24: WARNING: ali_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/alim7101_wdt.c:217:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ar7_wdt.c:166:8-24: WARNING: ar7_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/at91rm9200_wdt.c:113:8-24: WARNING: at91wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ath79_wdt.c:135:8-24: WARNING: ath79_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/bcm63xx_wdt.c:119:8-24: WARNING: bcm63xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/cpu5wdt.c:143:8-24: WARNING: cpu5wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/cpwd.c:397:8-24: WARNING: cpwd_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/eurotechwdt.c:319:8-24: WARNING: eurwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/f71808e_wdt.c:528:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/gef_wdt.c:232:8-24: WARNING: gef_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/geodewdt.c:95:8-24: WARNING: geodewdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ib700wdt.c:241:8-24: WARNING: ibwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ibmasr.c:326:8-24: WARNING: asr_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/indydog.c:80:8-24: WARNING: indydog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/intel_scu_watchdog.c:307:8-24: WARNING: intel_scu_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/iop_wdt.c:104:8-24: WARNING: iop_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/it8712f_wdt.c:330:8-24: WARNING: it8712f_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ixp4xx_wdt.c:68:8-24: WARNING: ixp4xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ks8695_wdt.c:145:8-24: WARNING: ks8695wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/m54xx_wdt.c:88:8-24: WARNING: m54xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/machzwd.c:336:8-24: WARNING: zf_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/mixcomwd.c:153:8-24: WARNING: mixcomwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/mtx-1_wdt.c:121:8-24: WARNING: mtx1_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/mv64x60_wdt.c:136:8-24: WARNING: mv64x60_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/nuc900_wdt.c:134:8-24: WARNING: nuc900wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/nv_tco.c:164:8-24: WARNING: nv_tco_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pc87413_wdt.c:289:8-24: WARNING: pc87413_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd.c:698:8-24: WARNING: pcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd.c:737:8-24: WARNING: pcwd_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_pci.c:581:8-24: WARNING: pcipcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_pci.c:623:8-24: WARNING: pcipcwd_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_usb.c:488:8-24: WARNING: usb_pcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_usb.c:527:8-24: WARNING: usb_pcwd_temperature_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pika_wdt.c:121:8-24: WARNING: pikawdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pnx833x_wdt.c:119:8-24: WARNING: pnx833x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/rc32434_wdt.c:153:8-24: WARNING: rc32434_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/rdc321x_wdt.c:145:8-24: WARNING: rdc321x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/riowd.c:79:1-17: WARNING: riowd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sa1100_wdt.c:62:8-24: WARNING: sa1100dog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc60xxwdt.c:211:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc7240_wdt.c:139:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc8360.c:274:8-24: WARNING: sbc8360_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc_epx_c3.c:81:8-24: WARNING: epx_c3_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc_fitpc2_wdt.c:78:8-24: WARNING: fitpc2_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sb_wdog.c:108:1-17: WARNING: sbwdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sc1200wdt.c:181:8-24: WARNING: sc1200wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sc520_wdt.c:261:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sch311x_wdt.c:319:8-24: WARNING: sch311x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/scx200_wdt.c:105:8-24: WARNING: scx200_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/smsc37b787_wdt.c:369:8-24: WARNING: wb_smsc_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/w83877f_wdt.c:227:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/w83977f_wdt.c:301:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wafer5823wdt.c:200:8-24: WARNING: wafwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/watchdog_dev.c:828:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdrtas.c:379:8-24: WARNING: wdrtas_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdrtas.c:445:8-24: WARNING: wdrtas_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt285.c:104:1-17: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt977.c:276:8-24: WARNING: wdt977_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt.c:424:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt.c:484:8-24: WARNING: wdt_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt_pci.c:464:8-24: WARNING: wdtpci_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt_pci.c:527:8-24: WARNING: wdtpci_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    net/batman-adv/log.c:105:1-17: WARNING: batadv_log_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/control.c:57:7-23: WARNING: snd_ctl_f_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/rawmidi.c:385:7-23: WARNING: snd_rawmidi_f_ops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/seq/seq_clientmgr.c:310:7-23: WARNING: snd_seq_f_ops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/timer.c:1428:7-23: WARNING: snd_timer_f_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.

    One can also recheck/review the patch via generating it with explanation comments included via

    $ make coccicheck MODE=patch COCCI=scripts/coccinelle/api/stream_open.cocci SPFLAGS="-D explain"

    (*) This second group also contains cases with read/write deadlocks that
    stream_open.cocci don't yet detect, but which are still valid to convert to
    stream_open since ppos is not used. For example drivers/pci/switch/switchtec.c
    calls wait_for_completion_interruptible() in its .read, but stream_open.cocci
    currently detects only "wait_event*" as blocking.

    Cc: Michael Kerrisk
    Cc: Yongzhi Pan
    Cc: Jonathan Corbet
    Cc: David Vrabel
    Cc: Juergen Gross
    Cc: Miklos Szeredi
    Cc: Tejun Heo
    Cc: Kirill Tkhai
    Cc: Arnd Bergmann
    Cc: Christoph Hellwig
    Cc: Greg Kroah-Hartman
    Cc: Julia Lawall
    Cc: Nikolaus Rath
    Cc: Han-Wen Nienhuys
    Cc: Anatolij Gustschin
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: Anton Ivanov
    Cc: Borislav Petkov
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "James R. Van Zandt"
    Cc: Corey Minyard
    Cc: Harald Welte
    Acked-by: Lubomir Rintel [scr24x_cs]
    Cc: Stefan Richter
    Cc: Johan Hovold
    Cc: David Herrmann
    Cc: Jiri Kosina
    Cc: Benjamin Tissoires
    Cc: Jean Delvare
    Acked-by: Guenter Roeck [watchdog/* hwmon/*]
    Cc: Rudolf Marek
    Cc: Dmitry Torokhov
    Cc: Karsten Keil
    Cc: Jacek Anaszewski
    Cc: Pavel Machek
    Cc: Mauro Carvalho Chehab
    Cc: Kurt Schwemmer
    Acked-by: Logan Gunthorpe [drivers/pci/switch/switchtec]
    Acked-by: Bjorn Helgaas [drivers/pci/switch/switchtec]
    Cc: Benson Leung
    Acked-by: Enric Balletbo i Serra [platform/chrome]
    Cc: Alessandro Zummo
    Acked-by: Alexandre Belloni [rtc/*]
    Cc: Mark Brown
    Cc: Wim Van Sebroeck
    Cc: Florian Fainelli
    Cc: bcm-kernel-feedback-list@broadcom.com
    Cc: Wan ZongShun
    Cc: Zwane Mwaikambo
    Cc: Marek Lindner
    Cc: Simon Wunderlich
    Cc: Antonio Quartulli
    Cc: "David S. Miller"
    Cc: Johannes Berg
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Signed-off-by: Kirill Smelkov

    Kirill Smelkov
     

11 Dec, 2018

1 commit


14 Nov, 2018

2 commits

  • Complement commit 85d77047c4ea ("drivers/rtc/rtc-m41t80.c: propagate
    error value from smbus functions") and correct the remaining places that
    fail to propagate the error code from SMBus calls.

    Signed-off-by: Maciej W. Rozycki
    References: 85d77047c4ea ("drivers/rtc/rtc-m41t80.c: propagate error value from smbus functions")
    Signed-off-by: Alexandre Belloni

    Maciej W. Rozycki
     
  • Add the missing adjustment of the month range on alarm reads from the
    RTC, correcting an issue coming from commit 9c6dfed92c3e ("rtc: m41t80:
    add alarm functionality"). The range is 1-12 for hardware and 0-11 for
    `struct rtc_time', and is already correctly handled on alarm writes to
    the RTC.

    It was correct up until commit 48e9766726eb ("drivers/rtc/rtc-m41t80.c:
    remove disabled alarm functionality") too, which removed the previous
    implementation of alarm support.

    Signed-off-by: Maciej W. Rozycki
    Fixes: 9c6dfed92c3e ("rtc: m41t80: add alarm functionality")
    References: 48e9766726eb ("drivers/rtc/rtc-m41t80.c: remove disabled alarm functionality")
    Cc: stable@vger.kernel.org # 4.7+
    Signed-off-by: Alexandre Belloni

    Maciej W. Rozycki
     

16 Oct, 2018

1 commit

  • In preparation to enabling -Wimplicit-fallthrough, mark switch cases
    where we are expecting to fall through.

    Notice that in this particular case, I replaced "Fall" with a proper
    "Fall through" comment.

    Addresses-Coverity-ID: 1373875 ("Missing break in switch")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Alexandre Belloni

    Gustavo A. R. Silva
     

17 Mar, 2018

3 commits

  • m41t80_get_datetime and m41t80_set_datetime are only used after casting dev
    to an i2c_client. Remove that useless indirection.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • The IRQ is requested before the struct rtc is allocated and registered, but
    this struct is used in the IRQ handler, leading to:

    Unable to handle kernel NULL pointer dereference at virtual address 0000017c
    pgd = a38a2f9b
    [0000017c] *pgd=00000000
    Internal error: Oops: 5 [#1] ARM
    Modules linked in:
    CPU: 0 PID: 613 Comm: irq/48-m41t80 Not tainted 4.16.0-rc1+ #42
    Hardware name: Atmel SAMA5
    PC is at mutex_lock+0x14/0x38
    LR is at m41t80_handle_irq+0x1c/0x9c
    pc : [] lr : [] psr: 20000013
    sp : dec73f30 ip : 00000000 fp : dec56d98
    r10: df437cf0 r9 : c0a03008 r8 : c0145ffc
    r7 : df5c4300 r6 : dec568d0 r5 : df593000 r4 : 0000017c
    r3 : df592800 r2 : 60000013 r1 : df593000 r0 : 0000017c
    Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
    Control: 10c53c7d Table: 20004059 DAC: 00000051
    Process irq/48-m41t80 (pid: 613, stack limit = 0xb52d091e)
    Stack: (0xdec73f30 to 0xdec74000)
    3f20: dec56840 df5c4300 00000001 df5c4300
    3f40: c0145ffc c0146018 dec56840 ffffe000 00000001 c0146290 dec567c0 00000000
    3f60: c0146084 ed7c9a62 c014615c dec56d80 dec567c0 00000000 dec72000 dec56840
    3f80: c014615c c012ffc0 dec72000 dec567c0 c012fe80 00000000 00000000 00000000
    3fa0: 00000000 00000000 00000000 c01010e8 00000000 00000000 00000000 00000000
    3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 29282726 2d2c2b2a
    [] (mutex_lock) from [] (m41t80_handle_irq+0x1c/0x9c)
    [] (m41t80_handle_irq) from [] (irq_thread_fn+0x1c/0x54)
    [] (irq_thread_fn) from [] (irq_thread+0x134/0x1c0)
    [] (irq_thread) from [] (kthread+0x140/0x148)
    [] (kthread) from [] (ret_from_fork+0x14/0x2c)
    Exception stack(0xdec73fb0 to 0xdec73ff8)
    3fa0: 00000000 00000000 00000000 00000000
    3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
    Code: e3c33d7f e3c3303f f5d0f000 e593300c (e1901f9f)
    ---[ end trace 22b027302eb7c604 ]---
    genirq: exiting task "irq/48-m41t80" (613) is an active IRQ thread (irq 48)

    Also, there is another possible race condition. The probe function is not
    allowed to fail after the RTC is registered 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 allocate the rtc
    before requesting the IRQ and register it as late as possible.

    Signed-off-by: Alexandre Belloni

    Alexandre Belloni
     
  • Without CONFIG_RTC_DRV_M41T80_WDT the compiler complains:

    |drivers/rtc/rtc-m41t80.c:76 ‘m41t80_rtc_mutex’ defined but not used [-Wunused-variable]

    Move the variable to the block where it is used.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Alexandre Belloni

    Sebastian Andrzej Siewior
     

02 Mar, 2018

1 commit


08 Nov, 2017

5 commits

  • m41t80_sqw_set_rate will be called with the result from
    m41t80_sqw_round_rate, so might as well make
    m41t80_sqw_set_rate(n) same as
    m41t80_sqw_set_rate(m41t80_sqw_round_rate(n))

    As Russell King wrote[1],
    "clk_round_rate() is supposed to tell you what you end up with if you
    ask clk_set_rate() to set the exact same value you passed in - but
    clk_round_rate() won't modify the hardware."

    [1]
    http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/080175.html

    Signed-off-by: Troy Kisky
    Signed-off-by: Alexandre Belloni

    Troy Kisky
     
  • This is a little more efficient and avoids the warning

    WARNING: possible circular locking dependency detected
    4.14.0-rc7-00010 #16 Not tainted
    ------------------------------------------------------
    kworker/2:1/70 is trying to acquire lock:
    (prepare_lock){+.+.}, at: [] clk_prepare_lock+0x80/0xf4

    but task is already holding lock:
    (i2c_register_adapter){+.+.}, at: []
    i2c_adapter_lock_bus+0x14/0x18

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (i2c_register_adapter){+.+.}:
    rt_mutex_lock+0x44/0x5c
    i2c_adapter_lock_bus+0x14/0x18
    i2c_transfer+0xa8/0xbc
    i2c_smbus_xfer+0x20c/0x5d8
    i2c_smbus_read_byte_data+0x38/0x48
    m41t80_sqw_is_prepared+0x18/0x28

    Signed-off-by: Troy Kisky
    Signed-off-by: Alexandre Belloni

    Troy Kisky
     
  • This is a little more efficient, and avoids the warning

    WARNING: possible circular locking dependency detected
    4.14.0-rc7-00007 #14 Not tainted
    ------------------------------------------------------
    alsactl/330 is trying to acquire lock:
    (prepare_lock){+.+.}, at: [] clk_prepare_lock+0x80/0xf4

    but task is already holding lock:
    (i2c_register_adapter){+.+.}, at: []
    i2c_adapter_lock_bus+0x14/0x18

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (i2c_register_adapter){+.+.}:
    rt_mutex_lock+0x44/0x5c
    i2c_adapter_lock_bus+0x14/0x18
    i2c_transfer+0xa8/0xbc
    i2c_smbus_xfer+0x20c/0x5d8
    i2c_smbus_read_byte_data+0x38/0x48
    m41t80_sqw_recalc_rate+0x24/0x58

    Signed-off-by: Troy Kisky
    Signed-off-by: Alexandre Belloni

    Troy Kisky
     
  • Previously it was returning the best of
    32768, 8192, 1024, 64, 2, 0

    Now, best of
    32768, 8192, 4096, 2048, 1024, 512, 256, 128,
    64, 32, 16, 8, 4, 2, 1, 0

    Signed-off-by: Troy Kisky
    Signed-off-by: Alexandre Belloni

    Troy Kisky
     
  • Previously it was returning -EINVAL upon success.

    Signed-off-by: Troy Kisky
    Signed-off-by: Alexandre Belloni

    Troy Kisky
     

24 Aug, 2017

2 commits


31 May, 2017

4 commits


20 Apr, 2017

1 commit


09 Mar, 2017

1 commit

  • The driver doesn't have a struct of_device_id table but supported devices
    are registered via Device Trees. This is working on the assumption that a
    I2C device registered via OF will always match a legacy I2C device ID and
    that the MODALIAS reported will always be of the form i2c:.

    But this could change in the future so the correct approach is to have an
    OF device ID table if the devices are registered via OF.

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: Alexandre Belloni

    Javier Martinez Canillas
     

22 Jul, 2016

2 commits


19 Jul, 2016

1 commit

  • If devm_add_action() fails we are explicitly calling the cleanup to free
    the resources allocated. Lets use the helper devm_add_action_or_reset()
    and return directly in case of error, as we know that the cleanup function
    has been already called by the helper if there was any error.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Alexandre Belloni

    Sudip Mukherjee
     

09 Jul, 2016

1 commit


20 May, 2016

7 commits