Thomas Gleixner
74ba9207e1
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61
...
Based on 1 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 as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
675 mass ave cambridge ma 02139 usa
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-or-later
has been chosen to replace the boilerplate/reference in 441 file(s).
Signed-off-by: Thomas Gleixner <[email protected] >
Reviewed-by: Michael Ellerman <[email protected] > (powerpc)
Reviewed-by: Richard Fontana <[email protected] >
Reviewed-by: Allison Randal <[email protected] >
Reviewed-by: Kate Stewart <[email protected] >
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2019-05-24 17:36:45 +02:00
Kirill Smelkov
c5bf68fe0c
*: convert stream-like files from nonseekable_open -> stream_open
...
Using scripts/coccinelle/api/stream_open.cocci added in 10dce8af34
("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 10dce8af34 ):
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 <[email protected] >
Cc: Yongzhi Pan <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: David Vrabel <[email protected] >
Cc: Juergen Gross <[email protected] >
Cc: Miklos Szeredi <[email protected] >
Cc: Tejun Heo <[email protected] >
Cc: Kirill Tkhai <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Christoph Hellwig <[email protected] >
Cc: Greg Kroah-Hartman <[email protected] >
Cc: Julia Lawall <[email protected] >
Cc: Nikolaus Rath <[email protected] >
Cc: Han-Wen Nienhuys <[email protected] >
Cc: Anatolij Gustschin <[email protected] >
Cc: Jeff Dike <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: Anton Ivanov <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James R. Van Zandt" <[email protected] >
Cc: Corey Minyard <[email protected] >
Cc: Harald Welte <[email protected] >
Acked-by: Lubomir Rintel <[email protected] > [scr24x_cs]
Cc: Stefan Richter <[email protected] >
Cc: Johan Hovold <[email protected] >
Cc: David Herrmann <[email protected] >
Cc: Jiri Kosina <[email protected] >
Cc: Benjamin Tissoires <[email protected] >
Cc: Jean Delvare <[email protected] >
Acked-by: Guenter Roeck <[email protected] > [watchdog/* hwmon/*]
Cc: Rudolf Marek <[email protected] >
Cc: Dmitry Torokhov <[email protected] >
Cc: Karsten Keil <[email protected] >
Cc: Jacek Anaszewski <[email protected] >
Cc: Pavel Machek <[email protected] >
Cc: Mauro Carvalho Chehab <[email protected] >
Cc: Kurt Schwemmer <[email protected] >
Acked-by: Logan Gunthorpe <[email protected] > [drivers/pci/switch/switchtec]
Acked-by: Bjorn Helgaas <[email protected] > [drivers/pci/switch/switchtec]
Cc: Benson Leung <[email protected] >
Acked-by: Enric Balletbo i Serra <[email protected] > [platform/chrome]
Cc: Alessandro Zummo <[email protected] >
Acked-by: Alexandre Belloni <[email protected] > [rtc/*]
Cc: Mark Brown <[email protected] >
Cc: Wim Van Sebroeck <[email protected] >
Cc: Florian Fainelli <[email protected] >
Cc: [email protected]
Cc: Wan ZongShun <[email protected] >
Cc: Zwane Mwaikambo <[email protected] >
Cc: Marek Lindner <[email protected] >
Cc: Simon Wunderlich <[email protected] >
Cc: Antonio Quartulli <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Johannes Berg <[email protected] >
Cc: Jaroslav Kysela <[email protected] >
Cc: Takashi Iwai <[email protected] >
Signed-off-by: Kirill Smelkov <[email protected] >
2019-05-06 17:46:41 +03:00
Guenter Roeck
22ed7883c1
hwmon: (fschmd) Use permission specific SENSOR[_DEVICE]_ATTR variants
...
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.
Also replace any remaining S_<PERMS> in the driver with octal values.
The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/ .
This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.
Signed-off-by: Guenter Roeck <[email protected] >
2018-12-16 15:13:45 -08:00
Wolfram Sang
2b2acdc889
hwmon: (fschmd) fix typo 'can by' to 'can be'
...
Signed-off-by: Wolfram Sang <[email protected] >
Signed-off-by: Guenter Roeck <[email protected] >
2018-05-21 07:51:59 -07:00
Julia Lawall
e34e885b9e
hwmon: (fschmd) use permission-specific DEVICE_ATTR variants
...
Use DEVICE_ATTR_RW for read/write attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.
The conversion was done automatically using coccinelle. It was validated
by compiling both the old and the new source code and comparing its text,
data, and bss size.
Signed-off-by: Julia Lawall <[email protected] >
[groeck: Updated description]
Signed-off-by: Guenter Roeck <[email protected] >
2017-01-02 10:19:45 -08:00
Guenter Roeck
b55f375725
hwmon: Fix checkpatch warning 'quoted string split across lines'
...
Cc: Corentin Labbe <[email protected] >
Cc: Mark M. Hoffman <[email protected] >
Cc: Fenghua Yu <[email protected] >
Cc: Juerg Haefliger <[email protected] >
Cc: Andreas Herrmann <[email protected] >
Cc: Rudolf Marek <[email protected] >
Cc: Jim Cromie <[email protected] >
Cc: Roger Lucas <[email protected] >
Cc: Marc Hulsman <[email protected] >
Signed-off-by: Guenter Roeck <[email protected] >
2013-04-07 21:16:40 -07:00
Guenter Roeck
2a844c148e
hwmon: Replace SENSORS_LIMIT with clamp_val
...
SENSORS_LIMIT and the generic clamp_val have the same functionality,
and clamp_val is more efficient.
This patch reduces text size by 9052 bytes and bss size by 11624 bytes
for x86_64 builds.
Signed-off-by: Guenter Roeck <[email protected] >
Acked-by: George Joseph <[email protected] >
Acked-by: Jean Delvare <[email protected] >
2013-01-25 21:03:54 -08:00
Wim Van Sebroeck
86a1e1896c
watchdog: nowayout is bool
...
nowayout is actually a boolean value.
So make it bool for all watchdog device drivers.
Signed-off-by: Wim Van Sebroeck <[email protected] >
2012-03-27 20:06:02 +02:00
Guenter Roeck
525ad37319
hwmon: (fschmd) Fix checkpatch issues
...
Fixed:
ERROR: that open brace { should be on the previous line
ERROR: trailing statements should be on next line
WARNING: line over 80 characters
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul instead
Modify multi-line comments to follow Documentation/CodingStyle.
Cc: Hans de Goede <[email protected] >
Signed-off-by: Guenter Roeck <[email protected] >
2012-03-18 18:27:03 -07:00
Axel Lin
f0967eea80
hwmon: convert drivers/hwmon/* to use module_i2c_driver()
...
This patch converts the drivers in drivers/hwmon/* to use the
module_i2c_driver() macro which makes the code smaller and a bit simpler.
Signed-off-by: Axel Lin <[email protected] >
Cc: Corentin Labbe <[email protected] >
Cc: Dirk Eibach <[email protected] >
Cc: "Mark M. Hoffman" <[email protected] >
Cc: Steve Glendinning <[email protected] >
Cc: Riku Voipio <[email protected] >
Cc: Guillaume Ligneul <[email protected] >
Cc: David George <[email protected] >
Cc: "Hans J. Koch" <[email protected] >
Cc: Marc Hulsman <[email protected] >
Cc: Rudolf Marek <[email protected] >
Signed-off-by: Guenter Roeck <[email protected] >
2012-03-18 18:26:50 -07:00
Jean Delvare
1b7243e8f5
hwmon: (fschmd) Drop useless mutex
...
As discussed one year ago, the WDIOC_GETSUPPORT ioctl only needs a
mutex because it operates on a static variable. There is no good
reason to keep this variable static, so let's just make it non-static
and drop the now useless mutex altogether.
See the discussion at:
http://marc.info/?l=lm-sensors&m=125563869402323&w=2
Signed-off-by: Jean Delvare <[email protected] >
Cc: Hans de Goede <[email protected] >
Acked-by: Guenter Roeck <[email protected] >
Acked-by: Arnd Bergmann <[email protected] >
Acked-by: Thomas Gleixner <[email protected] >
2011-01-12 21:55:11 +01:00
Arnd Bergmann
613655fa39
drivers: autoconvert trivial BKL users to private mutex
...
All these files use the big kernel lock in a trivial
way to serialize their private file operations,
typically resulting from an earlier semi-automatic
pushdown from VFS.
None of these drivers appears to want to lock against
other code, and they all use the BKL as the top-level
lock in their file operations, meaning that there
is no lock-order inversion problem.
Consequently, we can remove the BKL completely,
replacing it with a per-file mutex in every case.
Using a scripted approach means we can avoid
typos.
These drivers do not seem to be under active
maintainance from my brief investigation. Apologies
to those maintainers that I have missed.
file=$1
name=$2
if grep -q lock_kernel ${file} ; then
if grep -q 'include.*linux.mutex.h' ${file} ; then
sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
else
sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
fi
sed -i ${file} \
-e "/^#include.*linux.mutex.h/,$ {
1,/^\(static\|int\|long\)/ {
/^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
} }" \
-e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
-e '/[ ]*cycle_kernel_lock();/d'
else
sed -i -e '/include.*\<smp_lock.h\>/d' ${file} \
-e '/cycle_kernel_lock()/d'
fi
Signed-off-by: Arnd Bergmann <[email protected] >
2010-10-05 15:01:04 +02:00
Arnd Bergmann
55929332c9
drivers: Push down BKL into various drivers
...
These are the last remaining device drivers using
the ->ioctl file operation in the drivers directory
(except from v4l drivers).
[fweisbec: drop i8k pushdown as it has been done from
procfs pushdown branch already]
Signed-off-by: Arnd Bergmann <[email protected] >
Signed-off-by: Frederic Weisbecker <[email protected] >
2010-05-17 05:27:41 +02:00
Jean Delvare
dc71afe5ac
hwmon: Fix off-by-one kind values
...
Recent changes on the I2C front have left off-by-one array indexes in
3 hwmon drivers. Fix them.
Faulty commit:
e5e9f44c2 i2c: Drop I2C_CLIENT_INSMOD_2 to 8
Reported-by: Dan Carpenter <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
Cc: Hans de Goede <[email protected] >
Cc: Andre Prendel <[email protected] >
Cc: [email protected]
2010-03-05 22:17:26 +01:00
Hans de Goede
c453615f77
hwmon: (fschmd) Fix a memleak on multiple opens of /dev/watchdog
...
When /dev/watchdog gets opened a second time we return -EBUSY, but
we already have got a kref then, so we end up leaking our data struct.
Signed-off-by: Hans de Goede <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
Cc: [email protected]
2010-01-25 15:00:50 +01:00
Jean Delvare
e5e9f44c24
i2c: Drop I2C_CLIENT_INSMOD_2 to 8
...
These macros simply declare an enum, so drivers might as well declare
it themselves. This puts an end to the arbitrary limit of 8 chip types
per i2c driver.
Signed-off-by: Jean Delvare <[email protected] >
Tested-by: Wolfram Sang <[email protected] >
2009-12-14 21:17:27 +01:00
Jean Delvare
c3813d6af1
i2c: Get rid of struct i2c_client_address_data
...
Struct i2c_client_address_data only contains one field at this point,
which makes its usefulness questionable. Get rid of it and pass simple
address lists around instead.
Signed-off-by: Jean Delvare <[email protected] >
Tested-by: Wolfram Sang <[email protected] >
2009-12-14 21:17:25 +01:00
Jean Delvare
310ec79210
i2c: Drop the kind parameter from detect callbacks
...
The "kind" parameter always has value -1, and nobody is using it any
longer, so we can remove it.
Signed-off-by: Jean Delvare <[email protected] >
Tested-by: Wolfram Sang <[email protected] >
2009-12-14 21:17:23 +01:00
Jean Delvare
52df6440a2
hwmon: Clean up detect functions
...
As kind is now hard-coded to -1, there is room for code clean-ups.
Signed-off-by: Jean Delvare <[email protected] >
Acked-by: Corentin Labbe <[email protected] >
Cc: "Mark M. Hoffman" <[email protected] >
Cc: Juerg Haefliger <[email protected] >
Cc: Riku Voipio <[email protected] >
Acked-by: "Hans J. Koch" <[email protected] >
Cc: Rudolf Marek <[email protected] >
2009-12-09 20:35:57 +01:00
Roel Kluin
c7702c3134
hwmon: (fschmd) Fix check on unsigned in watchdog_write()
...
If unsigned the watchdog_trigger() return value will not be
checked correctly.
Signed-off-by: Roel Kluin <[email protected] >
Acked-by: Andrew Morton <[email protected] >
Cc: Hans de Goede <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
2009-10-24 13:28:45 +02:00
Alexey Dobriyan
828c09509b
const: constify remaining file_operations
...
[[email protected] : fix KVM]
Signed-off-by: Alexey Dobriyan <[email protected] >
Acked-by: Mike Frysinger <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2009-10-01 16:11:11 -07:00
Hans de Goede
de15f093e6
hwmon: (fschmd) Add support for the FSC Hades IC
...
Add support for the Hades to the FSC hwmon driver.
Signed-off-by: Hans de Goede <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
2009-03-30 21:46:45 +02:00
Hans de Goede
c69ab2b78e
hwmon: (fschmd) Add support for the FSC Syleus IC
...
Many thanks to Fujitsu Siemens Computers for providing docs and a
machine to test the driver on.
Signed-off-by: Hans de Goede <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
2009-03-30 21:46:45 +02:00
Jean Delvare
e7a19c5624
dmi: Let dmi_walk() users pass private data
...
At the moment, dmi_walk() lacks flexibility, users can't pass data to
the callback function. Add a pointer for private data to make this
function more flexible.
Signed-off-by: Jean Delvare <[email protected] >
Cc: Hans de Goede <[email protected] >
Cc: Matthew Garrett <[email protected] >
Cc: Roland Dreier <[email protected] >
2009-03-30 21:46:44 +02:00
Linus Torvalds
2f2408a88c
Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
...
* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: (29 commits)
hwmon: Fix various typos
hwmon: Check for ACPI resource conflicts
hwmon: (lm70) Add TI TMP121 support
hwmon: (lm70) Code streamlining and cleanup
hwmon: Deprecate the fscher and fscpos drivers
hwmon: (fschmd) Add watchdog support
hwmon: (fschmd) Cleanups for watchdog support
hwmon: (i5k_amb) Load automatically on all 5000/5400 chipsets
hwmon: (it87) Add support for the ITE IT8720F
hwmon: Don't overuse I2C_CLIENT_MODULE_PARM
hwmon: Add LTC4245 driver
hwmon: (f71882fg) Fix fan_to/from_reg prototypes
hwmon: (f71882fg) Printout fan modes
hwmon: (f71882fg) Add documentation
hwmon: (f71882fg) Fix auto_channels_temp temp numbering with f8000
hwmon: (f71882fg) Add missing pwm3 attr for f71862fg
hwmon: (f71882fg) Add F8000 support
hwmon: (f71882fg) Remove the fan_mode module option
hwmon: (f71882fg) Separate max and crit alarm and beep
hwmon: (f71882fg) Check for hwmon powerdown state
...
2009-01-07 11:59:51 -08:00
Hans de Goede
97950c3d42
hwmon: (fschmd) Add watchdog support
...
This patch adds support for the watchdog part found in _all_ supported FSC
sensor chips.
Signed-off-by: Hans de Goede <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
2009-01-07 16:37:33 +01:00
Hans de Goede
453e308d77
hwmon: (fschmd) Cleanups for watchdog support
...
Various small cleanups in preparation of adding watchdog support,
mostly removing _MASK postfix from defines which are not masks.
Signed-off-by: Hans de Goede <[email protected] >
Signed-off-by: Jean Delvare <[email protected] >
2009-01-07 16:37:33 +01:00
Frederik Schwarzer
025dfdafe7
trivial: fix then -> than typos in comments and documentation
...
- (better, more, bigger ...) then -> (...) than
Signed-off-by: Frederik Schwarzer <[email protected] >
Signed-off-by: Jiri Kosina <[email protected] >
2009-01-06 11:28:06 +01:00
Jean Delvare
40ac1994bf
hwmon: (fschmd) Convert to a new-style i2c driver
...
The new-style fschmd driver implements the optional detect() callback
to cover the use cases of the legacy driver.
Signed-off-by: Jean Delvare <[email protected] >
Cc: Hans de Goede <[email protected] >
2008-07-16 19:30:12 +02:00
Mark M. Hoffman
25e9c86d5a
hwmon: normal_i2c arrays should be const
...
Signed-off-by: Mark M. Hoffman <[email protected] >
2008-02-18 21:58:15 -05:00
Hans de Goede
7845cd791d
hwmon: (fschmd) Read voltage scaling factors from BIOS DMI
...
This patch adds support to the fschmd driver for reading the voltage scaling
factors from BIOS DMI tables, as specified in the Siemens datasheet.
Signed-off-by: Hans de Goede <[email protected] >
Acked-by: Jean Delvare <[email protected] >
Signed-off-by: Mark M. Hoffman <[email protected] >
2008-02-07 20:39:42 -05:00
Jean Delvare
7dcf9a31ef
hwmon: (fschmd) Discard non-ASCII characters
...
Somehow non-ASCII characters managed to sneak into the fschmd driver.
Kick them out.
Signed-off-by: Jean Delvare <[email protected] >
Cc: Hans de Goede <[email protected] >
Signed-off-by: Mark M. Hoffman <[email protected] >
2008-02-07 20:39:41 -05:00
Hans de Goede
569ff10226
hwmon: Add new combined driver for FSC chips
...
This patch adds a new merged driver for FSC sensor chips, it merges the fscher
and fscpos drivers and adds support for the FSC Scylla, Heracles and Heimdall
chips.
Signed-off-by: Hans de Goede <[email protected] >
Acked-by: Jean Delvare <[email protected] >
Signed-off-by: Mark M. Hoffman <[email protected] >
2007-10-11 08:11:24 -04:00