···71717272---------------------------73737474-What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid7575-When: November 20057676-Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c7777-Why: Match the other drivers' name for the same function, duplicate names7878- will be available until removal of old names.7979-Who: Grant Coady <gcoady@gmail.com>8080-8181----------------------------8282-8374What: remove EXPORT_SYMBOL(panic_timeout)8475When: April 20068576Files: kernel/panic.c
+11-8
Documentation/hwmon/w83627hf
···5454use the w83781d driver. However this is not the preferred method5555now that this ISA driver has been developed.56565757-Technically, the w83627thf does not support a VID reading. However, it's5858-possible or even likely that your mainboard maker has routed these signals5959-to a specific set of general purpose IO pins (the Asus P4C800-E is one such6060-board). The w83627thf driver now interprets these as VID. If the VID on6161-your board doesn't work, first see doc/vid in the lm_sensors package. If6262-that still doesn't help, email us at lm-sensors@lm-sensors.org.5757+The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the5858+same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a5959+VID reading. However the two chips have the identical 128 pin package. So,6060+it is possible or even likely for a w83627thf to have the VID signals routed6161+to these pins despite their not being labeled for that purpose. Therefore,6262+the w83627thf driver interprets these as VID. If the VID on your board6363+doesn't work, first see doc/vid in the lm_sensors package[1]. If that still6464+doesn't help, you may just ignore the bogus VID reading with no harm done.63656464-For further information on this driver see the w83781d driver6565-documentation.6666+For further information on this driver see the w83781d driver documentation.6767+6868+[1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid6669
+2-1
Documentation/i2c/busses/i2c-nforce2
···55 * nForce2 Ultra 400 MCP 10de:0084 66 * nForce3 Pro150 MCP 10de:00D4 77 * nForce3 250Gb MCP 10de:00E4 88- * nForce4 MCP 10de:005288+ * nForce4 MCP 10de:005299+ * nForce4 MCP-04 10de:00349101011Datasheet: not publically available, but seems to be similar to the1112 AMD-8111 SMBus 2.0 adapter.
+1
Documentation/i2c/busses/i2c-parport
···1717 * Velleman K8000 adapter1818 * ELV adapter1919 * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032)2020+ * Barco LPT->DVI (K5800236) adapter20212122These devices use different pinout configurations, so you have to tell2223the driver what you have, using the type module parameter. There is no
+51-35
Documentation/i2c/porting-clients
···11-Revision 5, 2005-07-2911+Revision 6, 2005-11-2022Jean Delvare <khali@linux-fr.org>33Greg KH <greg@kroah.com>4455This is a guide on how to convert I2C chip drivers from Linux 2.4 to66Linux 2.6. I have been using existing drivers (lm75, lm78) as examples.77Then I converted a driver myself (lm83) and updated this document.88+Note that this guide is strongly oriented towards hardware monitoring99+drivers. Many points are still valid for other type of drivers, but1010+others may be irrelevant.811912There are two sets of points below. The first set concerns technical1013changes. The second set concerns coding policy. Both are mandatory.···2522 #include <linux/module.h>2623 #include <linux/init.h>2724 #include <linux/slab.h>2525+ #include <linux/jiffies.h>2826 #include <linux/i2c.h>2727+ #include <linux/i2c-isa.h> /* for ISA drivers */2928 #include <linux/hwmon.h> /* for hardware monitoring drivers */3029 #include <linux/hwmon-sysfs.h>3130 #include <linux/hwmon-vid.h> /* if you need VRM support */3131+ #include <linux/err.h> /* for class registration */3232 #include <asm/io.h> /* if you have I/O operations */3333 Please respect this inclusion order. Some extra headers may be3434 required for a given driver (e.g. "lm75.h").35353636* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses3737- are no more handled by the i2c core.3737+ are no more handled by the i2c core. Address ranges are no more3838+ supported either, define each individual address separately.3839 SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>.39404041* [Client data] Get rid of sysctl_id. Try using standard names for···5548 int kind);5649 static void lm75_init_client(struct i2c_client *client);5750 static int lm75_detach_client(struct i2c_client *client);5858- static void lm75_update_client(struct i2c_client *client);5151+ static struct lm75_data lm75_update_device(struct device *dev);59526053* [Sysctl] All sysctl stuff is of course gone (defines, ctl_table6154 and functions). Instead, you have to define show and set functions for6255 each sysfs file. Only define set for writable values. Take a look at an6363- existing 2.6 driver for details (lm78 for example). Don't forget5656+ existing 2.6 driver for details (it87 for example). Don't forget6457 to define the attributes for each file (this is that step that6558 links callback functions). Use the file names specified in6666- Documentation/i2c/sysfs-interface for the individual files. Also5959+ Documentation/hwmon/sysfs-interface for the individual files. Also6760 convert the units these files read and write to the specified ones.6861 If you need to add a new type of file, please discuss it on the6962 sensors mailing list <lm-sensors@lm-sensors.org> by providing a7070- patch to the Documentation/i2c/sysfs-interface file.6363+ patch to the Documentation/hwmon/sysfs-interface file.71647265* [Attach] For I2C drivers, the attach function should make sure7373- that the adapter's class has I2C_CLASS_HWMON, using the7474- following construct:6666+ that the adapter's class has I2C_CLASS_HWMON (or whatever class is6767+ suitable for your driver), using the following construct:7568 if (!(adapter->class & I2C_CLASS_HWMON))7669 return 0;7770 ISA-only drivers of course don't need this.···79728073* [Detect] As mentioned earlier, the flags parameter is gone.8174 The type_name and client_name strings are replaced by a single8282- name string, which will be filled with a lowercase, short string8383- (typically the driver name, e.g. "lm75").7575+ name string, which will be filled with a lowercase, short string.8476 In i2c-only drivers, drop the i2c_is_isa_adapter check, it's8577 useless. Same for isa-only drivers, as the test would always be8678 true. Only hybrid drivers (which are quite rare) still need it.8787- The errorN labels are reduced to the number needed. If that number8888- is 2 (i2c-only drivers), it is advised that the labels are named8989- exit and exit_free. For i2c+isa drivers, labels should be named9090- ERROR0, ERROR1 and ERROR2. Don't forget to properly set err before7979+ The labels used for error paths are reduced to the number needed.8080+ It is advised that the labels are given descriptive names such as8181+ exit and exit_free. Don't forget to properly set err before9182 jumping to error labels. By the way, labels should be left-aligned.9283 Use kzalloc instead of kmalloc.9384 Use i2c_set_clientdata to set the client data (as opposed to9485 a direct access to client->data).9595- Use strlcpy instead of strcpy to copy the client name.8686+ Use strlcpy instead of strcpy or snprintf to copy the client name.9687 Replace the sysctl directory registration by calls to9788 device_create_file. Move the driver initialization before any9889 sysfs file creation.9090+ Register the client with the hwmon class (using hwmon_device_register)9191+ if applicable.9992 Drop client->id.10093 Drop any 24RF08 corruption prevention you find, as this is now done10194 at the i2c-core level, and doing it twice voids it.9595+ Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now.1029610397* [Init] Limits must not be set by the driver (can be done later in10498 user-space). Chip should not be reset default (although a module105105- parameter may be used to force is), and initialization should be9999+ parameter may be used to force it), and initialization should be106100 limited to the strictly necessary steps.107101108108-* [Detach] Get rid of data, remove the call to109109- i2c_deregister_entry. Do not log an error message if110110- i2c_detach_client fails, as i2c-core will now do it for you.102102+* [Detach] Remove the call to i2c_deregister_entry. Do not log an103103+ error message if i2c_detach_client fails, as i2c-core will now do104104+ it for you.105105+ Unregister from the hwmon class if applicable.111106112112-* [Update] Don't access client->data directly, use113113- i2c_get_clientdata(client) instead.107107+* [Update] The function prototype changed, it is now108108+ passed a device structure, which you have to convert to a client109109+ using to_i2c_client(dev). The update function should return a110110+ pointer to the client data.111111+ Don't access client->data directly, use i2c_get_clientdata(client)112112+ instead.113113+ Use time_after() instead of direct jiffies comparison.114114115115-* [Interface] Init function should not print anything. Make sure116116- there is a MODULE_LICENSE() line, at the bottom of the file117117- (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order).115115+* [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom116116+ of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this117117+ order).118118+119119+* [Driver] The flags field of the i2c_driver structure is gone.120120+ I2C_DF_NOTIFY is now the default behavior.121121+ The i2c_driver structure has a driver member, which is itself a122122+ structure, those name member should be initialized to a driver name123123+ string. i2c_driver itself has no name member anymore.118124119125Coding policy:120126121127* [Copyright] Use (C), not (c), for copyright.122128123129* [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you124124- can. Calls to printk/pr_debug for debugging purposes are replaced125125- by calls to dev_dbg. Here is an example on how to call it (taken126126- from lm75_detect):130130+ can. Calls to printk for debugging purposes are replaced by calls to131131+ dev_dbg where possible, else to pr_debug. Here is an example of how132132+ to call it (taken from lm75_detect):127133 dev_dbg(&client->dev, "Starting lm75 update\n");128134 Replace other printk calls with the dev_info, dev_err or dev_warn129135 function, as appropriate.130136131131-* [Constants] Constants defines (registers, conversions, initial132132- values) should be aligned. This greatly improves readability.133133- Same goes for variables declarations. Alignments are achieved by the134134- means of tabs, not spaces. Remember that tabs are set to 8 in the135135- Linux kernel code.136136-137137-* [Structure definition] The name field should be standardized. All138138- lowercase and as simple as the driver name itself (e.g. "lm75").137137+* [Constants] Constants defines (registers, conversions) should be138138+ aligned. This greatly improves readability.139139+ Alignments are achieved by the means of tabs, not spaces. Remember140140+ that tabs are set to 8 in the Linux kernel code.139141140142* [Layout] Avoid extra empty lines between comments and what they141143 comment. Respect the coding style (see Documentation/CodingStyle),
+6-14
Documentation/i2c/writing-clients
···2525address.26262727static struct i2c_driver foo_driver = {2828- .owner = THIS_MODULE,2929- .name = "Foo version 2.3 driver",3030- .flags = I2C_DF_NOTIFY,2828+ .driver = {2929+ .name = "foo",3030+ },3131 .attach_adapter = &foo_attach_adapter,3232 .detach_client = &foo_detach_client,3333 .command = &foo_command /* may be NULL */···35353636The name field must match the driver name, including the case. It must not3737contain spaces, and may be up to 31 characters long.3838-3939-Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This4040-means that your driver will be notified when new adapters are found.4141-This is almost always what you want.42384339All other fields are for call-back functions which will be explained 4440below.···492496by `__init_data'. Hose functions and structures can be removed after493497kernel booting (or module loading) is completed.494498499499+495500Command function496501================497502498503A generic ioctl-like function call back is supported. You will seldom499499-need this. You may even set it to NULL.500500-501501- /* No commands defined */502502- int foo_command(struct i2c_client *client, unsigned int cmd, void *arg)503503- {504504- return 0;505505- }504504+need this, and its use is deprecated anyway, so newer design should not505505+use it. Set it to NULL.506506507507508508Sending and receiving
+40
Documentation/kbuild/modules.txt
···1818 === 5. Include files1919 --- 5.1 How to include files from the kernel include dir2020 --- 5.2 External modules using an include/ dir2121+ --- 5.3 External modules using several directories2122 === 6. Module installation2223 --- 6.1 INSTALL_MOD_PATH2324 --- 6.2 INSTALL_MOD_DIR···345344 Note that in the assignment there is no space between -I and the path.346345 This is a kbuild limitation: there must be no space present.347346347347+--- 5.3 External modules using several directories348348+349349+ If an external module does not follow the usual kernel style but350350+ decide to spread files over several directories then kbuild can351351+ support this too.352352+353353+ Consider the following example:354354+355355+ |356356+ +- src/complex_main.c357357+ | +- hal/hardwareif.c358358+ | +- hal/include/hardwareif.h359359+ +- include/complex.h360360+361361+ To build a single module named complex.ko we then need the following362362+ kbuild file:363363+364364+ Kbuild:365365+ obj-m := complex.o366366+ complex-y := src/complex_main.o367367+ complex-y += src/hal/hardwareif.o368368+369369+ EXTRA_CFLAGS := -I$(src)/include370370+ EXTRA_CFLAGS += -I$(src)src/hal/include371371+372372+373373+ kbuild knows how to handle .o files located in another directory -374374+ although this is NOT reccommended practice. The syntax is to specify375375+ the directory relative to the directory where the Kbuild file is376376+ located.377377+378378+ To find the .h files we have to explicitly tell kbuild where to look379379+ for the .h files. When kbuild executes current directory is always380380+ the root of the kernel tree (argument to -C) and therefore we have to381381+ tell kbuild how to find the .h files using absolute paths.382382+ $(src) will specify the absolute path to the directory where the383383+ Kbuild file are located when being build as an external module.384384+ Therefore -I$(src)/ is used to point out the directory of the Kbuild385385+ file and any additional path are just appended.348386349387=== 6. Module installation350388
+8
Documentation/kernel-parameters.txt
···910910 nfsroot= [NFS] nfs root filesystem for disk-less boxes.911911 See Documentation/nfsroot.txt.912912913913+ nfs.callback_tcpport=914914+ [NFS] set the TCP port on which the NFSv4 callback915915+ channel should listen.916916+917917+ nfs.idmap_cache_timeout=918918+ [NFS] set the maximum lifetime for idmapper cache919919+ entries.920920+913921 nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels914922915923 no387 [BUGS=IA-32] Tells the kernel to use the 387 maths
+6-7
MAINTAINERS
···696696W: http://www.cyclades.com/697697S: Supported698698699699-DAC960 RAID CONTROLLER DRIVER700700-P: Dave Olien701701-M dmo@osdl.org702702-W: http://www.osdl.org/archive/dmo/DAC960703703-L: linux-kernel@vger.kernel.org704704-S: Maintained705705-706699DAMA SLAVE for AX.25707700P: Joerg Reuter708701M: jreuter@yaina.de···29142921L: video4linux-list@redhat.com29152922W: http://linuxtv.org29162923T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git29242924+S: Maintained29252925+29262926+VT8231 HARDWARE MONITOR DRIVER29272927+P: Roger Lucas29282928+M: roger@planbit.co.uk29292929+L: lm-sensors@lm-sensors.org29172930S: Maintained2918293129192932W1 DALLAS'S 1-WIRE BUS
···11/*22- * Intel Multimedia Timer device implementation for SGI SN platforms.22+ * Timer device implementation for SGI SN platforms.33 *44 * This file is subject to the terms and conditions of the GNU General Public55 * License. See the file "COPYING" in the main directory of this archive66 * for more details.77 *88- * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved.88+ * Copyright (c) 2001-2006 Silicon Graphics, Inc. All rights reserved.99 *1010 * This driver exports an API that should be supportable by any HPET or IA-PC1111 * multimedia timer. The code below is currently specific to the SGI Altix···4545/* name of the device, usually in /dev */4646#define MMTIMER_NAME "mmtimer"4747#define MMTIMER_DESC "SGI Altix RTC Timer"4848-#define MMTIMER_VERSION "2.0"4848+#define MMTIMER_VERSION "2.1"49495050#define RTC_BITS 55 /* 55 bits for this implementation */5151···227227 struct tasklet_struct tasklet;228228} mmtimer_t;229229230230-/*231231- * Total number of comparators is comparators/node * MAX nodes/running kernel232232- */233233-static mmtimer_t timers[NUM_COMPARATORS*MAX_COMPACT_NODES];230230+static mmtimer_t ** timers;234231235232/**236233 * mmtimer_ioctl - ioctl interface for /dev/mmtimer···438441mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs)439442{440443 int i;441441- mmtimer_t *base = timers + cpu_to_node(smp_processor_id()) *442442- NUM_COMPARATORS;443444 unsigned long expires = 0;444445 int result = IRQ_NONE;446446+ unsigned indx = cpu_to_node(smp_processor_id());445447446448 /*447449 * Do this once for each comparison register448450 */449451 for (i = 0; i < NUM_COMPARATORS; i++) {452452+ mmtimer_t *base = timers[indx] + i;450453 /* Make sure this doesn't get reused before tasklet_sched */451451- spin_lock(&base[i].lock);452452- if (base[i].cpu == smp_processor_id()) {453453- if (base[i].timer)454454- expires = base[i].timer->it.mmtimer.expires;454454+ spin_lock(&base->lock);455455+ if (base->cpu == smp_processor_id()) {456456+ if (base->timer)457457+ expires = base->timer->it.mmtimer.expires;455458 /* expires test won't work with shared irqs */456459 if ((mmtimer_int_pending(i) > 0) ||457460 (expires && (expires < rtc_time()))) {458461 mmtimer_clr_int_pending(i);459459- tasklet_schedule(&base[i].tasklet);462462+ tasklet_schedule(&base->tasklet);460463 result = IRQ_HANDLED;461464 }462465 }463463- spin_unlock(&base[i].lock);466466+ spin_unlock(&base->lock);464467 expires = 0;465468 }466469 return result;···520523{521524 int i = timr->it.mmtimer.clock;522525 cnodeid_t nodeid = timr->it.mmtimer.node;523523- mmtimer_t *t = timers + nodeid * NUM_COMPARATORS +i;526526+ mmtimer_t *t = timers[nodeid] + i;524527 unsigned long irqflags;525528526529 if (i != TIMER_OFF) {···606609 preempt_disable();607610608611 nodeid = cpu_to_node(smp_processor_id());609609- base = timers + nodeid * NUM_COMPARATORS;610612retry:611613 /* Don't use an allocated timer, or a deleted one that's pending */612614 for(i = 0; i< NUM_COMPARATORS; i++) {613613- if (!base[i].timer && !base[i].tasklet.state) {615615+ base = timers[nodeid] + i;616616+ if (!base->timer && !base->tasklet.state) {614617 break;615618 }616619 }···620623 return -EBUSY;621624 }622625623623- spin_lock_irqsave(&base[i].lock, irqflags);626626+ spin_lock_irqsave(&base->lock, irqflags);624627625625- if (base[i].timer || base[i].tasklet.state != 0) {626626- spin_unlock_irqrestore(&base[i].lock, irqflags);628628+ if (base->timer || base->tasklet.state != 0) {629629+ spin_unlock_irqrestore(&base->lock, irqflags);627630 goto retry;628631 }629629- base[i].timer = timr;630630- base[i].cpu = smp_processor_id();632632+ base->timer = timr;633633+ base->cpu = smp_processor_id();631634632635 timr->it.mmtimer.clock = i;633636 timr->it.mmtimer.node = nodeid;···642645 }643646 } else {644647 timr->it.mmtimer.expires -= period;645645- if (reschedule_periodic_timer(base+i))648648+ if (reschedule_periodic_timer(base))646649 err = -EINVAL;647650 }648651649649- spin_unlock_irqrestore(&base[i].lock, irqflags);652652+ spin_unlock_irqrestore(&base->lock, irqflags);650653651654 preempt_enable();652655···672675static int __init mmtimer_init(void)673676{674677 unsigned i;678678+ cnodeid_t node, maxn = -1;675679676680 if (!ia64_platform_is("sn2"))677681 return -1;···689691 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second /690692 2) / sn_rtc_cycles_per_second;691693692692- for (i=0; i< NUM_COMPARATORS*MAX_COMPACT_NODES; i++) {693693- spin_lock_init(&timers[i].lock);694694- timers[i].timer = NULL;695695- timers[i].cpu = 0;696696- timers[i].i = i % NUM_COMPARATORS;697697- tasklet_init(&timers[i].tasklet, mmtimer_tasklet, (unsigned long) (timers+i));698698- }699699-700694 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) {701695 printk(KERN_WARNING "%s: unable to allocate interrupt.",702696 MMTIMER_NAME);···700710 printk(KERN_ERR "%s: failed to register device\n",701711 MMTIMER_NAME);702712 return -1;713713+ }714714+715715+ /* Get max numbered node, calculate slots needed */716716+ for_each_online_node(node) {717717+ maxn = node;718718+ }719719+ maxn++;720720+721721+ /* Allocate list of node ptrs to mmtimer_t's */722722+ timers = kmalloc(sizeof(mmtimer_t *)*maxn, GFP_KERNEL);723723+ if (timers == NULL) {724724+ printk(KERN_ERR "%s: failed to allocate memory for device\n",725725+ MMTIMER_NAME);726726+ return -1;727727+ }728728+729729+ /* Allocate mmtimer_t's for each online node */730730+ for_each_online_node(node) {731731+ timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node);732732+ if (timers[node] == NULL) {733733+ printk(KERN_ERR "%s: failed to allocate memory for device\n",734734+ MMTIMER_NAME);735735+ return -1;736736+ }737737+ for (i=0; i< NUM_COMPARATORS; i++) {738738+ mmtimer_t * base = timers[node] + i;739739+740740+ spin_lock_init(&base->lock);741741+ base->timer = NULL;742742+ base->cpu = 0;743743+ base->i = i;744744+ tasklet_init(&base->tasklet, mmtimer_tasklet,745745+ (unsigned long) (base));746746+ }703747 }704748705749 sgi_clock_period = sgi_clock.res = NSEC_PER_SEC / sn_rtc_cycles_per_second;
+12
drivers/hwmon/Kconfig
···350350 This driver can also be built as a module. If so, the module351351 will be called via686a.352352353353+config SENSORS_VT8231354354+ tristate "VT8231"355355+ depends on HWMON && I2C && PCI && EXPERIMENTAL356356+ select HWMON_VID357357+ select I2C_ISA358358+ help359359+ If you say yes here then you get support for the integrated sensors360360+ in the VIA VT8231 device.361361+362362+ This driver can also be built as a module. If so, the module363363+ will be called vt8231.364364+353365config SENSORS_W83781D354366 tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"355367 depends on HWMON && I2C
···572572/* The driver. I choose to use type i2c_driver, as at is identical to both573573 smbus_driver and isa_driver, and clients could be of either kind */574574static struct i2c_driver via686a_driver = {575575- .owner = THIS_MODULE,576576- .name = "via686a",575575+ .driver = {576576+ .name = "via686a",577577+ },577578 .attach_adapter = via686a_detect,578579 .detach_client = via686a_detach_client,579580};···616615 }617616618617 /* Reserve the ISA region */619619- if (!request_region(address, VIA686A_EXTENT, via686a_driver.name)) {618618+ if (!request_region(address, VIA686A_EXTENT,619619+ via686a_driver.driver.name)) {620620 dev_err(&adapter->dev, "region 0x%x already in use!\n",621621 address);622622 return -ENODEV;
+862
drivers/hwmon/vt8231.c
···11+/*22+ vt8231.c - Part of lm_sensors, Linux kernel modules33+ for hardware monitoring44+55+ Copyright (c) 2005 Roger Lucas <roger@planbit.co.uk>66+ Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>77+ Aaron M. Marsh <amarsh@sdf.lonestar.org>88+99+ This program is free software; you can redistribute it and/or modify1010+ it under the terms of the GNU General Public License as published by1111+ the Free Software Foundation; either version 2 of the License, or1212+ (at your option) any later version.1313+1414+ This program is distributed in the hope that it will be useful,1515+ but WITHOUT ANY WARRANTY; without even the implied warranty of1616+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1717+ GNU General Public License for more details.1818+1919+ You should have received a copy of the GNU General Public License2020+ along with this program; if not, write to the Free Software2121+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.2222+*/2323+2424+/* Supports VIA VT8231 South Bridge embedded sensors2525+*/2626+2727+#include <linux/module.h>2828+#include <linux/init.h>2929+#include <linux/slab.h>3030+#include <linux/pci.h>3131+#include <linux/jiffies.h>3232+#include <linux/i2c.h>3333+#include <linux/i2c-isa.h>3434+#include <linux/hwmon.h>3535+#include <linux/hwmon-sysfs.h>3636+#include <linux/hwmon-vid.h>3737+#include <linux/err.h>3838+#include <asm/io.h>3939+4040+static int force_addr;4141+module_param(force_addr, int, 0);4242+MODULE_PARM_DESC(force_addr, "Initialize the base address of the sensors");4343+4444+/* Device address4545+ Note that we can't determine the ISA address until we have initialized4646+ our module */4747+static unsigned short isa_address;4848+4949+#define VT8231_EXTENT 0x805050+#define VT8231_BASE_REG 0x705151+#define VT8231_ENABLE_REG 0x745252+5353+/* The VT8231 registers5454+5555+ The reset value for the input channel configuration is used (Reg 0x4A=0x07)5656+ which sets the selected inputs marked with '*' below if multiple options are5757+ possible:5858+5959+ Voltage Mode Temperature Mode6060+ Sensor Linux Id Linux Id VIA Id6161+ -------- -------- -------- ------6262+ CPU Diode N/A temp1 06363+ UIC1 in0 temp2 * 16464+ UIC2 in1 * temp3 26565+ UIC3 in2 * temp4 36666+ UIC4 in3 * temp5 46767+ UIC5 in4 * temp6 56868+ 3.3V in5 N/A6969+7070+ Note that the BIOS may set the configuration register to a different value7171+ to match the motherboard configuration.7272+*/7373+7474+/* fans numbered 0-1 */7575+#define VT8231_REG_FAN_MIN(nr) (0x3b + (nr))7676+#define VT8231_REG_FAN(nr) (0x29 + (nr))7777+7878+/* Voltage inputs numbered 0-5 */7979+8080+static const u8 regvolt[] = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 };8181+static const u8 regvoltmax[] = { 0x3d, 0x2b, 0x2d, 0x2f, 0x31, 0x33 };8282+static const u8 regvoltmin[] = { 0x3e, 0x2c, 0x2e, 0x30, 0x32, 0x34 };8383+8484+/* Temperatures are numbered 1-6 according to the Linux kernel specification.8585+**8686+** In the VIA datasheet, however, the temperatures are numbered from zero.8787+** Since it is important that this driver can easily be compared to the VIA8888+** datasheet, we will use the VIA numbering within this driver and map the8989+** kernel sysfs device name to the VIA number in the sysfs callback.9090+*/9191+9292+#define VT8231_REG_TEMP_LOW01 0x499393+#define VT8231_REG_TEMP_LOW25 0x4d9494+9595+static const u8 regtemp[] = { 0x1f, 0x21, 0x22, 0x23, 0x24, 0x25 };9696+static const u8 regtempmax[] = { 0x39, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 };9797+static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 };9898+9999+#define TEMP_FROM_REG(reg) (((253 * 4 - (reg)) * 550 + 105) / 210)100100+#define TEMP_MAXMIN_FROM_REG(reg) (((253 - (reg)) * 2200 + 105) / 210)101101+#define TEMP_MAXMIN_TO_REG(val) (253 - ((val) * 210 + 1100) / 2200)102102+103103+#define VT8231_REG_CONFIG 0x40104104+#define VT8231_REG_ALARM1 0x41105105+#define VT8231_REG_ALARM2 0x42106106+#define VT8231_REG_FANDIV 0x47107107+#define VT8231_REG_UCH_CONFIG 0x4a108108+#define VT8231_REG_TEMP1_CONFIG 0x4b109109+#define VT8231_REG_TEMP2_CONFIG 0x4c110110+111111+/* temps 0-5 as numbered in VIA datasheet - see later for mapping to Linux112112+** numbering113113+*/114114+#define ISTEMP(i, ch_config) ((i) == 0 ? 1 : \115115+ ((ch_config) >> ((i)+1)) & 0x01)116116+/* voltages 0-5 */117117+#define ISVOLT(i, ch_config) ((i) == 5 ? 1 : \118118+ !(((ch_config) >> ((i)+2)) & 0x01))119119+120120+#define DIV_FROM_REG(val) (1 << (val))121121+122122+/* NB The values returned here are NOT temperatures. The calibration curves123123+** for the thermistor curves are board-specific and must go in the124124+** sensors.conf file. Temperature sensors are actually ten bits, but the125125+** VIA datasheet only considers the 8 MSBs obtained from the regtemp[]126126+** register. The temperature value returned should have a magnitude of 3,127127+** so we use the VIA scaling as the "true" scaling and use the remaining 2128128+** LSBs as fractional precision.129129+**130130+** All the on-chip hardware temperature comparisons for the alarms are only131131+** 8-bits wide, and compare against the 8 MSBs of the temperature. The bits132132+** in the registers VT8231_REG_TEMP_LOW01 and VT8231_REG_TEMP_LOW25 are133133+** ignored.134134+*/135135+136136+/******** FAN RPM CONVERSIONS ********137137+** This chip saturates back at 0, not at 255 like many the other chips.138138+** So, 0 means 0 RPM139139+*/140140+static inline u8 FAN_TO_REG(long rpm, int div)141141+{142142+ if (rpm == 0)143143+ return 0;144144+ return SENSORS_LIMIT(1310720 / (rpm * div), 1, 255);145145+}146146+147147+#define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : 1310720 / ((val) * (div)))148148+149149+struct vt8231_data {150150+ struct i2c_client client;151151+ struct semaphore update_lock;152152+ struct class_device *class_dev;153153+ char valid; /* !=0 if following fields are valid */154154+ unsigned long last_updated; /* In jiffies */155155+156156+ u8 in[6]; /* Register value */157157+ u8 in_max[6]; /* Register value */158158+ u8 in_min[6]; /* Register value */159159+ u16 temp[6]; /* Register value 10 bit, right aligned */160160+ u8 temp_max[6]; /* Register value */161161+ u8 temp_min[6]; /* Register value */162162+ u8 fan[2]; /* Register value */163163+ u8 fan_min[2]; /* Register value */164164+ u8 fan_div[2]; /* Register encoding, shifted right */165165+ u16 alarms; /* Register encoding */166166+ u8 uch_config;167167+};168168+169169+static struct pci_dev *s_bridge;170170+static int vt8231_detect(struct i2c_adapter *adapter);171171+static int vt8231_detach_client(struct i2c_client *client);172172+static struct vt8231_data *vt8231_update_device(struct device *dev);173173+static void vt8231_init_client(struct i2c_client *client);174174+175175+static inline int vt8231_read_value(struct i2c_client *client, u8 reg)176176+{177177+ return inb_p(client->addr + reg);178178+}179179+180180+static inline void vt8231_write_value(struct i2c_client *client, u8 reg,181181+ u8 value)182182+{183183+ outb_p(value, client->addr + reg);184184+}185185+186186+/* following are the sysfs callback functions */187187+static ssize_t show_in(struct device *dev, struct device_attribute *attr,188188+ char *buf)189189+{190190+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);191191+ int nr = sensor_attr->index;192192+ struct vt8231_data *data = vt8231_update_device(dev);193193+194194+ return sprintf(buf, "%d\n", ((data->in[nr] - 3) * 10000) / 958);195195+}196196+197197+static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,198198+ char *buf)199199+{200200+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);201201+ int nr = sensor_attr->index;202202+ struct vt8231_data *data = vt8231_update_device(dev);203203+204204+ return sprintf(buf, "%d\n", ((data->in_min[nr] - 3) * 10000) / 958);205205+}206206+207207+static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,208208+ char *buf)209209+{210210+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);211211+ int nr = sensor_attr->index;212212+ struct vt8231_data *data = vt8231_update_device(dev);213213+214214+ return sprintf(buf, "%d\n", (((data->in_max[nr] - 3) * 10000) / 958));215215+}216216+217217+static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,218218+ const char *buf, size_t count)219219+{220220+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);221221+ int nr = sensor_attr->index;222222+ struct i2c_client *client = to_i2c_client(dev);223223+ struct vt8231_data *data = i2c_get_clientdata(client);224224+ unsigned long val = simple_strtoul(buf, NULL, 10);225225+226226+ down(&data->update_lock);227227+ data->in_min[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255);228228+ vt8231_write_value(client, regvoltmin[nr], data->in_min[nr]);229229+ up(&data->update_lock);230230+ return count;231231+}232232+233233+static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,234234+ const char *buf, size_t count)235235+{236236+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);237237+ int nr = sensor_attr->index;238238+ struct i2c_client *client = to_i2c_client(dev);239239+ struct vt8231_data *data = i2c_get_clientdata(client);240240+ unsigned long val = simple_strtoul(buf, NULL, 10);241241+242242+ down(&data->update_lock);243243+ data->in_max[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255);244244+ vt8231_write_value(client, regvoltmax[nr], data->in_max[nr]);245245+ up(&data->update_lock);246246+ return count;247247+}248248+249249+/* Special case for input 5 as this has 3.3V scaling built into the chip */250250+static ssize_t show_in5(struct device *dev, struct device_attribute *attr,251251+ char *buf)252252+{253253+ struct vt8231_data *data = vt8231_update_device(dev);254254+255255+ return sprintf(buf, "%d\n",256256+ (((data->in[5] - 3) * 10000 * 54) / (958 * 34)));257257+}258258+259259+static ssize_t show_in5_min(struct device *dev, struct device_attribute *attr,260260+ char *buf)261261+{262262+ struct vt8231_data *data = vt8231_update_device(dev);263263+264264+ return sprintf(buf, "%d\n",265265+ (((data->in_min[5] - 3) * 10000 * 54) / (958 * 34)));266266+}267267+268268+static ssize_t show_in5_max(struct device *dev, struct device_attribute *attr,269269+ char *buf)270270+{271271+ struct vt8231_data *data = vt8231_update_device(dev);272272+273273+ return sprintf(buf, "%d\n",274274+ (((data->in_max[5] - 3) * 10000 * 54) / (958 * 34)));275275+}276276+277277+static ssize_t set_in5_min(struct device *dev, struct device_attribute *attr,278278+ const char *buf, size_t count)279279+{280280+ struct i2c_client *client = to_i2c_client(dev);281281+ struct vt8231_data *data = i2c_get_clientdata(client);282282+ unsigned long val = simple_strtoul(buf, NULL, 10);283283+284284+ down(&data->update_lock);285285+ data->in_min[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3,286286+ 0, 255);287287+ vt8231_write_value(client, regvoltmin[5], data->in_min[5]);288288+ up(&data->update_lock);289289+ return count;290290+}291291+292292+static ssize_t set_in5_max(struct device *dev, struct device_attribute *attr,293293+ const char *buf, size_t count)294294+{295295+ struct i2c_client *client = to_i2c_client(dev);296296+ struct vt8231_data *data = i2c_get_clientdata(client);297297+ unsigned long val = simple_strtoul(buf, NULL, 10);298298+299299+ down(&data->update_lock);300300+ data->in_max[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3,301301+ 0, 255);302302+ vt8231_write_value(client, regvoltmax[5], data->in_max[5]);303303+ up(&data->update_lock);304304+ return count;305305+}306306+307307+#define define_voltage_sysfs(offset) \308308+static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \309309+ show_in, NULL, offset); \310310+static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \311311+ show_in_min, set_in_min, offset); \312312+static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \313313+ show_in_max, set_in_max, offset)314314+315315+define_voltage_sysfs(0);316316+define_voltage_sysfs(1);317317+define_voltage_sysfs(2);318318+define_voltage_sysfs(3);319319+define_voltage_sysfs(4);320320+321321+static DEVICE_ATTR(in5_input, S_IRUGO, show_in5, NULL);322322+static DEVICE_ATTR(in5_min, S_IRUGO | S_IWUSR, show_in5_min, set_in5_min);323323+static DEVICE_ATTR(in5_max, S_IRUGO | S_IWUSR, show_in5_max, set_in5_max);324324+325325+/* Temperatures */326326+static ssize_t show_temp0(struct device *dev, struct device_attribute *attr,327327+ char *buf)328328+{329329+ struct vt8231_data *data = vt8231_update_device(dev);330330+ return sprintf(buf, "%d\n", data->temp[0] * 250);331331+}332332+333333+static ssize_t show_temp0_max(struct device *dev, struct device_attribute *attr,334334+ char *buf)335335+{336336+ struct vt8231_data *data = vt8231_update_device(dev);337337+ return sprintf(buf, "%d\n", data->temp_max[0] * 1000);338338+}339339+340340+static ssize_t show_temp0_min(struct device *dev, struct device_attribute *attr,341341+ char *buf)342342+{343343+ struct vt8231_data *data = vt8231_update_device(dev);344344+ return sprintf(buf, "%d\n", data->temp_min[0] * 1000);345345+}346346+347347+static ssize_t set_temp0_max(struct device *dev, struct device_attribute *attr,348348+ const char *buf, size_t count)349349+{350350+ struct i2c_client *client = to_i2c_client(dev);351351+ struct vt8231_data *data = i2c_get_clientdata(client);352352+ int val = simple_strtol(buf, NULL, 10);353353+354354+ down(&data->update_lock);355355+ data->temp_max[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255);356356+ vt8231_write_value(client, regtempmax[0], data->temp_max[0]);357357+ up(&data->update_lock);358358+ return count;359359+}360360+static ssize_t set_temp0_min(struct device *dev, struct device_attribute *attr,361361+ const char *buf, size_t count)362362+{363363+ struct i2c_client *client = to_i2c_client(dev);364364+ struct vt8231_data *data = i2c_get_clientdata(client);365365+ int val = simple_strtol(buf, NULL, 10);366366+367367+ down(&data->update_lock);368368+ data->temp_min[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255);369369+ vt8231_write_value(client, regtempmin[0], data->temp_min[0]);370370+ up(&data->update_lock);371371+ return count;372372+}373373+374374+static ssize_t show_temp(struct device *dev, struct device_attribute *attr,375375+ char *buf)376376+{377377+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);378378+ int nr = sensor_attr->index;379379+ struct vt8231_data *data = vt8231_update_device(dev);380380+ return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr]));381381+}382382+383383+static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,384384+ char *buf)385385+{386386+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);387387+ int nr = sensor_attr->index;388388+ struct vt8231_data *data = vt8231_update_device(dev);389389+ return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_max[nr]));390390+}391391+392392+static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,393393+ char *buf)394394+{395395+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);396396+ int nr = sensor_attr->index;397397+ struct vt8231_data *data = vt8231_update_device(dev);398398+ return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_min[nr]));399399+}400400+401401+static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,402402+ const char *buf, size_t count)403403+{404404+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);405405+ int nr = sensor_attr->index;406406+ struct i2c_client *client = to_i2c_client(dev);407407+ struct vt8231_data *data = i2c_get_clientdata(client);408408+ int val = simple_strtol(buf, NULL, 10);409409+410410+ down(&data->update_lock);411411+ data->temp_max[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255);412412+ vt8231_write_value(client, regtempmax[nr], data->temp_max[nr]);413413+ up(&data->update_lock);414414+ return count;415415+}416416+static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,417417+ const char *buf, size_t count)418418+{419419+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);420420+ int nr = sensor_attr->index;421421+ struct i2c_client *client = to_i2c_client(dev);422422+ struct vt8231_data *data = i2c_get_clientdata(client);423423+ int val = simple_strtol(buf, NULL, 10);424424+425425+ down(&data->update_lock);426426+ data->temp_min[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255);427427+ vt8231_write_value(client, regtempmin[nr], data->temp_min[nr]);428428+ up(&data->update_lock);429429+ return count;430430+}431431+432432+/* Note that these map the Linux temperature sensor numbering (1-6) to the VIA433433+** temperature sensor numbering (0-5)434434+*/435435+#define define_temperature_sysfs(offset) \436436+static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \437437+ show_temp, NULL, offset - 1); \438438+static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \439439+ show_temp_max, set_temp_max, offset - 1); \440440+static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \441441+ show_temp_min, set_temp_min, offset - 1)442442+443443+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp0, NULL);444444+static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp0_max, set_temp0_max);445445+static DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, show_temp0_min, set_temp0_min);446446+447447+define_temperature_sysfs(2);448448+define_temperature_sysfs(3);449449+define_temperature_sysfs(4);450450+define_temperature_sysfs(5);451451+define_temperature_sysfs(6);452452+453453+#define CFG_INFO_TEMP(id) { &sensor_dev_attr_temp##id##_input.dev_attr, \454454+ &sensor_dev_attr_temp##id##_min.dev_attr, \455455+ &sensor_dev_attr_temp##id##_max.dev_attr }456456+#define CFG_INFO_VOLT(id) { &sensor_dev_attr_in##id##_input.dev_attr, \457457+ &sensor_dev_attr_in##id##_min.dev_attr, \458458+ &sensor_dev_attr_in##id##_max.dev_attr }459459+460460+struct str_device_attr_table {461461+ struct device_attribute *input;462462+ struct device_attribute *min;463463+ struct device_attribute *max;464464+};465465+466466+static struct str_device_attr_table cfg_info_temp[] = {467467+ { &dev_attr_temp1_input, &dev_attr_temp1_min, &dev_attr_temp1_max },468468+ CFG_INFO_TEMP(2),469469+ CFG_INFO_TEMP(3),470470+ CFG_INFO_TEMP(4),471471+ CFG_INFO_TEMP(5),472472+ CFG_INFO_TEMP(6)473473+};474474+475475+static struct str_device_attr_table cfg_info_volt[] = {476476+ CFG_INFO_VOLT(0),477477+ CFG_INFO_VOLT(1),478478+ CFG_INFO_VOLT(2),479479+ CFG_INFO_VOLT(3),480480+ CFG_INFO_VOLT(4),481481+ { &dev_attr_in5_input, &dev_attr_in5_min, &dev_attr_in5_max }482482+};483483+484484+/* Fans */485485+static ssize_t show_fan(struct device *dev, struct device_attribute *attr,486486+ char *buf)487487+{488488+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);489489+ int nr = sensor_attr->index;490490+ struct vt8231_data *data = vt8231_update_device(dev);491491+ return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr],492492+ DIV_FROM_REG(data->fan_div[nr])));493493+}494494+495495+static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,496496+ char *buf)497497+{498498+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);499499+ int nr = sensor_attr->index;500500+ struct vt8231_data *data = vt8231_update_device(dev);501501+ return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr],502502+ DIV_FROM_REG(data->fan_div[nr])));503503+}504504+505505+static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr,506506+ char *buf)507507+{508508+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);509509+ int nr = sensor_attr->index;510510+ struct vt8231_data *data = vt8231_update_device(dev);511511+ return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr]));512512+}513513+514514+static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,515515+ const char *buf, size_t count)516516+{517517+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);518518+ int nr = sensor_attr->index;519519+ struct i2c_client *client = to_i2c_client(dev);520520+ struct vt8231_data *data = i2c_get_clientdata(client);521521+ int val = simple_strtoul(buf, NULL, 10);522522+523523+ down(&data->update_lock);524524+ data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));525525+ vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]);526526+ up(&data->update_lock);527527+ return count;528528+}529529+530530+static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,531531+ const char *buf, size_t count)532532+{533533+ struct i2c_client *client = to_i2c_client(dev);534534+ struct vt8231_data *data = i2c_get_clientdata(client);535535+ struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);536536+ unsigned long val = simple_strtoul(buf, NULL, 10);537537+ int nr = sensor_attr->index;538538+ int old = vt8231_read_value(client, VT8231_REG_FANDIV);539539+ long min = FAN_FROM_REG(data->fan_min[nr],540540+ DIV_FROM_REG(data->fan_div[nr]));541541+542542+ down(&data->update_lock);543543+ switch (val) {544544+ case 1: data->fan_div[nr] = 0; break;545545+ case 2: data->fan_div[nr] = 1; break;546546+ case 4: data->fan_div[nr] = 2; break;547547+ case 8: data->fan_div[nr] = 3; break;548548+ default:549549+ dev_err(&client->dev, "fan_div value %ld not supported."550550+ "Choose one of 1, 2, 4 or 8!\n", val);551551+ up(&data->update_lock);552552+ return -EINVAL;553553+ }554554+555555+ /* Correct the fan minimum speed */556556+ data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));557557+ vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]);558558+559559+ old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4);560560+ vt8231_write_value(client, VT8231_REG_FANDIV, old);561561+ up(&data->update_lock);562562+ return count;563563+}564564+565565+566566+#define define_fan_sysfs(offset) \567567+static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \568568+ show_fan, NULL, offset - 1); \569569+static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \570570+ show_fan_div, set_fan_div, offset - 1); \571571+static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \572572+ show_fan_min, set_fan_min, offset - 1)573573+574574+define_fan_sysfs(1);575575+define_fan_sysfs(2);576576+577577+/* Alarms */578578+static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,579579+ char *buf)580580+{581581+ struct vt8231_data *data = vt8231_update_device(dev);582582+ return sprintf(buf, "%d\n", data->alarms);583583+}584584+585585+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);586586+587587+static struct i2c_driver vt8231_driver = {588588+ .driver = {589589+ .name = "vt8231",590590+ },591591+ .attach_adapter = vt8231_detect,592592+ .detach_client = vt8231_detach_client,593593+};594594+595595+static struct pci_device_id vt8231_pci_ids[] = {596596+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) },597597+ { 0, }598598+};599599+600600+MODULE_DEVICE_TABLE(pci, vt8231_pci_ids);601601+602602+static int __devinit vt8231_pci_probe(struct pci_dev *dev,603603+ const struct pci_device_id *id);604604+605605+static struct pci_driver vt8231_pci_driver = {606606+ .name = "vt8231",607607+ .id_table = vt8231_pci_ids,608608+ .probe = vt8231_pci_probe,609609+};610610+611611+int vt8231_detect(struct i2c_adapter *adapter)612612+{613613+ struct i2c_client *client;614614+ struct vt8231_data *data;615615+ int err = 0, i;616616+ u16 val;617617+618618+ /* 8231 requires multiple of 256 */619619+ if (force_addr) {620620+ isa_address = force_addr & 0xFF00;621621+ dev_warn(&adapter->dev, "forcing ISA address 0x%04X\n",622622+ isa_address);623623+ if (PCIBIOS_SUCCESSFUL != pci_write_config_word(s_bridge,624624+ VT8231_BASE_REG, isa_address))625625+ return -ENODEV;626626+ }627627+628628+ if (PCIBIOS_SUCCESSFUL !=629629+ pci_read_config_word(s_bridge, VT8231_ENABLE_REG, &val))630630+ return -ENODEV;631631+632632+ if (!(val & 0x0001)) {633633+ dev_warn(&adapter->dev, "enabling sensors\n");634634+ if (PCIBIOS_SUCCESSFUL !=635635+ pci_write_config_word(s_bridge, VT8231_ENABLE_REG,636636+ val | 0x0001))637637+ return -ENODEV;638638+ }639639+640640+ /* Reserve the ISA region */641641+ if (!request_region(isa_address, VT8231_EXTENT,642642+ vt8231_pci_driver.name)) {643643+ dev_err(&adapter->dev, "region 0x%x already in use!\n",644644+ isa_address);645645+ return -ENODEV;646646+ }647647+648648+ if (!(data = kzalloc(sizeof(struct vt8231_data), GFP_KERNEL))) {649649+ err = -ENOMEM;650650+ goto exit_release;651651+ }652652+653653+ client = &data->client;654654+ i2c_set_clientdata(client, data);655655+ client->addr = isa_address;656656+ client->adapter = adapter;657657+ client->driver = &vt8231_driver;658658+ client->dev.parent = &adapter->dev;659659+660660+ /* Fill in the remaining client fields and put into the global list */661661+ strlcpy(client->name, "vt8231", I2C_NAME_SIZE);662662+663663+ init_MUTEX(&data->update_lock);664664+665665+ /* Tell the I2C layer a new client has arrived */666666+ if ((err = i2c_attach_client(client)))667667+ goto exit_free;668668+669669+ vt8231_init_client(client);670670+671671+ /* Register sysfs hooks */672672+ data->class_dev = hwmon_device_register(&client->dev);673673+ if (IS_ERR(data->class_dev)) {674674+ err = PTR_ERR(data->class_dev);675675+ goto exit_detach;676676+ }677677+678678+ /* Must update device information to find out the config field */679679+ data->uch_config = vt8231_read_value(client, VT8231_REG_UCH_CONFIG);680680+681681+ for (i = 0; i < ARRAY_SIZE(cfg_info_temp); i++) {682682+ if (ISTEMP(i, data->uch_config)) {683683+ device_create_file(&client->dev,684684+ cfg_info_temp[i].input);685685+ device_create_file(&client->dev, cfg_info_temp[i].max);686686+ device_create_file(&client->dev, cfg_info_temp[i].min);687687+ }688688+ }689689+690690+ for (i = 0; i < ARRAY_SIZE(cfg_info_volt); i++) {691691+ if (ISVOLT(i, data->uch_config)) {692692+ device_create_file(&client->dev,693693+ cfg_info_volt[i].input);694694+ device_create_file(&client->dev, cfg_info_volt[i].max);695695+ device_create_file(&client->dev, cfg_info_volt[i].min);696696+ }697697+ }698698+699699+ device_create_file(&client->dev, &sensor_dev_attr_fan1_input.dev_attr);700700+ device_create_file(&client->dev, &sensor_dev_attr_fan2_input.dev_attr);701701+ device_create_file(&client->dev, &sensor_dev_attr_fan1_min.dev_attr);702702+ device_create_file(&client->dev, &sensor_dev_attr_fan2_min.dev_attr);703703+ device_create_file(&client->dev, &sensor_dev_attr_fan1_div.dev_attr);704704+ device_create_file(&client->dev, &sensor_dev_attr_fan2_div.dev_attr);705705+706706+ device_create_file(&client->dev, &dev_attr_alarms);707707+ return 0;708708+709709+exit_detach:710710+ i2c_detach_client(client);711711+exit_free:712712+ kfree(data);713713+exit_release:714714+ release_region(isa_address, VT8231_EXTENT);715715+ return err;716716+}717717+718718+static int vt8231_detach_client(struct i2c_client *client)719719+{720720+ struct vt8231_data *data = i2c_get_clientdata(client);721721+ int err;722722+723723+ hwmon_device_unregister(data->class_dev);724724+725725+ if ((err = i2c_detach_client(client))) {726726+ return err;727727+ }728728+729729+ release_region(client->addr, VT8231_EXTENT);730730+ kfree(data);731731+732732+ return 0;733733+}734734+735735+static void vt8231_init_client(struct i2c_client *client)736736+{737737+ vt8231_write_value(client, VT8231_REG_TEMP1_CONFIG, 0);738738+ vt8231_write_value(client, VT8231_REG_TEMP2_CONFIG, 0);739739+}740740+741741+static struct vt8231_data *vt8231_update_device(struct device *dev)742742+{743743+ struct i2c_client *client = to_i2c_client(dev);744744+ struct vt8231_data *data = i2c_get_clientdata(client);745745+ int i;746746+ u16 low;747747+748748+ down(&data->update_lock);749749+750750+ if (time_after(jiffies, data->last_updated + HZ + HZ / 2)751751+ || !data->valid) {752752+ for (i = 0; i < 6; i++) {753753+ if (ISVOLT(i, data->uch_config)) {754754+ data->in[i] = vt8231_read_value(client,755755+ regvolt[i]);756756+ data->in_min[i] = vt8231_read_value(client,757757+ regvoltmin[i]);758758+ data->in_max[i] = vt8231_read_value(client,759759+ regvoltmax[i]);760760+ }761761+ }762762+ for (i = 0; i < 2; i++) {763763+ data->fan[i] = vt8231_read_value(client,764764+ VT8231_REG_FAN(i));765765+ data->fan_min[i] = vt8231_read_value(client,766766+ VT8231_REG_FAN_MIN(i));767767+ }768768+769769+ low = vt8231_read_value(client, VT8231_REG_TEMP_LOW01);770770+ low = (low >> 6) | ((low & 0x30) >> 2)771771+ | (vt8231_read_value(client, VT8231_REG_TEMP_LOW25) << 4);772772+ for (i = 0; i < 6; i++) {773773+ if (ISTEMP(i, data->uch_config)) {774774+ data->temp[i] = (vt8231_read_value(client,775775+ regtemp[i]) << 2)776776+ | ((low >> (2 * i)) & 0x03);777777+ data->temp_max[i] = vt8231_read_value(client,778778+ regtempmax[i]);779779+ data->temp_min[i] = vt8231_read_value(client,780780+ regtempmin[i]);781781+ }782782+ }783783+784784+ i = vt8231_read_value(client, VT8231_REG_FANDIV);785785+ data->fan_div[0] = (i >> 4) & 0x03;786786+ data->fan_div[1] = i >> 6;787787+ data->alarms = vt8231_read_value(client, VT8231_REG_ALARM1) |788788+ (vt8231_read_value(client, VT8231_REG_ALARM2) << 8);789789+790790+ /* Set alarm flags correctly */791791+ if (!data->fan[0] && data->fan_min[0]) {792792+ data->alarms |= 0x40;793793+ } else if (data->fan[0] && !data->fan_min[0]) {794794+ data->alarms &= ~0x40;795795+ }796796+797797+ if (!data->fan[1] && data->fan_min[1]) {798798+ data->alarms |= 0x80;799799+ } else if (data->fan[1] && !data->fan_min[1]) {800800+ data->alarms &= ~0x80;801801+ }802802+803803+ data->last_updated = jiffies;804804+ data->valid = 1;805805+ }806806+807807+ up(&data->update_lock);808808+809809+ return data;810810+}811811+812812+static int __devinit vt8231_pci_probe(struct pci_dev *dev,813813+ const struct pci_device_id *id)814814+{815815+ u16 val;816816+817817+ if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_BASE_REG,818818+ &val))819819+ return -ENODEV;820820+821821+ isa_address = val & ~(VT8231_EXTENT - 1);822822+ if (isa_address == 0 && force_addr == 0) {823823+ dev_err(&dev->dev, "base address not set -\824824+ upgrade BIOS or use force_addr=0xaddr\n");825825+ return -ENODEV;826826+ }827827+828828+ s_bridge = pci_dev_get(dev);829829+830830+ if (i2c_isa_add_driver(&vt8231_driver)) {831831+ pci_dev_put(s_bridge);832832+ s_bridge = NULL;833833+ }834834+835835+ /* Always return failure here. This is to allow other drivers to bind836836+ * to this pci device. We don't really want to have control over the837837+ * pci device, we only wanted to read as few register values from it.838838+ */839839+ return -ENODEV;840840+}841841+842842+static int __init sm_vt8231_init(void)843843+{844844+ return pci_module_init(&vt8231_pci_driver);845845+}846846+847847+static void __exit sm_vt8231_exit(void)848848+{849849+ pci_unregister_driver(&vt8231_pci_driver);850850+ if (s_bridge != NULL) {851851+ i2c_isa_del_driver(&vt8231_driver);852852+ pci_dev_put(s_bridge);853853+ s_bridge = NULL;854854+ }855855+}856856+857857+MODULE_AUTHOR("Roger Lucas <roger@planbit.co.uk>");858858+MODULE_DESCRIPTION("VT8231 sensors");859859+MODULE_LICENSE("GPL");860860+861861+module_init(sm_vt8231_init);862862+module_exit(sm_vt8231_exit);
···178178179179 }180180181181+ flush_signals(current);182182+181183 /*182184 * Check whether there's a new lockd process before183185 * shutting down the hosts and clearing the slot.···193191 printk(KERN_DEBUG194192 "lockd: new process, skipping host shutdown\n");195193 wake_up(&lockd_exit);196196-197197- flush_signals(current);198194199195 /* Exit the RPC thread */200196 svc_exit_thread(rqstp);
···41414242static void nlmsvc_insert_block(struct nlm_block *block, unsigned long);4343static int nlmsvc_remove_block(struct nlm_block *block);4444-static void nlmsvc_grant_callback(struct rpc_task *task);4444+4545+static const struct rpc_call_ops nlmsvc_grant_ops;45464647/*4748 * The list of blocked locks to retry···227226 * It is the caller's responsibility to check whether the file228227 * can be closed hereafter.229228 */230230-static void229229+static int231230nlmsvc_delete_block(struct nlm_block *block, int unlock)232231{233232 struct file_lock *fl = &block->b_call.a_args.lock.fl;234233 struct nlm_file *file = block->b_file;235234 struct nlm_block **bp;235235+ int status = 0;236236237237 dprintk("lockd: deleting block %p...\n", block);238238239239 /* Remove block from list */240240 nlmsvc_remove_block(block);241241- if (fl->fl_next)242242- posix_unblock_lock(file->f_file, fl);243243- if (unlock) {244244- fl->fl_type = F_UNLCK;245245- posix_lock_file(file->f_file, fl);246246- block->b_granted = 0;247247- }241241+ if (unlock)242242+ status = posix_unblock_lock(file->f_file, fl);248243249244 /* If the block is in the middle of a GRANT callback,250245 * don't kill it yet. */251246 if (block->b_incall) {252247 nlmsvc_insert_block(block, NLM_NEVER);253248 block->b_done = 1;254254- return;249249+ return status;255250 }256251257252 /* Remove block from file's list of blocks */···262265 nlm_release_host(block->b_host);263266 nlmclnt_freegrantargs(&block->b_call);264267 kfree(block);268268+ return status;265269}266270267271/*···273275nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, int action)274276{275277 struct nlm_block *block, *next;278278+ /* XXX: Will everything get cleaned up if we don't unlock here? */276279277280 down(&file->f_sema);278281 for (block = file->f_blocks; block; block = next) {···443444nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)444445{445446 struct nlm_block *block;447447+ int status = 0;446448447449 dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",448450 file->f_file->f_dentry->d_inode->i_sb->s_id,···454454455455 down(&file->f_sema);456456 if ((block = nlmsvc_lookup_block(file, lock, 1)) != NULL)457457- nlmsvc_delete_block(block, 1);457457+ status = nlmsvc_delete_block(block, 1);458458 up(&file->f_sema);459459- return nlm_granted;459459+ return status ? nlm_lck_denied : nlm_granted;460460}461461462462/*···562562 /* Call the client */563563 nlm_get_host(block->b_call.a_host);564564 if (nlmsvc_async_call(&block->b_call, NLMPROC_GRANTED_MSG,565565- nlmsvc_grant_callback) < 0)565565+ &nlmsvc_grant_ops) < 0)566566 nlm_release_host(block->b_call.a_host);567567 up(&file->f_sema);568568}···575575 * chain once more in order to have it removed by lockd itself (which can576576 * then sleep on the file semaphore without disrupting e.g. the nfs client).577577 */578578-static void579579-nlmsvc_grant_callback(struct rpc_task *task)578578+static void nlmsvc_grant_callback(struct rpc_task *task, void *data)580579{581581- struct nlm_rqst *call = (struct nlm_rqst *) task->tk_calldata;580580+ struct nlm_rqst *call = data;582581 struct nlm_block *block;583582 unsigned long timeout;584583 struct sockaddr_in *peer_addr = RPC_PEERADDR(task->tk_client);···613614 nlm_release_host(call->a_host);614615}615616617617+static const struct rpc_call_ops nlmsvc_grant_ops = {618618+ .rpc_call_done = nlmsvc_grant_callback,619619+};620620+616621/*617622 * We received a GRANT_RES callback. Try to find the corresponding618623 * block.···636633637634 file->f_count++;638635 down(&file->f_sema);639639- if ((block = nlmsvc_find_block(cookie,&rqstp->rq_addr)) != NULL) {636636+ block = nlmsvc_find_block(cookie, &rqstp->rq_addr);637637+ if (block) {640638 if (status == NLM_LCK_DENIED_GRACE_PERIOD) {641639 /* Try again in a couple of seconds */642640 nlmsvc_insert_block(block, 10 * HZ);643643- block = NULL;641641+ up(&file->f_sema);644642 } else {645643 /* Lock is now held by client, or has been rejected.646644 * In both cases, the block should be removed. */···652648 nlmsvc_delete_block(block, 1);653649 }654650 }655655- if (!block)656656- up(&file->f_sema);657651 nlm_release_file(file);658652}659653
···354354 return 0;355355 argp->state = ntohl(*p++);356356 /* Preserve the address in network byte order */357357- argp->addr = *p++;357357+ argp->addr = *p++;358358+ argp->vers = *p++;359359+ argp->proto = *p++;358360 return xdr_argsize_check(rqstp, p);359361}360362
+8-12
fs/locks.c
···19581958 *19591959 * lockd needs to block waiting for locks.19601960 */19611961-void19611961+int19621962posix_unblock_lock(struct file *filp, struct file_lock *waiter)19631963{19641964- /* 19651965- * A remote machine may cancel the lock request after it's been19661966- * granted locally. If that happens, we need to delete the lock.19671967- */19641964+ int status = 0;19651965+19681966 lock_kernel();19691969- if (waiter->fl_next) {19671967+ if (waiter->fl_next)19701968 __locks_delete_block(waiter);19711971- unlock_kernel();19721972- } else {19731973- unlock_kernel();19741974- waiter->fl_type = F_UNLCK;19751975- posix_lock_file(filp, waiter);19761976- }19691969+ else19701970+ status = -ENOENT;19711971+ unlock_kernel();19721972+ return status;19771973}1978197419791975EXPORT_SYMBOL(posix_unblock_lock);
···3434static DECLARE_MUTEX(nfs_callback_sema);3535static struct svc_program nfs4_callback_program;36363737+unsigned int nfs_callback_set_tcpport;3738unsigned short nfs_callback_tcpport;38393940/*···9998 if (!serv)10099 goto out_err;101100 /* FIXME: We don't want to register this socket with the portmapper */102102- ret = svc_makesock(serv, IPPROTO_TCP, 0);101101+ ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport);103102 if (ret < 0)104103 goto out_destroy;105104 if (!list_empty(&serv->sv_permsocks)) {
+1
fs/nfs/callback.h
···6565extern int nfs_callback_up(void);6666extern int nfs_callback_down(void);67676868+extern unsigned int nfs_callback_set_tcpport;6869extern unsigned short nfs_callback_tcpport;69707071#endif /* __LINUX_FS_NFS_CALLBACK_H */
···8787 * We delay initializing RPC info until after the call to dentry_iput()8888 * in order to minimize races against rename().8989 */9090-static void9191-nfs_async_unlink_init(struct rpc_task *task)9090+static void nfs_async_unlink_init(struct rpc_task *task, void *calldata)9291{9393- struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata;9292+ struct nfs_unlinkdata *data = calldata;9493 struct dentry *dir = data->dir;9594 struct rpc_message msg = {9695 .rpc_cred = data->cred,···115116 *116117 * Do the directory attribute update.117118 */118118-static void119119-nfs_async_unlink_done(struct rpc_task *task)119119+static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)120120{121121- struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata;121121+ struct nfs_unlinkdata *data = calldata;122122 struct dentry *dir = data->dir;123123 struct inode *dir_i;124124···139141 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the140142 * rpc_task would be freed too.141143 */142142-static void143143-nfs_async_unlink_release(struct rpc_task *task)144144+static void nfs_async_unlink_release(void *calldata)144145{145145- struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata;146146+ struct nfs_unlinkdata *data = calldata;146147 nfs_put_unlinkdata(data);147148}149149+150150+static const struct rpc_call_ops nfs_unlink_ops = {151151+ .rpc_call_prepare = nfs_async_unlink_init,152152+ .rpc_call_done = nfs_async_unlink_done,153153+ .rpc_release = nfs_async_unlink_release,154154+};148155149156/**150157 * nfs_async_unlink - asynchronous unlinking of a file···160157{161158 struct dentry *dir = dentry->d_parent;162159 struct nfs_unlinkdata *data;163163- struct rpc_task *task;164160 struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode);165161 int status = -ENOMEM;166162···180178 nfs_deletes = data;181179 data->count = 1;182180183183- task = &data->task;184184- rpc_init_task(task, clnt, nfs_async_unlink_done , RPC_TASK_ASYNC);185185- task->tk_calldata = data;186186- task->tk_action = nfs_async_unlink_init;187187- task->tk_release = nfs_async_unlink_release;181181+ rpc_init_task(&data->task, clnt, RPC_TASK_ASYNC, &nfs_unlink_ops, data);188182189183 spin_lock(&dentry->d_lock);190184 dentry->d_flags |= DCACHE_NFSFS_RENAMED;191185 spin_unlock(&dentry->d_lock);192186193193- rpc_sleep_on(&nfs_delete_queue, task, NULL, NULL);187187+ rpc_sleep_on(&nfs_delete_queue, &data->task, NULL, NULL);194188 status = 0;195189 out:196190 return status;
+45-44
fs/nfs/write.c
···89899090static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion);91919292-static inline struct nfs_write_data *nfs_commit_alloc(void)9292+static inline struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount)9393{9494 struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS);9595+9596 if (p) {9697 memset(p, 0, sizeof(*p));9798 INIT_LIST_HEAD(&p->pages);9999+ if (pagecount < NFS_PAGEVEC_SIZE)100100+ p->pagevec = &p->page_array[0];101101+ else {102102+ size_t size = ++pagecount * sizeof(struct page *);103103+ p->pagevec = kmalloc(size, GFP_NOFS);104104+ if (p->pagevec) {105105+ memset(p->pagevec, 0, size);106106+ } else {107107+ mempool_free(p, nfs_commit_mempool);108108+ p = NULL;109109+ }110110+ }98111 }99112 return p;100113}101114102115static inline void nfs_commit_free(struct nfs_write_data *p)103116{117117+ if (p && (p->pagevec != &p->page_array[0]))118118+ kfree(p->pagevec);104119 mempool_free(p, nfs_commit_mempool);105120}106121107107-static void nfs_writedata_release(struct rpc_task *task)122122+void nfs_writedata_release(void *wdata)108123{109109- struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata;110124 nfs_writedata_free(wdata);111125}112126···182168 int result, written = 0;183169 struct nfs_write_data *wdata;184170185185- wdata = nfs_writedata_alloc();171171+ wdata = nfs_writedata_alloc(1);186172 if (!wdata)187173 return -ENOMEM;188174···246232 unsigned int offset, unsigned int count)247233{248234 struct nfs_page *req;249249- int status;250235251236 req = nfs_update_request(ctx, inode, page, offset, count);252252- status = (IS_ERR(req)) ? PTR_ERR(req) : 0;253253- if (status < 0)254254- goto out;237237+ if (IS_ERR(req))238238+ return PTR_ERR(req);255239 /* Update file length */256240 nfs_grow_file(page, offset, count);257241 /* Set the PG_uptodate flag? */258242 nfs_mark_uptodate(page, offset, count);259243 nfs_unlock_request(req);260260- out:261261- return status;244244+ return 0;262245}263246264247static int wb_priority(struct writeback_control *wbc)···315304 lock_kernel();316305 if (!IS_SYNC(inode) && inode_referenced) {317306 err = nfs_writepage_async(ctx, inode, page, 0, offset);318318- if (err >= 0) {319319- err = 0;320320- if (wbc->for_reclaim)321321- nfs_flush_inode(inode, 0, 0, FLUSH_STABLE);322322- }307307+ if (!wbc->for_writepages)308308+ nfs_flush_inode(inode, 0, 0, wb_priority(wbc));323309 } else {324310 err = nfs_writepage_sync(ctx, inode, page, 0,325311 offset, priority);···885877886878 data->task.tk_priority = flush_task_priority(how);887879 data->task.tk_cookie = (unsigned long)inode;888888- data->task.tk_calldata = data;889889- /* Release requests */890890- data->task.tk_release = nfs_writedata_release;891880892881 dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n",893882 data->task.tk_pid,···924919925920 nbytes = req->wb_bytes;926921 for (;;) {927927- data = nfs_writedata_alloc();922922+ data = nfs_writedata_alloc(1);928923 if (!data)929924 goto out_bad;930925 list_add(&data->pages, &list);···988983 if (NFS_SERVER(inode)->wsize < PAGE_CACHE_SIZE)989984 return nfs_flush_multi(head, inode, how);990985991991- data = nfs_writedata_alloc();986986+ data = nfs_writedata_alloc(NFS_SERVER(inode)->wpages);992987 if (!data)993988 goto out_bad;994989···11421137/*11431138 * This function is called when the WRITE call is complete.11441139 */11451145-void nfs_writeback_done(struct rpc_task *task)11401140+void nfs_writeback_done(struct rpc_task *task, void *calldata)11461141{11471147- struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata;11421142+ struct nfs_write_data *data = calldata;11481143 struct nfs_writeargs *argp = &data->args;11491144 struct nfs_writeres *resp = &data->res;11501145···121112061212120712131208#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)12141214-static void nfs_commit_release(struct rpc_task *task)12091209+void nfs_commit_release(void *wdata)12151210{12161216- struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata;12171211 nfs_commit_free(wdata);12181212}12191213···1248124412491245 data->task.tk_priority = flush_task_priority(how);12501246 data->task.tk_cookie = (unsigned long)inode;12511251- data->task.tk_calldata = data;12521252- /* Release requests */12531253- data->task.tk_release = nfs_commit_release;1254124712551248 dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid);12561249}···12561255 * Commit dirty pages12571256 */12581257static int12591259-nfs_commit_list(struct list_head *head, int how)12581258+nfs_commit_list(struct inode *inode, struct list_head *head, int how)12601259{12611260 struct nfs_write_data *data;12621261 struct nfs_page *req;1263126212641264- data = nfs_commit_alloc();12631263+ data = nfs_commit_alloc(NFS_SERVER(inode)->wpages);1265126412661265 if (!data)12671266 goto out_bad;···12841283/*12851284 * COMMIT call returned12861285 */12871287-void12881288-nfs_commit_done(struct rpc_task *task)12861286+void nfs_commit_done(struct rpc_task *task, void *calldata)12891287{12901290- struct nfs_write_data *data = (struct nfs_write_data *)task->tk_calldata;12881288+ struct nfs_write_data *data = calldata;12911289 struct nfs_page *req;12921290 int res = 0;12931291···13661366 res = nfs_scan_commit(inode, &head, 0, 0);13671367 spin_unlock(&nfsi->req_lock);13681368 if (res) {13691369- error = nfs_commit_list(&head, how);13691369+ error = nfs_commit_list(inode, &head, how);13701370 if (error < 0)13711371 return error;13721372 }···13771377int nfs_sync_inode(struct inode *inode, unsigned long idx_start,13781378 unsigned int npages, int how)13791379{13801380- int error,13811381- wait;13801380+ int nocommit = how & FLUSH_NOCOMMIT;13811381+ int wait = how & FLUSH_WAIT;13821382+ int error;1382138313831383- wait = how & FLUSH_WAIT;13841384- how &= ~FLUSH_WAIT;13841384+ how &= ~(FLUSH_WAIT|FLUSH_NOCOMMIT);1385138513861386 do {13871387- error = 0;13881388- if (wait)13871387+ if (wait) {13891388 error = nfs_wait_on_requests(inode, idx_start, npages);13901390- if (error == 0)13911391- error = nfs_flush_inode(inode, idx_start, npages, how);13921392-#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)13931393- if (error == 0)13891389+ if (error != 0)13901390+ continue;13911391+ }13921392+ error = nfs_flush_inode(inode, idx_start, npages, how);13931393+ if (error != 0)13941394+ continue;13951395+ if (!nocommit)13941396 error = nfs_commit_inode(inode, how);13951395-#endif13961397 } while (error > 0);13971398 return error;13981399}
+7-4
fs/nfsd/nfs4callback.c
···5353#define NFSPROC4_CB_COMPOUND 154545555/* declarations */5656-static void nfs4_cb_null(struct rpc_task *task);5656+static const struct rpc_call_ops nfs4_cb_null_ops;57575858/* Index of predefined Linux callback client operations */5959···431431 }432432 clnt->cl_intr = 0;433433 clnt->cl_softrtry = 1;434434- clnt->cl_chatty = 1;435434436435 /* Kick rpciod, put the call on the wire. */437436···446447 msg.rpc_cred = nfsd4_lookupcred(clp,0);447448 if (IS_ERR(msg.rpc_cred))448449 goto out_rpciod;449449- status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, nfs4_cb_null, NULL);450450+ status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, &nfs4_cb_null_ops, NULL);450451 put_rpccred(msg.rpc_cred);451452452453 if (status != 0) {···468469}469470470471static void471471-nfs4_cb_null(struct rpc_task *task)472472+nfs4_cb_null(struct rpc_task *task, void *dummy)472473{473474 struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp;474475 struct nfs4_callback *cb = &clp->cl_callback;···486487out:487488 put_nfs4_client(clp);488489}490490+491491+static const struct rpc_call_ops nfs4_cb_null_ops = {492492+ .rpc_call_done = nfs4_cb_null,493493+};489494490495/*491496 * called with dp->dl_count inc'ed.
+1-1
fs/ufs/dir.c
···491491492492 UFSD(("ino %u, reclen %u, namlen %u, name %s\n",493493 fs32_to_cpu(sb, de->d_ino),494494- fs16to_cpu(sb, de->d_reclen),494494+ fs16_to_cpu(sb, de->d_reclen),495495 ufs_get_de_namlen(sb, de), de->d_name))496496497497 while (i < bh->b_size) {
+1-1
include/linux/filter.h
···143143struct sk_buff;144144struct sock;145145146146-extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);146146+extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);147147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);148148extern int sk_chk_filter(struct sock_filter *filter, int flen);149149#endif /* __KERNEL__ */
+1-1
include/linux/fs.h
···760760extern int posix_lock_file(struct file *, struct file_lock *);761761extern int posix_lock_file_wait(struct file *, struct file_lock *);762762extern void posix_block_lock(struct file_lock *, struct file_lock *);763763-extern void posix_unblock_lock(struct file *, struct file_lock *);763763+extern int posix_unblock_lock(struct file *, struct file_lock *);764764extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);765765extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);766766extern int __break_lease(struct inode *inode, unsigned int flags);
+3-3
include/linux/hwmon-vid.h
···2323#ifndef _LINUX_HWMON_VID_H2424#define _LINUX_HWMON_VID_H25252626-int vid_from_reg(int val, int vrm);2727-int vid_which_vrm(void);2626+int vid_from_reg(int val, u8 vrm);2727+u8 vid_which_vrm(void);28282929/* vrm is the VRM/VRD document version multiplied by 10.3030 val is in mV to avoid floating point in the kernel.3131 Returned value is the 4-, 5- or 6-bit VID code.3232 Note that only VRM 9.x is supported for now. */3333-static inline int vid_to_reg(int val, int vrm)3333+static inline int vid_to_reg(int val, u8 vrm)3434{3535 switch (vrm) {3636 case 91: /* VRM 9.1 */
-20
include/linux/i2c-id.h
···25252626/*2727 * ---- Driver types -----------------------------------------------------2828- * device id name + number function description, i2c address(es)2929- *3030- * Range 1000-1999 range is defined in sensors/sensors.h3131- * Range 0x100 - 0x1ff is for V4L2 Common Components3232- * Range 0xf000 - 0xffff is reserved for local experimentation, and should3333- * never be used in official drivers3428 */35293630#define I2C_DRIVERID_MSP3400 1···104110#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */105111#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */106112107107-#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */108108-#define I2C_DRIVERID_EXP1 0xF1109109-#define I2C_DRIVERID_EXP2 0xF2110110-#define I2C_DRIVERID_EXP3 0xF3111111-112113#define I2C_DRIVERID_I2CDEV 900113113-#define I2C_DRIVERID_I2CPROC 901114114#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */115115#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */116116···119131#define I2C_DRIVERID_ADM1021 1008120132#define I2C_DRIVERID_ADM9240 1009121133#define I2C_DRIVERID_LTC1710 1010122122-#define I2C_DRIVERID_SIS5595 1011123134#define I2C_DRIVERID_ICSPLL 1012124135#define I2C_DRIVERID_BT869 1013125136#define I2C_DRIVERID_MAXILIFE 1014126137#define I2C_DRIVERID_MATORB 1015127138#define I2C_DRIVERID_GL520 1016128139#define I2C_DRIVERID_THMC50 1017129129-#define I2C_DRIVERID_DDCMON 1018130130-#define I2C_DRIVERID_VIA686A 1019131140#define I2C_DRIVERID_ADM1025 1020132141#define I2C_DRIVERID_LM87 1021133142#define I2C_DRIVERID_PCF8574 1022···136151#define I2C_DRIVERID_FSCPOS 1028137152#define I2C_DRIVERID_FSCSCY 1029138153#define I2C_DRIVERID_PCF8591 1030139139-#define I2C_DRIVERID_SMSC47M1 1031140140-#define I2C_DRIVERID_VT1211 1032141154#define I2C_DRIVERID_LM92 1033142142-#define I2C_DRIVERID_VT8231 1034143155#define I2C_DRIVERID_SMARTBATT 1035144156#define I2C_DRIVERID_BMCSENSORS 1036145157#define I2C_DRIVERID_FS451 1037146146-#define I2C_DRIVERID_W83627HF 1038147158#define I2C_DRIVERID_LM85 1039148159#define I2C_DRIVERID_LM83 1040149160#define I2C_DRIVERID_LM90 1042150161#define I2C_DRIVERID_ASB100 1043151162#define I2C_DRIVERID_FSCHER 1046152163#define I2C_DRIVERID_W83L785TS 1047153153-#define I2C_DRIVERID_SMSC47B397 1050154164155165/*156166 * ---- Adapter types ----------------------------------------------------
+12-29
include/linux/i2c.h
···105105 * A driver is capable of handling one or more physical devices present on106106 * I2C adapters. This information is used to inform the driver of adapter107107 * events.108108+ *109109+ * The driver.owner field should be set to the module owner of this driver.110110+ * The driver.name field should be set to the name of this driver.108111 */109112110113struct i2c_driver {111111- struct module *owner;112112- char name[32];113114 int id;114115 unsigned int class;115115- unsigned int flags; /* div., see below */116116117117 /* Notifies the driver that a new bus has appeared. This routine118118 * can be used by the driver to test if the bus meets its conditions···250250 dev_set_drvdata (&dev->dev, data);251251}252252253253-/*flags for the driver struct: */254254-#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */255255-#if 0256256-/* this flag is gone -- there is a (optional) driver->detach_adapter257257- * callback now which can be used instead */258258-# define I2C_DF_DUMMY 0x02259259-#endif260260-261253/*flags for the client struct: */262262-#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */263263-#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */264264- /* on an i2c_client */265254#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */266255#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */267256 /* Must equal I2C_M_TEN below */···291302extern int i2c_add_adapter(struct i2c_adapter *);292303extern int i2c_del_adapter(struct i2c_adapter *);293304294294-extern int i2c_add_driver(struct i2c_driver *);305305+extern int i2c_register_driver(struct module *, struct i2c_driver *);295306extern int i2c_del_driver(struct i2c_driver *);307307+308308+static inline int i2c_add_driver(struct i2c_driver *driver)309309+{310310+ return i2c_register_driver(THIS_MODULE, driver);311311+}296312297313extern int i2c_attach_client(struct i2c_client *);298314extern int i2c_detach_client(struct i2c_client *);299315300300-/* New function: This is to get an i2c_client-struct for controlling the 301301- client either by using i2c_control-function or having the 302302- client-module export functions that can be used with the i2c_client303303- -struct. */304304-extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, 305305- struct i2c_client *prev);306306-307307-/* Should be used with new function308308- extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);309309- to make sure that client-struct is valid and that it is okay to access310310- the i2c-client. 311311- returns -EACCES if client doesn't allow use (default)312312- returns -EBUSY if client doesn't allow multiple use (default) and 313313- usage_count >0 */316316+/* Should be used to make sure that client-struct is valid and that it317317+ is okay to access the i2c-client.318318+ returns -ENODEV if client has gone in the meantime */314319extern int i2c_use_client(struct i2c_client *);315320extern int i2c_release_client(struct i2c_client *);316321
···9191u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len);9292u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len);9393u32 * xdr_encode_string(u32 *p, const char *s);9494-u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);9594u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen);9695u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *);9796u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *);···132133{133134 return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base);134135}135135-136136-/*137137- * Maximum number of iov's we use.138138- */139139-#define MAX_IOVEC (12)140136141137/*142138 * XDR buffer helper functions
+7-5
include/linux/sunrpc/xprt.h
···7979 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */8080 struct list_head rq_list;81818282+ __u32 * rq_buffer; /* XDR encode buffer */8383+ size_t rq_bufsize;8484+8285 struct xdr_buf rq_private_buf; /* The receive buffer8386 * used in the softirq.8487 */8588 unsigned long rq_majortimeo; /* major timeout alarm */8689 unsigned long rq_timeout; /* Current timeout value */8790 unsigned int rq_retries; /* # of retries */8888- /*8989- * For authentication (e.g. auth_des)9090- */9191- u32 rq_creddata[2];92919392 /*9493 * Partial send handling9594 */9696-9795 u32 rq_bytes_sent; /* Bytes we have sent */98969997 unsigned long rq_xtime; /* when transmitted */···104106 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);105107 int (*reserve_xprt)(struct rpc_task *task);106108 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);109109+ void (*set_port)(struct rpc_xprt *xprt, unsigned short port);107110 void (*connect)(struct rpc_task *task);111111+ void * (*buf_alloc)(struct rpc_task *task, size_t size);112112+ void (*buf_free)(struct rpc_task *task);108113 int (*send_request)(struct rpc_task *task);109114 void (*set_retrans_timeout)(struct rpc_task *task);110115 void (*timer)(struct rpc_task *task);···254253#define XPRT_LOCKED (0)255254#define XPRT_CONNECTED (1)256255#define XPRT_CONNECTING (2)256256+#define XPRT_CLOSE_WAIT (3)257257258258static inline void xprt_set_connected(struct rpc_xprt *xprt)259259{
+5-4
include/linux/writeback.h
···5353 loff_t start;5454 loff_t end;55555656- unsigned nonblocking:1; /* Don't get stuck on request queues */5757- unsigned encountered_congestion:1; /* An output: a queue is full */5858- unsigned for_kupdate:1; /* A kupdate writeback */5959- unsigned for_reclaim:1; /* Invoked from the page allocator */5656+ unsigned nonblocking:1; /* Don't get stuck on request queues */5757+ unsigned encountered_congestion:1; /* An output: a queue is full */5858+ unsigned for_kupdate:1; /* A kupdate writeback */5959+ unsigned for_reclaim:1; /* Invoked from the page allocator */6060+ unsigned for_writepages:1; /* This is a writepages() call */6061};61626263/*
···856856857857 filter = sk->sk_filter;858858 if (filter) {859859- int pkt_len = sk_run_filter(skb, filter->insns,860860- filter->len);859859+ unsigned int pkt_len = sk_run_filter(skb, filter->insns,860860+ filter->len);861861 if (!pkt_len)862862 err = -EPERM;863863 else
+1-12
kernel/posix-cpu-timers.c
···238238 while ((t = next_thread(t)) != p) {239239 cpu->sched += t->sched_time;240240 }241241- if (p->tgid == current->tgid) {242242- /*243243- * We're sampling ourselves, so include the244244- * cycles not yet banked. We still omit245245- * other threads running on other CPUs,246246- * so the total can always be behind as247247- * much as max(nthreads-1,ncpus) * (NSEC_PER_SEC/HZ).248248- */249249- cpu->sched += current_sched_time(current);250250- } else {251251- cpu->sched += p->sched_time;252252- }241241+ cpu->sched += sched_ns(p);253242 break;254243 }255244 return 0;
+8-2
mm/page-writeback.c
···550550551551int do_writepages(struct address_space *mapping, struct writeback_control *wbc)552552{553553+ int ret;554554+553555 if (wbc->nr_to_write <= 0)554556 return 0;557557+ wbc->for_writepages = 1;555558 if (mapping->a_ops->writepages)556556- return mapping->a_ops->writepages(mapping, wbc);557557- return generic_writepages(mapping, wbc);559559+ ret = mapping->a_ops->writepages(mapping, wbc);560560+ else561561+ ret = generic_writepages(mapping, wbc);562562+ wbc->for_writepages = 0;563563+ return ret;558564}559565560566/**
+1-1
net/atm/br2684.c
···295295 unsigned char *rawp;296296 eth = eth_hdr(skb);297297298298- if (*eth->h_dest & 1) {298298+ if (is_multicast_ether_addr(eth->h_dest)) {299299 if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)300300 skb->pkt_type = PACKET_BROADCAST;301301 else
+1-1
net/bridge/br_input.c
···6868 }6969 }70707171- if (dest[0] & 1) {7171+ if (is_multicast_ether_addr(dest)) {7272 br_flood_forward(br, skb, !passedup);7373 if (!passedup)7474 br_pass_frame_up(br, skb);
+9-4
net/bridge/br_netfilter.c
···394394 * target in particular. Save the original destination IP395395 * address to be able to detect DNAT afterwards. */396396static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,397397- const struct net_device *in, const struct net_device *out,398398- int (*okfn)(struct sk_buff *))397397+ const struct net_device *in,398398+ const struct net_device *out,399399+ int (*okfn)(struct sk_buff *))399400{400401 struct iphdr *iph;401402 __u32 len;···413412 goto out;414413415414 if (skb->protocol == __constant_htons(ETH_P_8021Q)) {415415+ u8 *vhdr = skb->data;416416 skb_pull(skb, VLAN_HLEN);417417- (skb)->nh.raw += VLAN_HLEN;417417+ skb_postpull_rcsum(skb, vhdr, VLAN_HLEN);418418+ skb->nh.raw += VLAN_HLEN;418419 }419420 return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn);420421 }···432429 goto out;433430434431 if (skb->protocol == __constant_htons(ETH_P_8021Q)) {432432+ u8 *vhdr = skb->data;435433 skb_pull(skb, VLAN_HLEN);436436- (skb)->nh.raw += VLAN_HLEN;434434+ skb_postpull_rcsum(skb, vhdr, VLAN_HLEN);435435+ skb->nh.raw += VLAN_HLEN;437436 }438437439438 if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+3-3
net/core/filter.c
···7575 * len is the number of filter blocks in the array.7676 */77777878-int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)7878+unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)7979{8080 struct sock_filter *fentry; /* We walk down these */8181 void *ptr;···241241 A = X;242242 continue;243243 case BPF_RET|BPF_K:244244- return ((unsigned int)fentry->k);244244+ return fentry->k;245245 case BPF_RET|BPF_A:246246- return ((unsigned int)A);246246+ return A;247247 case BPF_ST:248248 mem[fentry->k] = A;249249 continue;
···162162 * is otherwise not dependent on the TCP/IP stack.163163 */164164165165-__u32 in_aton(const char *str)165165+__be32 in_aton(const char *str)166166{167167 unsigned long l;168168 unsigned int val;
+1-1
net/ethernet/eth.c
···163163 skb_pull(skb,ETH_HLEN);164164 eth = eth_hdr(skb);165165166166- if (*eth->h_dest&1) {166166+ if (is_multicast_ether_addr(eth->h_dest)) {167167 if (!compare_ether_addr(eth->h_dest, dev->broadcast))168168 skb->pkt_type = PACKET_BROADCAST;169169 else
···418418 struct sk_buff *skb2;419419 unsigned int mtu, hlen, left, len, ll_rs;420420 int offset;421421- int not_last_frag;421421+ __be16 not_last_frag;422422 struct rtable *rt = (struct rtable*)skb->dst;423423 int err = 0;424424···11801180 struct ip_options *opt = NULL;11811181 struct rtable *rt = inet->cork.rt;11821182 struct iphdr *iph;11831183- int df = 0;11831183+ __be16 df = 0;11841184 __u8 ttl;11851185 int err = 0;11861186
+1-1
net/ipv4/ipvs/ip_vs_xmit.c
···322322 struct net_device *tdev; /* Device to other host */323323 struct iphdr *old_iph = skb->nh.iph;324324 u8 tos = old_iph->tos;325325- u16 df = old_iph->frag_off;325325+ __be16 df = old_iph->frag_off;326326 struct iphdr *iph; /* Our new IP header */327327 int max_headroom; /* The extra header space needed */328328 int mtu;
+1-1
net/ipv4/netfilter/ip_nat_ftp.c
···171171/* Prior to 2.6.11, we had a ports param. No longer, but don't break users. */172172static int warn_set(const char *val, struct kernel_param *kp)173173{174174- printk(KERN_INFO __stringify(KBUILD_MODNAME)174174+ printk(KERN_INFO KBUILD_MODNAME175175 ": kernel >= 2.6.10 only uses 'ports' for conntrack modules\n");176176 return 0;177177}
+1-1
net/ipv4/netfilter/ip_nat_irc.c
···113113/* Prior to 2.6.11, we had a ports param. No longer, but don't break users. */114114static int warn_set(const char *val, struct kernel_param *kp)115115{116116- printk(KERN_INFO __stringify(KBUILD_MODNAME)116116+ printk(KERN_INFO KBUILD_MODNAME117117 ": kernel >= 2.6.10 only uses 'ports' for conntrack modules\n");118118 return 0;119119}
···133133HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl134134HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK135135136136-HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`137137-HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \136136+HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`137137+HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \138138 -D LKC_DIRECT_LINK139139140140$(obj)/qconf.o: $(obj)/.tmp_qtcheck···193193194194# GTK needs some extra effort, too...195195$(obj)/.tmp_gtkcheck:196196- @if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then \197197- if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then \196196+ @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \197197+ if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \198198 touch $@; \199199 else \200200 echo "*"; \
+17-51
scripts/setlocalversion
···11-#!/usr/bin/perl22-# Copyright 2004 - Ryan Anderson <ryan@michonline.com> GPL v211+#!/bin/sh22+# Print additional version information for non-release trees.3344-use strict;55-use warnings;66-use Digest::MD5;77-require 5.006;88-99-if (@ARGV != 1) {1010- print <<EOT;1111-Usage: setlocalversion <srctree>1212-EOT1313- exit(1);44+usage() {55+ echo "Usage: $0 [srctree]" >&266+ exit 1147}1581616-my ($srctree) = @ARGV;1717-chdir($srctree);99+cd "${1:-.}" || usage18101919-my @LOCALVERSIONS = ();1111+# Check for git and a git repo.1212+if head=`git rev-parse --verify HEAD 2>/dev/null`; then1313+ # Do we have an untagged version?1414+ if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then1515+ printf '%s%s' -g `echo "$head" | cut -c1-8`1616+ fi20172121-# We are going to use the following commands to try and determine if this2222-# repository is at a Version boundary (i.e, 2.6.10 vs 2.6.10 + some patches) We2323-# currently assume that all meaningful version boundaries are marked by a tag.2424-# We don't care what the tag is, just that something exists.2525-2626-# Git/Cogito store the top-of-tree "commit" in .git/HEAD2727-# A list of known tags sits in .git/refs/tags/2828-#2929-# The simple trick here is to just compare the two of these, and if we get a3030-# match, return nothing, otherwise, return a subset of the SHA-1 hash in3131-# .git/HEAD3232-3333-sub do_git_checks {3434- open(H,"<.git/HEAD") or return;3535- my $head = <H>;3636- chomp $head;3737- close(H);3838-3939- opendir(D,".git/refs/tags") or return;4040- foreach my $tagfile (grep !/^\.{1,2}$/, readdir(D)) {4141- open(F,"<.git/refs/tags/" . $tagfile) or return;4242- my $tag = <F>;4343- chomp $tag;4444- close(F);4545- return if ($tag eq $head);4646- }4747- closedir(D);4848-4949- push @LOCALVERSIONS, "g" . substr($head,0,8);5050-}5151-5252-if ( -d ".git") {5353- do_git_checks();5454-}5555-5656-printf "-%s\n", join("-",@LOCALVERSIONS) if (scalar @LOCALVERSIONS > 0);1818+ # Are there uncommitted changes?1919+ if git diff-files | read dummy; then2020+ printf '%s' -git_dirty2121+ fi2222+fi
+2-4
security/capability.c
···4949 .vm_enough_memory = cap_vm_enough_memory,5050};51515252-#define MY_NAME __stringify(KBUILD_MODNAME)5353-5452/* flag to keep track of how we were registered */5553static int secondary;5654···6567 /* register ourselves with the security framework */6668 if (register_security (&capability_ops)) {6769 /* try registering with primary module */6868- if (mod_reg_security (MY_NAME, &capability_ops)) {7070+ if (mod_reg_security (KBUILD_MODNAME, &capability_ops)) {6971 printk (KERN_INFO "Failure registering capabilities "7072 "with primary security module.\n");7173 return -EINVAL;···8385 return;8486 /* remove ourselves from the security framework */8587 if (secondary) {8686- if (mod_unreg_security (MY_NAME, &capability_ops))8888+ if (mod_unreg_security (KBUILD_MODNAME, &capability_ops))8789 printk (KERN_INFO "Failure unregistering capabilities "8890 "with primary module.\n");8991 return;