forked from Minki/linux
c5bf68fe0c
Using scripts/coccinelle/api/stream_open.cocci added in10dce8af34
("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 in10dce8af34
): 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 <mtk.manpages@gmail.com> Cc: Yongzhi Pan <panyongzhi@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: David Vrabel <david.vrabel@citrix.com> Cc: Juergen Gross <jgross@suse.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Cc: Tejun Heo <tj@kernel.org> Cc: Kirill Tkhai <ktkhai@virtuozzo.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Christoph Hellwig <hch@lst.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Julia Lawall <Julia.Lawall@lip6.fr> Cc: Nikolaus Rath <Nikolaus@rath.org> Cc: Han-Wen Nienhuys <hanwen@google.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Jeff Dike <jdike@addtoit.com> Cc: Richard Weinberger <richard@nod.at> Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "James R. Van Zandt" <jrv@vanzandt.mv.com> Cc: Corey Minyard <minyard@acm.org> Cc: Harald Welte <laforge@gnumonks.org> Acked-by: Lubomir Rintel <lkundrak@v3.sk> [scr24x_cs] Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: Johan Hovold <johan@kernel.org> Cc: David Herrmann <dh.herrmann@googlemail.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: Jean Delvare <jdelvare@suse.com> Acked-by: Guenter Roeck <linux@roeck-us.net> [watchdog/* hwmon/*] Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Karsten Keil <isdn@linux-pingi.de> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Kurt Schwemmer <kurt.schwemmer@microsemi.com> Acked-by: Logan Gunthorpe <logang@deltatee.com> [drivers/pci/switch/switchtec] Acked-by: Bjorn Helgaas <bhelgaas@google.com> [drivers/pci/switch/switchtec] Cc: Benson Leung <bleung@chromium.org> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> [platform/chrome] Cc: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> [rtc/*] Cc: Mark Brown <broonie@kernel.org> Cc: Wim Van Sebroeck <wim@linux-watchdog.org> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Zwane Mwaikambo <zwanem@gmail.com> Cc: Marek Lindner <mareklindner@neomailbox.ch> Cc: Simon Wunderlich <sw@simonwunderlich.de> Cc: Antonio Quartulli <a@unstable.cc> Cc: "David S. Miller" <davem@davemloft.net> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Signed-off-by: Kirill Smelkov <kirr@nexedi.com>
680 lines
16 KiB
C
680 lines
16 KiB
C
/* cpwd.c - driver implementation for hardware watchdog
|
|
* timers found on Sun Microsystems CP1400 and CP1500 boards.
|
|
*
|
|
* This device supports both the generic Linux watchdog
|
|
* interface and Solaris-compatible ioctls as best it is
|
|
* able.
|
|
*
|
|
* NOTE: CP1400 systems appear to have a defective intr_mask
|
|
* register on the PLD, preventing the disabling of
|
|
* timer interrupts. We use a timer to periodically
|
|
* reset 'stopped' watchdogs on affected platforms.
|
|
*
|
|
* Copyright (c) 2000 Eric Brower (ebrower@usa.net)
|
|
* Copyright (C) 2008 David S. Miller <davem@davemloft.net>
|
|
*/
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/major.h>
|
|
#include <linux/miscdevice.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/timer.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/io.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/uaccess.h>
|
|
|
|
#include <asm/irq.h>
|
|
#include <asm/watchdog.h>
|
|
|
|
#define DRIVER_NAME "cpwd"
|
|
|
|
#define WD_OBPNAME "watchdog"
|
|
#define WD_BADMODEL "SUNW,501-5336"
|
|
#define WD_BTIMEOUT (jiffies + (HZ * 1000))
|
|
#define WD_BLIMIT 0xFFFF
|
|
|
|
#define WD0_MINOR 212
|
|
#define WD1_MINOR 213
|
|
#define WD2_MINOR 214
|
|
|
|
/* Internal driver definitions. */
|
|
#define WD0_ID 0
|
|
#define WD1_ID 1
|
|
#define WD2_ID 2
|
|
#define WD_NUMDEVS 3
|
|
|
|
#define WD_INTR_OFF 0
|
|
#define WD_INTR_ON 1
|
|
|
|
#define WD_STAT_INIT 0x01 /* Watchdog timer is initialized */
|
|
#define WD_STAT_BSTOP 0x02 /* Watchdog timer is brokenstopped */
|
|
#define WD_STAT_SVCD 0x04 /* Watchdog interrupt occurred */
|
|
|
|
/* Register value definitions
|
|
*/
|
|
#define WD0_INTR_MASK 0x01 /* Watchdog device interrupt masks */
|
|
#define WD1_INTR_MASK 0x02
|
|
#define WD2_INTR_MASK 0x04
|
|
|
|
#define WD_S_RUNNING 0x01 /* Watchdog device status running */
|
|
#define WD_S_EXPIRED 0x02 /* Watchdog device status expired */
|
|
|
|
struct cpwd {
|
|
void __iomem *regs;
|
|
spinlock_t lock;
|
|
|
|
unsigned int irq;
|
|
|
|
unsigned long timeout;
|
|
bool enabled;
|
|
bool reboot;
|
|
bool broken;
|
|
bool initialized;
|
|
|
|
struct {
|
|
struct miscdevice misc;
|
|
void __iomem *regs;
|
|
u8 intr_mask;
|
|
u8 runstatus;
|
|
u16 timeout;
|
|
} devs[WD_NUMDEVS];
|
|
};
|
|
|
|
static DEFINE_MUTEX(cpwd_mutex);
|
|
static struct cpwd *cpwd_device;
|
|
|
|
/* Sun uses Altera PLD EPF8820ATC144-4
|
|
* providing three hardware watchdogs:
|
|
*
|
|
* 1) RIC - sends an interrupt when triggered
|
|
* 2) XIR - asserts XIR_B_RESET when triggered, resets CPU
|
|
* 3) POR - asserts POR_B_RESET when triggered, resets CPU, backplane, board
|
|
*
|
|
*** Timer register block definition (struct wd_timer_regblk)
|
|
*
|
|
* dcntr and limit registers (halfword access):
|
|
* -------------------
|
|
* | 15 | ...| 1 | 0 |
|
|
* -------------------
|
|
* |- counter val -|
|
|
* -------------------
|
|
* dcntr - Current 16-bit downcounter value.
|
|
* When downcounter reaches '0' watchdog expires.
|
|
* Reading this register resets downcounter with
|
|
* 'limit' value.
|
|
* limit - 16-bit countdown value in 1/10th second increments.
|
|
* Writing this register begins countdown with input value.
|
|
* Reading from this register does not affect counter.
|
|
* NOTES: After watchdog reset, dcntr and limit contain '1'
|
|
*
|
|
* status register (byte access):
|
|
* ---------------------------
|
|
* | 7 | ... | 2 | 1 | 0 |
|
|
* --------------+------------
|
|
* |- UNUSED -| EXP | RUN |
|
|
* ---------------------------
|
|
* status- Bit 0 - Watchdog is running
|
|
* Bit 1 - Watchdog has expired
|
|
*
|
|
*** PLD register block definition (struct wd_pld_regblk)
|
|
*
|
|
* intr_mask register (byte access):
|
|
* ---------------------------------
|
|
* | 7 | ... | 3 | 2 | 1 | 0 |
|
|
* +-------------+------------------
|
|
* |- UNUSED -| WD3 | WD2 | WD1 |
|
|
* ---------------------------------
|
|
* WD3 - 1 == Interrupt disabled for watchdog 3
|
|
* WD2 - 1 == Interrupt disabled for watchdog 2
|
|
* WD1 - 1 == Interrupt disabled for watchdog 1
|
|
*
|
|
* pld_status register (byte access):
|
|
* UNKNOWN, MAGICAL MYSTERY REGISTER
|
|
*
|
|
*/
|
|
#define WD_TIMER_REGSZ 16
|
|
#define WD0_OFF 0
|
|
#define WD1_OFF (WD_TIMER_REGSZ * 1)
|
|
#define WD2_OFF (WD_TIMER_REGSZ * 2)
|
|
#define PLD_OFF (WD_TIMER_REGSZ * 3)
|
|
|
|
#define WD_DCNTR 0x00
|
|
#define WD_LIMIT 0x04
|
|
#define WD_STATUS 0x08
|
|
|
|
#define PLD_IMASK (PLD_OFF + 0x00)
|
|
#define PLD_STATUS (PLD_OFF + 0x04)
|
|
|
|
static struct timer_list cpwd_timer;
|
|
|
|
static int wd0_timeout;
|
|
static int wd1_timeout;
|
|
static int wd2_timeout;
|
|
|
|
module_param(wd0_timeout, int, 0);
|
|
MODULE_PARM_DESC(wd0_timeout, "Default watchdog0 timeout in 1/10secs");
|
|
module_param(wd1_timeout, int, 0);
|
|
MODULE_PARM_DESC(wd1_timeout, "Default watchdog1 timeout in 1/10secs");
|
|
module_param(wd2_timeout, int, 0);
|
|
MODULE_PARM_DESC(wd2_timeout, "Default watchdog2 timeout in 1/10secs");
|
|
|
|
MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
|
|
MODULE_DESCRIPTION("Hardware watchdog driver for Sun Microsystems CP1400/1500");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_SUPPORTED_DEVICE("watchdog");
|
|
|
|
static void cpwd_writew(u16 val, void __iomem *addr)
|
|
{
|
|
writew(cpu_to_le16(val), addr);
|
|
}
|
|
static u16 cpwd_readw(void __iomem *addr)
|
|
{
|
|
u16 val = readw(addr);
|
|
|
|
return le16_to_cpu(val);
|
|
}
|
|
|
|
static void cpwd_writeb(u8 val, void __iomem *addr)
|
|
{
|
|
writeb(val, addr);
|
|
}
|
|
|
|
static u8 cpwd_readb(void __iomem *addr)
|
|
{
|
|
return readb(addr);
|
|
}
|
|
|
|
/* Enable or disable watchdog interrupts
|
|
* Because of the CP1400 defect this should only be
|
|
* called during initialzation or by wd_[start|stop]timer()
|
|
*
|
|
* index - sub-device index, or -1 for 'all'
|
|
* enable - non-zero to enable interrupts, zero to disable
|
|
*/
|
|
static void cpwd_toggleintr(struct cpwd *p, int index, int enable)
|
|
{
|
|
unsigned char curregs = cpwd_readb(p->regs + PLD_IMASK);
|
|
unsigned char setregs =
|
|
(index == -1) ?
|
|
(WD0_INTR_MASK | WD1_INTR_MASK | WD2_INTR_MASK) :
|
|
(p->devs[index].intr_mask);
|
|
|
|
if (enable == WD_INTR_ON)
|
|
curregs &= ~setregs;
|
|
else
|
|
curregs |= setregs;
|
|
|
|
cpwd_writeb(curregs, p->regs + PLD_IMASK);
|
|
}
|
|
|
|
/* Restarts timer with maximum limit value and
|
|
* does not unset 'brokenstop' value.
|
|
*/
|
|
static void cpwd_resetbrokentimer(struct cpwd *p, int index)
|
|
{
|
|
cpwd_toggleintr(p, index, WD_INTR_ON);
|
|
cpwd_writew(WD_BLIMIT, p->devs[index].regs + WD_LIMIT);
|
|
}
|
|
|
|
/* Timer method called to reset stopped watchdogs--
|
|
* because of the PLD bug on CP1400, we cannot mask
|
|
* interrupts within the PLD so me must continually
|
|
* reset the timers ad infinitum.
|
|
*/
|
|
static void cpwd_brokentimer(struct timer_list *unused)
|
|
{
|
|
struct cpwd *p = cpwd_device;
|
|
int id, tripped = 0;
|
|
|
|
/* kill a running timer instance, in case we
|
|
* were called directly instead of by kernel timer
|
|
*/
|
|
if (timer_pending(&cpwd_timer))
|
|
del_timer(&cpwd_timer);
|
|
|
|
for (id = 0; id < WD_NUMDEVS; id++) {
|
|
if (p->devs[id].runstatus & WD_STAT_BSTOP) {
|
|
++tripped;
|
|
cpwd_resetbrokentimer(p, id);
|
|
}
|
|
}
|
|
|
|
if (tripped) {
|
|
/* there is at least one timer brokenstopped-- reschedule */
|
|
cpwd_timer.expires = WD_BTIMEOUT;
|
|
add_timer(&cpwd_timer);
|
|
}
|
|
}
|
|
|
|
/* Reset countdown timer with 'limit' value and continue countdown.
|
|
* This will not start a stopped timer.
|
|
*/
|
|
static void cpwd_pingtimer(struct cpwd *p, int index)
|
|
{
|
|
if (cpwd_readb(p->devs[index].regs + WD_STATUS) & WD_S_RUNNING)
|
|
cpwd_readw(p->devs[index].regs + WD_DCNTR);
|
|
}
|
|
|
|
/* Stop a running watchdog timer-- the timer actually keeps
|
|
* running, but the interrupt is masked so that no action is
|
|
* taken upon expiration.
|
|
*/
|
|
static void cpwd_stoptimer(struct cpwd *p, int index)
|
|
{
|
|
if (cpwd_readb(p->devs[index].regs + WD_STATUS) & WD_S_RUNNING) {
|
|
cpwd_toggleintr(p, index, WD_INTR_OFF);
|
|
|
|
if (p->broken) {
|
|
p->devs[index].runstatus |= WD_STAT_BSTOP;
|
|
cpwd_brokentimer(NULL);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Start a watchdog timer with the specified limit value
|
|
* If the watchdog is running, it will be restarted with
|
|
* the provided limit value.
|
|
*
|
|
* This function will enable interrupts on the specified
|
|
* watchdog.
|
|
*/
|
|
static void cpwd_starttimer(struct cpwd *p, int index)
|
|
{
|
|
if (p->broken)
|
|
p->devs[index].runstatus &= ~WD_STAT_BSTOP;
|
|
|
|
p->devs[index].runstatus &= ~WD_STAT_SVCD;
|
|
|
|
cpwd_writew(p->devs[index].timeout, p->devs[index].regs + WD_LIMIT);
|
|
cpwd_toggleintr(p, index, WD_INTR_ON);
|
|
}
|
|
|
|
static int cpwd_getstatus(struct cpwd *p, int index)
|
|
{
|
|
unsigned char stat = cpwd_readb(p->devs[index].regs + WD_STATUS);
|
|
unsigned char intr = cpwd_readb(p->devs[index].regs + PLD_IMASK);
|
|
unsigned char ret = WD_STOPPED;
|
|
|
|
/* determine STOPPED */
|
|
if (!stat)
|
|
return ret;
|
|
|
|
/* determine EXPIRED vs FREERUN vs RUNNING */
|
|
else if (WD_S_EXPIRED & stat) {
|
|
ret = WD_EXPIRED;
|
|
} else if (WD_S_RUNNING & stat) {
|
|
if (intr & p->devs[index].intr_mask) {
|
|
ret = WD_FREERUN;
|
|
} else {
|
|
/* Fudge WD_EXPIRED status for defective CP1400--
|
|
* IF timer is running
|
|
* AND brokenstop is set
|
|
* AND an interrupt has been serviced
|
|
* we are WD_EXPIRED.
|
|
*
|
|
* IF timer is running
|
|
* AND brokenstop is set
|
|
* AND no interrupt has been serviced
|
|
* we are WD_FREERUN.
|
|
*/
|
|
if (p->broken &&
|
|
(p->devs[index].runstatus & WD_STAT_BSTOP)) {
|
|
if (p->devs[index].runstatus & WD_STAT_SVCD) {
|
|
ret = WD_EXPIRED;
|
|
} else {
|
|
/* we could as well pretend
|
|
* we are expired */
|
|
ret = WD_FREERUN;
|
|
}
|
|
} else {
|
|
ret = WD_RUNNING;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* determine SERVICED */
|
|
if (p->devs[index].runstatus & WD_STAT_SVCD)
|
|
ret |= WD_SERVICED;
|
|
|
|
return ret;
|
|
}
|
|
|
|
static irqreturn_t cpwd_interrupt(int irq, void *dev_id)
|
|
{
|
|
struct cpwd *p = dev_id;
|
|
|
|
/* Only WD0 will interrupt-- others are NMI and we won't
|
|
* see them here....
|
|
*/
|
|
spin_lock_irq(&p->lock);
|
|
|
|
cpwd_stoptimer(p, WD0_ID);
|
|
p->devs[WD0_ID].runstatus |= WD_STAT_SVCD;
|
|
|
|
spin_unlock_irq(&p->lock);
|
|
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
static int cpwd_open(struct inode *inode, struct file *f)
|
|
{
|
|
struct cpwd *p = cpwd_device;
|
|
|
|
mutex_lock(&cpwd_mutex);
|
|
switch (iminor(inode)) {
|
|
case WD0_MINOR:
|
|
case WD1_MINOR:
|
|
case WD2_MINOR:
|
|
break;
|
|
|
|
default:
|
|
mutex_unlock(&cpwd_mutex);
|
|
return -ENODEV;
|
|
}
|
|
|
|
/* Register IRQ on first open of device */
|
|
if (!p->initialized) {
|
|
if (request_irq(p->irq, &cpwd_interrupt,
|
|
IRQF_SHARED, DRIVER_NAME, p)) {
|
|
pr_err("Cannot register IRQ %d\n", p->irq);
|
|
mutex_unlock(&cpwd_mutex);
|
|
return -EBUSY;
|
|
}
|
|
p->initialized = true;
|
|
}
|
|
|
|
mutex_unlock(&cpwd_mutex);
|
|
|
|
return stream_open(inode, f);
|
|
}
|
|
|
|
static int cpwd_release(struct inode *inode, struct file *file)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|
{
|
|
static const struct watchdog_info info = {
|
|
.options = WDIOF_SETTIMEOUT,
|
|
.firmware_version = 1,
|
|
.identity = DRIVER_NAME,
|
|
};
|
|
void __user *argp = (void __user *)arg;
|
|
struct inode *inode = file_inode(file);
|
|
int index = iminor(inode) - WD0_MINOR;
|
|
struct cpwd *p = cpwd_device;
|
|
int setopt = 0;
|
|
|
|
switch (cmd) {
|
|
/* Generic Linux IOCTLs */
|
|
case WDIOC_GETSUPPORT:
|
|
if (copy_to_user(argp, &info, sizeof(struct watchdog_info)))
|
|
return -EFAULT;
|
|
break;
|
|
|
|
case WDIOC_GETSTATUS:
|
|
case WDIOC_GETBOOTSTATUS:
|
|
if (put_user(0, (int __user *)argp))
|
|
return -EFAULT;
|
|
break;
|
|
|
|
case WDIOC_KEEPALIVE:
|
|
cpwd_pingtimer(p, index);
|
|
break;
|
|
|
|
case WDIOC_SETOPTIONS:
|
|
if (copy_from_user(&setopt, argp, sizeof(unsigned int)))
|
|
return -EFAULT;
|
|
|
|
if (setopt & WDIOS_DISABLECARD) {
|
|
if (p->enabled)
|
|
return -EINVAL;
|
|
cpwd_stoptimer(p, index);
|
|
} else if (setopt & WDIOS_ENABLECARD) {
|
|
cpwd_starttimer(p, index);
|
|
} else {
|
|
return -EINVAL;
|
|
}
|
|
break;
|
|
|
|
/* Solaris-compatible IOCTLs */
|
|
case WIOCGSTAT:
|
|
setopt = cpwd_getstatus(p, index);
|
|
if (copy_to_user(argp, &setopt, sizeof(unsigned int)))
|
|
return -EFAULT;
|
|
break;
|
|
|
|
case WIOCSTART:
|
|
cpwd_starttimer(p, index);
|
|
break;
|
|
|
|
case WIOCSTOP:
|
|
if (p->enabled)
|
|
return -EINVAL;
|
|
|
|
cpwd_stoptimer(p, index);
|
|
break;
|
|
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static long cpwd_compat_ioctl(struct file *file, unsigned int cmd,
|
|
unsigned long arg)
|
|
{
|
|
int rval = -ENOIOCTLCMD;
|
|
|
|
switch (cmd) {
|
|
/* solaris ioctls are specific to this driver */
|
|
case WIOCSTART:
|
|
case WIOCSTOP:
|
|
case WIOCGSTAT:
|
|
mutex_lock(&cpwd_mutex);
|
|
rval = cpwd_ioctl(file, cmd, arg);
|
|
mutex_unlock(&cpwd_mutex);
|
|
break;
|
|
|
|
/* everything else is handled by the generic compat layer */
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return rval;
|
|
}
|
|
|
|
static ssize_t cpwd_write(struct file *file, const char __user *buf,
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct inode *inode = file_inode(file);
|
|
struct cpwd *p = cpwd_device;
|
|
int index = iminor(inode);
|
|
|
|
if (count) {
|
|
cpwd_pingtimer(p, index);
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static ssize_t cpwd_read(struct file *file, char __user *buffer,
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static const struct file_operations cpwd_fops = {
|
|
.owner = THIS_MODULE,
|
|
.unlocked_ioctl = cpwd_ioctl,
|
|
.compat_ioctl = cpwd_compat_ioctl,
|
|
.open = cpwd_open,
|
|
.write = cpwd_write,
|
|
.read = cpwd_read,
|
|
.release = cpwd_release,
|
|
.llseek = no_llseek,
|
|
};
|
|
|
|
static int cpwd_probe(struct platform_device *op)
|
|
{
|
|
struct device_node *options;
|
|
const char *str_prop;
|
|
const void *prop_val;
|
|
int i, err = -EINVAL;
|
|
struct cpwd *p;
|
|
|
|
if (cpwd_device)
|
|
return -EINVAL;
|
|
|
|
p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL);
|
|
if (!p)
|
|
return -ENOMEM;
|
|
|
|
p->irq = op->archdata.irqs[0];
|
|
|
|
spin_lock_init(&p->lock);
|
|
|
|
p->regs = of_ioremap(&op->resource[0], 0,
|
|
4 * WD_TIMER_REGSZ, DRIVER_NAME);
|
|
if (!p->regs) {
|
|
pr_err("Unable to map registers\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
options = of_find_node_by_path("/options");
|
|
if (!options) {
|
|
err = -ENODEV;
|
|
pr_err("Unable to find /options node\n");
|
|
goto out_iounmap;
|
|
}
|
|
|
|
prop_val = of_get_property(options, "watchdog-enable?", NULL);
|
|
p->enabled = (prop_val ? true : false);
|
|
|
|
prop_val = of_get_property(options, "watchdog-reboot?", NULL);
|
|
p->reboot = (prop_val ? true : false);
|
|
|
|
str_prop = of_get_property(options, "watchdog-timeout", NULL);
|
|
if (str_prop)
|
|
p->timeout = simple_strtoul(str_prop, NULL, 10);
|
|
|
|
of_node_put(options);
|
|
|
|
/* CP1400s seem to have broken PLD implementations-- the
|
|
* interrupt_mask register cannot be written, so no timer
|
|
* interrupts can be masked within the PLD.
|
|
*/
|
|
str_prop = of_get_property(op->dev.of_node, "model", NULL);
|
|
p->broken = (str_prop && !strcmp(str_prop, WD_BADMODEL));
|
|
|
|
if (!p->enabled)
|
|
cpwd_toggleintr(p, -1, WD_INTR_OFF);
|
|
|
|
for (i = 0; i < WD_NUMDEVS; i++) {
|
|
static const char *cpwd_names[] = { "RIC", "XIR", "POR" };
|
|
static int *parms[] = { &wd0_timeout,
|
|
&wd1_timeout,
|
|
&wd2_timeout };
|
|
struct miscdevice *mp = &p->devs[i].misc;
|
|
|
|
mp->minor = WD0_MINOR + i;
|
|
mp->name = cpwd_names[i];
|
|
mp->fops = &cpwd_fops;
|
|
|
|
p->devs[i].regs = p->regs + (i * WD_TIMER_REGSZ);
|
|
p->devs[i].intr_mask = (WD0_INTR_MASK << i);
|
|
p->devs[i].runstatus &= ~WD_STAT_BSTOP;
|
|
p->devs[i].runstatus |= WD_STAT_INIT;
|
|
p->devs[i].timeout = p->timeout;
|
|
if (*parms[i])
|
|
p->devs[i].timeout = *parms[i];
|
|
|
|
err = misc_register(&p->devs[i].misc);
|
|
if (err) {
|
|
pr_err("Could not register misc device for dev %d\n",
|
|
i);
|
|
goto out_unregister;
|
|
}
|
|
}
|
|
|
|
if (p->broken) {
|
|
timer_setup(&cpwd_timer, cpwd_brokentimer, 0);
|
|
cpwd_timer.expires = WD_BTIMEOUT;
|
|
|
|
pr_info("PLD defect workaround enabled for model %s\n",
|
|
WD_BADMODEL);
|
|
}
|
|
|
|
platform_set_drvdata(op, p);
|
|
cpwd_device = p;
|
|
return 0;
|
|
|
|
out_unregister:
|
|
for (i--; i >= 0; i--)
|
|
misc_deregister(&p->devs[i].misc);
|
|
|
|
out_iounmap:
|
|
of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int cpwd_remove(struct platform_device *op)
|
|
{
|
|
struct cpwd *p = platform_get_drvdata(op);
|
|
int i;
|
|
|
|
for (i = 0; i < WD_NUMDEVS; i++) {
|
|
misc_deregister(&p->devs[i].misc);
|
|
|
|
if (!p->enabled) {
|
|
cpwd_stoptimer(p, i);
|
|
if (p->devs[i].runstatus & WD_STAT_BSTOP)
|
|
cpwd_resetbrokentimer(p, i);
|
|
}
|
|
}
|
|
|
|
if (p->broken)
|
|
del_timer_sync(&cpwd_timer);
|
|
|
|
if (p->initialized)
|
|
free_irq(p->irq, p);
|
|
|
|
of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
|
|
|
|
cpwd_device = NULL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id cpwd_match[] = {
|
|
{
|
|
.name = "watchdog",
|
|
},
|
|
{},
|
|
};
|
|
MODULE_DEVICE_TABLE(of, cpwd_match);
|
|
|
|
static struct platform_driver cpwd_driver = {
|
|
.driver = {
|
|
.name = DRIVER_NAME,
|
|
.of_match_table = cpwd_match,
|
|
},
|
|
.probe = cpwd_probe,
|
|
.remove = cpwd_remove,
|
|
};
|
|
|
|
module_platform_driver(cpwd_driver);
|