aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-10-28hwmon: (s3c-hwmon) Depend on S3C_ADCMaurus Cuelenaere1-4/+4
This way we don't need to modify Kconfig every time a new SoC comes along to make this driver support it. Also fix some typos while I'm at it. Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com> Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (s3c-hwmon) Use a real mutexThomas Gleixner1-4/+4
The semaphore which protects the ADC is semantically a mutex. Use a real mutex. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm75) Trivial changes to pacify the checkpatchShubhrajyoti D1-21/+23
Some trivial changes to pacify the checkpatch. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm75) Make the writing to sysfs more robustShubhrajyoti D1-1/+6
Currently we get the checkpatch warning consider using strict_strtol in preference to simple_strtol. Also we should not allow any partially numeric values. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Add support for the W83L771W/GJean Delvare2-7/+20
I was wondering if that chip ever existed publicly... Apparently yes, so add support for it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28hwmon: (lm90) Add support for update_interval sysfs attributeGuenter Roeck1-5/+92
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Introduce capability flag to indicate broken ALERT functionalityGuenter Roeck1-3/+6
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Introduce chip parameter structureGuenter Roeck1-32/+60
Instead of using switch/case and if statements in probe, define chip specific functionality in a parameter structure array. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Rearrange code to no longer require forward declarationsGuenter Roeck1-267/+256
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Add support for max6695 and max6696Guenter Roeck2-24/+230
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Add support for extra features of max6659Guenter Roeck1-6/+59
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Add explicit support for max6659Guenter Roeck1-11/+21
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Simplify set_temp11 register calculationsGuenter Roeck1-27/+28
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Introduce function to delete sysfs filesGuenter Roeck1-7/+11
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Introduce device feature bitsGuenter Roeck1-14/+26
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (lm90) Fix checkpatch errorsGuenter Roeck1-25/+51
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28hwmon: (k8temp) Remove superfluous CPU family checkAndreas Herrmann1-29/+22
The family check in k8temp is not required because the driver is already bound to a northbridge device only used with K8 CPUs. Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-25hwmon: lis3: Release resources in case of failureSamu Onkalo1-0/+5
If lis3lv02d_init_device fails, HW resources were not released properly. In case of failure call release_resources if available. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: Enhance lis3 selftest with IRQ line testSamu Onkalo2-9/+82
Configure chip to data ready mode in selftest and count received interrupts to see that interrupt line(s) are working. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: use block read to access data registersSamu Onkalo3-3/+32
Add optional blockread function to interface driver. If available the chip driver uses it for data register access. For 12 bit device it reads 6 bytes to get 3*16bit data. For 8 bit device it reads out 5 bytes since every second byte is dummy. This optimizes bus usage and reduces number of operations and interrupts needed for one data update. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: Adjust fuzziness for 8 bit deviceSamu Onkalo1-4/+14
Default fuziness is set smaller for 8 device. In 12 bit device LSB is quite close to 1 mg (mg = 1 / 1000 of earth gravity). In 8bit device LSB is about 18 mg. Set fuziness to 1 for 8 bit device. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: New parameters to platform dataSamu Onkalo1-7/+14
Added default output data rate setting to platform data. If default rate is 0, reset default value is used. Added control for duration via platform data. Added possibility to configure interrupts to trig on both rising and falling edge. The lis3 WU unit can be configured quite many ways and with some configurations it is quite handy to get coordinate refresh when some event trigs and when it reason goes away. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: restore axis enabled bitsSamu Onkalo2-2/+2
All axis enable bits are set to 0 at module remove. Restore reset default value at init. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: Power on correctionsSamu Onkalo2-8/+12
Sometimes lis3 chip seems to fail to setup factory tuning at boot up. This probably happens if there is some odd power ramp down ramp up sequence for example in device restart. Set boot bit in control2 register to trig boot sequence manually and wait until it is finished. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: Update coordinates at polled device openSamu Onkalo1-0/+5
Call input device poll function at device open to refresh coordinates immediately. This is needed for the case where poll interval is set to zero and coordinate updates happens purely under interrupt control. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: Cleanup interrupt handlingSamu Onkalo2-22/+13
Irqcfg moved to chip data instead of platform data. This simplifies access in interrupt handler little bit. Input device open and close functions set status for interrupt threaded handler once. Unnecessary check for interrupt source removed since it is enough that active interrupt line indicates that there was an interrupt. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: regulator controlSamu Onkalo3-1/+119
Based on pm_runtime control, turn lis3 regulators on and off. Perform context save and restore on transitions. Feature is optional and must be enabled in platform data. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: lis3: pm_runtime supportSamu Onkalo3-13/+102
Add pm_runtime support to lis3 core driver. Add pm_runtime support to lis3 i2c driver. spi and hp_accel drivers are not yet supported. Old always on functionality remains for those. For sysfs there is 5 second delay before turning off the chip to avoid long ramp up delay. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: add generic GPIO fan driverSimon Guinot3-0/+568
This patch adds hwmon support for fans connected to GPIO lines. Platform specific information such as GPIO pinout and speed conversion array (rpm from/to GPIO value) are passed to the driver via platform_data. Signed-off-by: Simon Guinot <sguinot@lacie.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: (coretemp) fix reading of microcode revision (v2)Jan Beulich1-2/+18
According to the documentation, simply reading the respective MSR isn't sufficient: It should be written with zeros, cpuid(1) be executed, and then read (see arch/x86/kernel/cpu/intel.c for an example). v2: Fail probe when microcode revision cannot be determined, but is needed to check for proper operation. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Chen Gong <gong.chen@linux.intel.com> Cc: Jean Delvare <khali@linux-fr.org> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: ({core, pkg, via-cpu}temp) remove unnecessary CONFIG_HOTPLUG_CPU ifdefsChen Gong3-14/+3
CONFIG_HOTPLUG_CPU is used too much in some drivers. This patch clean them up. Signed-off-by: Chen Gong <gong.chen@linux.intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: (pkgtemp) align driver initialization style with coretempChen Gong1-14/+8
pkgtemp is derived from coretemp, so some reasonable logics should be applied onto pkgtemp, too. Such as the init logic here. Signed-off-by: Chen Gong <gong.chen@linux.intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: LTC4261 Hardware monitoring driverGuenter Roeck3-0/+327
This driver adds support for Linear Technology LTC4261 I2C Negative Voltage Hot Swap Controller. Reviewed-by: Ira W. Snyder <iws@ovro.caltech.edu> Reviewed-by: Tom Grennan <tom.grennan@ericsson.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: (lis3) add axes module parameter for custom axis-mappingTakashi Iwai5-21/+52
The axis-mapping of lis3dev device on many (rather most) HP machines doesn't follow the standard. When each new model appears, users need to adjust again. Testing this requires the rebuild of kernel, thus it's not trivial for end-users. This patch adds a module parameter "axes" to allow a custom axis-mapping without patching and recompiling the kernel driver. User can pass the parameter such as axes=3,2,1. Also it can be changed via sysfs. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Eric Piel <eric.piel@tremplin-utc.net> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: (hp_accel) Add HP Mini 510x family supportMasanari Iida1-1/+1
This patch is an enhanced version of Takashi Iwai's [PATCH] hp_accel: Add quirks for HP ProBook 532x and HP Mini 5102 My HP Mini 5101 works fine with this patch. Confirmed with Tux Racer. Signed-off by: Masanari Iida <standby24x7@gmail.com> Acked-by: Takashi Iwai <tiwai@suse.de> Cc: Eric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25hwmon: (lis3) Add support for new LIS3DC / HP3DC chipTakashi Iwai2-8/+44
A new version of LIS3 chip has slight incompatibilities from former versions. This patch adds the minimal support for it. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25x86/hwmon: remove inclusion of unnecessary headers from {core, pkg, via-cpu}temp.cJan Beulich3-4/+0
These likely originate from these drivers being clones of one another and/or other drivers which actually needed these includes. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25x86/hwmon: (coretemp) cosmetic cleanupJan Beulich1-2/+0
"break" after "return" is at best bogus (good compilers even warn about the "break" being unreachable). Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Rudolf Marek <r.marek@assembler.cz> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25x86/hwmon: {core, pkg, via}cpu_temp_device_remove() can all be __cpuinitJan Beulich3-3/+3
... as they're being called only from a __cpuinit function. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-25Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86Linus Torvalds3-658/+0
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86: (44 commits) eeepc-wmi: Add cpufv sysfs interface eeepc-wmi: add additional hotkeys panasonic-laptop: Simplify calls to acpi_pcc_retrieve_biosdata panasonic-laptop: Handle errors properly if they happen intel_pmic_gpio: fix off-by-one value range checking IBM Real-Time "SMI Free" mode driver -v7 Add OLPC XO-1 rfkill driver Move hdaps driver to platform/x86 ideapad-laptop: Fix Makefile intel_pmic_gpio: swap the bits and mask args for intel_scu_ipc_update_register ideapad: Add param: no_bt_rfkill ideapad: Change the driver name to ideapad-laptop ideapad: rewrite the sw rfkill set ideapad: rewrite the hw rfkill notify ideapad: use EC command to control camera ideapad: use return value of _CFG to tell if device exist or not ideapad: make sure we bind on the correct device ideapad: check VPC bit before sync rfkill hw status ideapad: add ACPI helpers dell-laptop: Add debugfs support ...
2010-10-24Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivialLinus Torvalds5-6/+6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits) Update broken web addresses in arch directory. Update broken web addresses in the kernel. Revert "drivers/usb: Remove unnecessary return's from void functions" for musb gadget Revert "Fix typo: configuation => configuration" partially ida: document IDA_BITMAP_LONGS calculation ext2: fix a typo on comment in ext2/inode.c drivers/scsi: Remove unnecessary casts of private_data drivers/s390: Remove unnecessary casts of private_data net/sunrpc/rpc_pipe.c: Remove unnecessary casts of private_data drivers/infiniband: Remove unnecessary casts of private_data drivers/gpu/drm: Remove unnecessary casts of private_data kernel/pm_qos_params.c: Remove unnecessary casts of private_data fs/ecryptfs: Remove unnecessary casts of private_data fs/seq_file.c: Remove unnecessary casts of private_data arm: uengine.c: remove C99 comments arm: scoop.c: remove C99 comments Fix typo configue => configure in comments Fix typo: configuation => configuration Fix typo interrest[ing|ed] => interest[ing|ed] Fix various typos of valid in comments ... Fix up trivial conflicts in: drivers/char/ipmi/ipmi_si_intf.c drivers/usb/gadget/rndis.c net/irda/irnet/irnet_ppp.c
2010-10-22Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bklLinus Torvalds1-0/+1
* 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: vfs: make no_llseek the default vfs: don't use BKL in default_llseek llseek: automatically add .llseek fop libfs: use generic_file_llseek for simple_attr mac80211: disallow seeks in minstrel debug code lirc: make chardev nonseekable viotape: use noop_llseek raw: use explicit llseek file operations ibmasmfs: use generic_file_llseek spufs: use llseek in all file operations arm/omap: use generic_file_llseek in iommu_debug lkdtm: use generic_file_llseek in debugfs net/wireless: use generic_file_llseek in debugfs drm: use noop_llseek
2010-10-22Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bklLinus Torvalds2-6/+6
* 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: block: autoconvert trivial BKL users to private mutex drivers: autoconvert trivial BKL users to private mutex ipmi: autoconvert trivial BKL users to private mutex mac: autoconvert trivial BKL users to private mutex mtd: autoconvert trivial BKL users to private mutex scsi: autoconvert trivial BKL users to private mutex Fix up trivial conflicts (due to addition of private mutex right next to deletion of a version string) in drivers/char/pcmcia/cm40[04]0_cs.c
2010-10-21Move hdaps driver to platform/x86Jean Delvare3-658/+0
The hdaps driver isn't a hardware monitoring driver, so it shouldn't live under driver/hwmon. drivers/platform/x86 seems much more appropriate, as the driver is only useful on x86 laptops. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Matthew Garrett <mjg@redhat.com> Cc: Frank Seidel <frank@f-seidel.de> Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-10-18Update broken web addresses in the kernel.Justin P. Mattock5-6/+6
The patch below updates broken web addresses in the kernel Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Cc: Maciej W. Rozycki <macro@linux-mips.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Finn Thain <fthain@telegraphics.com.au> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Matt Turner <mattst88@gmail.com> Cc: Dimitry Torokhov <dmitry.torokhov@gmail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Acked-by: Ben Pfaff <blp@cs.stanford.edu> Acked-by: Hans J. Koch <hjk@linutronix.de> Reviewed-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-10-15llseek: automatically add .llseek fopArnd Bergmann1-0/+1
All file_operations should get a .llseek operation so we can make nonseekable_open the default for future file operations without a .llseek pointer. The three cases that we can automatically detect are no_llseek, seq_lseek and default_llseek. For cases where we can we can automatically prove that the file offset is always ignored, we use noop_llseek, which maintains the current behavior of not returning an error from a seek. New drivers should normally not use noop_llseek but instead use no_llseek and call nonseekable_open at open time. Existing drivers can be converted to do the same when the maintainer knows for certain that no user code relies on calling seek on the device file. The generated code is often incorrectly indented and right now contains comments that clarify for each added line why a specific variant was chosen. In the version that gets submitted upstream, the comments will be gone and I will manually fix the indentation, because there does not seem to be a way to do that using coccinelle. Some amount of new code is currently sitting in linux-next that should get the same modifications, which I will do at the end of the merge window. Many thanks to Julia Lawall for helping me learn to write a semantic patch that does all this. ===== begin semantic patch ===== // This adds an llseek= method to all file operations, // as a preparation for making no_llseek the default. // // The rules are // - use no_llseek explicitly if we do nonseekable_open // - use seq_lseek for sequential files // - use default_llseek if we know we access f_pos // - use noop_llseek if we know we don't access f_pos, // but we still want to allow users to call lseek // @ open1 exists @ identifier nested_open; @@ nested_open(...) { <+... nonseekable_open(...) ...+> } @ open exists@ identifier open_f; identifier i, f; identifier open1.nested_open; @@ int open_f(struct inode *i, struct file *f) { <+... ( nonseekable_open(...) | nested_open(...) ) ...+> } @ read disable optional_qualifier exists @ identifier read_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; expression E; identifier func; @@ ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off) { <+... ( *off = E | *off += E | func(..., off, ...) | E = *off ) ...+> } @ read_no_fpos disable optional_qualifier exists @ identifier read_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; @@ ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off) { ... when != off } @ write @ identifier write_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; expression E; identifier func; @@ ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off) { <+... ( *off = E | *off += E | func(..., off, ...) | E = *off ) ...+> } @ write_no_fpos @ identifier write_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; @@ ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off) { ... when != off } @ fops0 @ identifier fops; @@ struct file_operations fops = { ... }; @ has_llseek depends on fops0 @ identifier fops0.fops; identifier llseek_f; @@ struct file_operations fops = { ... .llseek = llseek_f, ... }; @ has_read depends on fops0 @ identifier fops0.fops; identifier read_f; @@ struct file_operations fops = { ... .read = read_f, ... }; @ has_write depends on fops0 @ identifier fops0.fops; identifier write_f; @@ struct file_operations fops = { ... .write = write_f, ... }; @ has_open depends on fops0 @ identifier fops0.fops; identifier open_f; @@ struct file_operations fops = { ... .open = open_f, ... }; // use no_llseek if we call nonseekable_open //////////////////////////////////////////// @ nonseekable1 depends on !has_llseek && has_open @ identifier fops0.fops; identifier nso ~= "nonseekable_open"; @@ struct file_operations fops = { ... .open = nso, ... +.llseek = no_llseek, /* nonseekable */ }; @ nonseekable2 depends on !has_llseek @ identifier fops0.fops; identifier open.open_f; @@ struct file_operations fops = { ... .open = open_f, ... +.llseek = no_llseek, /* open uses nonseekable */ }; // use seq_lseek for sequential files ///////////////////////////////////// @ seq depends on !has_llseek @ identifier fops0.fops; identifier sr ~= "seq_read"; @@ struct file_operations fops = { ... .read = sr, ... +.llseek = seq_lseek, /* we have seq_read */ }; // use default_llseek if there is a readdir /////////////////////////////////////////// @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier readdir_e; @@ // any other fop is used that changes pos struct file_operations fops = { ... .readdir = readdir_e, ... +.llseek = default_llseek, /* readdir is present */ }; // use default_llseek if at least one of read/write touches f_pos ///////////////////////////////////////////////////////////////// @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier read.read_f; @@ // read fops use offset struct file_operations fops = { ... .read = read_f, ... +.llseek = default_llseek, /* read accesses f_pos */ }; @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier write.write_f; @@ // write fops use offset struct file_operations fops = { ... .write = write_f, ... + .llseek = default_llseek, /* write accesses f_pos */ }; // Use noop_llseek if neither read nor write accesses f_pos /////////////////////////////////////////////////////////// @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier read_no_fpos.read_f; identifier write_no_fpos.write_f; @@ // write fops use offset struct file_operations fops = { ... .write = write_f, .read = read_f, ... +.llseek = noop_llseek, /* read and write both use no f_pos */ }; @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier write_no_fpos.write_f; @@ struct file_operations fops = { ... .write = write_f, ... +.llseek = noop_llseek, /* write uses no f_pos */ }; @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier read_no_fpos.read_f; @@ struct file_operations fops = { ... .read = read_f, ... +.llseek = noop_llseek, /* read uses no f_pos */ }; @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; @@ struct file_operations fops = { ... +.llseek = noop_llseek, /* no read or write fn */ }; ===== End semantic patch ===== Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Julia Lawall <julia@diku.dk> Cc: Christoph Hellwig <hch@infradead.org>
2010-10-05drivers: autoconvert trivial BKL users to private mutexArnd Bergmann2-6/+6
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 <arnd@arndb.de>
2010-10-03hwmon: f71882fg: use a muxed resource lock for the Super I/O portGiel van Schijndel1-13/+19
Sleep while acquiring a resource lock on the Super I/O port. This should prevent collisions from causing the hardware probe to fail with -EBUSY. Signed-off-by: Giel van Schijndel <me@mortis.eu> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-09-28hwmon (coretemp): Fix build breakage if SMP is undefinedGuenter Roeck1-0/+1
Commit e40cc4bdfd4b89813f072f72bd9c7055814d3f0f introduced a build breakage if CONFIG_SMP is undefined. This commit fixes the problem. This fix is only a workaround. For a real fix, cpu_sibling_mask() should be defined in UP include code, eg in linux/smp.h, and asm/smp.h should not be included directly. This fix is currently not possible because asm/smp.h defines cpu_sibling_mask() unconditionally and is included directly from many source files. Reported-by: Ingo Molnar <mingo@elte.hu> Tested-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com>
2010-09-24x86/hwmon: pkgtemp has no dependency on PCIJan Beulich2-2/+1
Other than coretemp, from which this code was apparently derived, there is no PCI specific code in this driver. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>