hwmon: (gpio-fan) Fix Kconfig dependencies

gpio-fan depends on GPIOLIB, not on GENERIC_GPIO.

This fixes the following build error, seen if GPIOLIB is not defined:

src/drivers/hwmon/gpio-fan.c: error: implicit declaration of function 'gpio_direction_output': => 372:3
src/drivers/hwmon/gpio-fan.c: error: implicit declaration of function 'gpio_free': => 130:2
src/drivers/hwmon/gpio-fan.c: error: implicit declaration of function 'gpio_get_value': => 79:2
src/drivers/hwmon/gpio-fan.c: error: implicit declaration of function 'gpio_request': => 98:2
src/drivers/hwmon/gpio-fan.c: error: implicit declaration of function 'gpio_set_value': => 156:3
src/drivers/hwmon/gpio-fan.c: error: implicit declaration of function 'gpio_to_irq': => 114:2

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Simon Guinot <sguinot@lacie.com>
hwmon: (sht15) Fix Kconfig dependencies

sht15 depends on GPIOLIB, not on GENERIC_GPIO.

This fixes the following build error, seen if GPIOLIB is not defined:

src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_direction_input': => 293:2
src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_direction_output': => 216:2
src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_free': => 1000:2
src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_get_value': => 296:2
src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_request': => 946:2
src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_set_value': => 218:2
src/drivers/hwmon/sht15.c: error: implicit declaration of function 'gpio_to_irq': => 514:2

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
hwmon: (max6639) Convert to dev_pm_ops

The I2C specific PM operations have been deprecated and printing a
warning on boot for over a year now.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
[guenter.roeck@ericsson.com: Added missing #ifdef around pm functions]
Cc: stable@vger.kernel.org # 3.0+
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
hwmon: (f75375s) Fix warning message seen in some configurations

In some configurations, BUG() does not result in an endless loop but returns to
the caller. This results in the following compiler warning:

drivers/hwmon/f75375s.c: In function 'duty_mode_enabled':
drivers/hwmon/f75375s.c:280: warning: control reaches end of non-void function
drivers/hwmon/f75375s.c: In function 'auto_mode_enabled':
drivers/hwmon/f75375s.c:295: warning: control reaches end of non-void function

Fix the warning by returning something sensible after BUG().

Cc: Nikolaus Schulz <schulz@macnetix.de>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
hwmon: (adm1031) Fix compiler warning

Some configurations produce the following compile warning:

drivers/hwmon/adm1031.c: In function 'set_fan_auto_channel':
drivers/hwmon/adm1031.c:292: warning: 'reg' may be used uninitialized in this function

While this is a false positive, it can easily be fixed by overloading the return
value from get_fan_auto_nearest with both register value and error return code
(the register value is never negative). Coincidentially, that also reduces
module size by a few bytes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
hwmon: (acpi_power_meter) fix lockdep spew due to non-static lock class

Similar to a30dcb4f which fixed asus_atk0110.ko, I recently received a
bug report from someone hitting the same issue in acpi_power_meter.

[   13.963168] power_meter ACPI000D:00: Found ACPI power meter.
[   13.963900] BUG: key ffff8802161f3920 not in .data!
[   13.963904] ------------[ cut here ]------------
[   13.963915] WARNING: at kernel/lockdep.c:2986
	lockdep_init_map+0x52f/0x560()

So let's fix that up for them by statically declaring the
lockdep_class_key.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Cc: stable@vger.kernel.org # 3.0+
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
hwmon: (w83627ehf) mark const init data with __initconst instead of __initdata

As long as there is no other non-const variable marked __initdata in the
same compilation unit it doesn't hurt. If there were one however
compilation would fail with

	error: $variablename causes a section type conflict

because a section containing const variables is marked read only and so
cannot contain non-const variables.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: lm-sensors@lm-sensors.org
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
hwmon: (k10temp) Add support for AMD Trinity CPUs

The on-chip northbridge's temperature sensor of the upcoming
AMD Trinity CPUs works the same as for the previous CPUs.
Since it has a different PCI-ID, we just add the new one to the list
supported by k10temp.
This allows to use the k10temp driver on those CPUs.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Cc: stable@vger.kernel.org # 3.0+
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Revert "CIFS: Fix VFS lock usage for oplocked files"

Revert previous version of patch to incorporate feedback
so that we can merge version 3 of the patch instead.w

This reverts commit b5efb978469d152c2c7c0a09746fb0bfc6171868.
CIFS: Fix VFS lock usage for oplocked files

We can deadlock if we have a write oplock and two processes
use the same file handle. In this case the first process can't
unlock its lock if the second process blocked on the lock in the
same time.

Fix it by using posix_lock_file rather than posix_lock_file_wait
under cinode->lock_mutex. If we request a blocking lock and
posix_lock_file indicates that there is another lock that prevents
us, wait untill that lock is released and restart our call.

Cc: stable@kernel.org
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
net/garp: avoid infinite loop if attribute already exists

An infinite loop occurred if garp_attr_create was called with the values
of an existing attribute. This might happen if a previous leave request
for the attribute has not yet been followed by a PDU transmission (or,
if the application previously issued a join request for the attribute
and is now issuing another one, without having issued a leave request).

If garp_attr_create finds an existing attribute having the same values,
return the address to it. Its state will then get updated (i.e., if it
was in a leaving state, it will move into a non-leaving state and not
get deleted during the next PDU transmission).

To accomplish this fix, collapse garp_attr_insert into garp_attr_create
(which is its only caller).

Thanks to Jorge Boncompte [DTI2] <jorge@dti2.net> for contributing to
this fix.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Fix non TBI PHY access; a bad merge undid bug fix in a previous commit.

The merge done in commit b26e478f undid bug fix in commit c3e072f8
("net: fsl_pq_mdio: fix non tbi phy access"), with the result that non
TBI (e.g. MDIO) PHYs cannot be accessed.

Signed-off-by: Kenth Eriksson <kenth.eriksson@transmode.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
rose_dev: fix memcpy-bug in rose_set_mac_address

If both addresses equal, nothing needs to be done. If the device is down,
then we simply copy the new address to dev->dev_addr. If the device is up,
then we add another loopback device with the new address, and if that does
not fail, we remove the loopback device with the old address. And only
then, we update the dev->dev_addr.

Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nfnetlink_acct.c: use linux/atomic.h

There's no known problem here, but this is one of only two non-arch files
in the kernel which use asm/atomic.h instead of linux/atomic.h.

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net: lpc_eth: Fix rename of dev_hw_addr_random

In parallel to the integration of lpc_eth.c, dev_hw_addr_random() has been
renamed to eth_hw_addr_random(). This patch fixes it also in the new driver
lpc_eth.c.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
m68k: include asm/cmpxchg.h in our m68k atomic.h

After commit 9ffc93f203c18a70623f21950f1dd473c9ec48cd ("Remove all

  CC      init/main.o
In file included from include/linux/mm.h:15:0,
                 from include/linux/ring_buffer.h:5,
                 from include/linux/ftrace_event.h:4,
                 from include/trace/syscall.h:6,
                 from include/linux/syscalls.h:78,
                 from init/main.c:16:
include/linux/debug_locks.h: In function ‘__debug_locks_off’:
include/linux/debug_locks.h:16:2: error: implicit declaration of function ‘xchg’

There is no indirect inclusions of the new asm/cmpxchg.h for m68k here.
Looking at most other architectures they include asm/cmpxchg.h in their
asm/atomic.h. M68k currently does not do this. Including this in atomic.h
fixes all m68k build problems.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
m68k/mac: Add missing platform check before registering platform devices

On multi-platform kernels, the Mac platform devices should be registered
when running on Mac only. Else it may crash later.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@vger.kernel.org
m68k/q40: Add missing platform check before registering platform devices

On multi-platform kernels, the Q40/Q60 platform devices should be
registered when running on Q40/Q60 only. Else it may crash later.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
sparc: pgtable_64: change include order

Fix the following build breakage in v3.4-rc1:

  CC      arch/sparc/kernel/cpu.o
In file included from /home/aaro/git/linux/arch/sparc/include/asm/pgtable_64.h:15:0,
                 from /home/aaro/git/linux/arch/sparc/include/asm/pgtable.h:4,
                 from arch/sparc/kernel/cpu.c:15:
include/asm-generic/pgtable-nopud.h:13:16: error: unknown type name 'pgd_t'
include/asm-generic/pgtable-nopud.h:25:28: error: unknown type name 'pgd_t'
include/asm-generic/pgtable-nopud.h:26:27: error: unknown type name 'pgd_t'
include/asm-generic/pgtable-nopud.h:27:31: error: unknown type name 'pgd_t'
include/asm-generic/pgtable-nopud.h:28:30: error: unknown type name 'pgd_t'
include/asm-generic/pgtable-nopud.h:38:34: error: unknown type name 'pgd_t'
In file included from /home/aaro/git/linux/arch/sparc/include/asm/pgtable_64.h:783:0,
                 from /home/aaro/git/linux/arch/sparc/include/asm/pgtable.h:4,
                 from arch/sparc/kernel/cpu.c:15:
include/asm-generic/pgtable.h: In function 'pgd_none_or_clear_bad':
include/asm-generic/pgtable.h:258:2: error: implicit declaration of function 'pgd_none' [-Werror=implicit-function-declaration]
include/asm-generic/pgtable.h:260:2: error: implicit declaration of function 'pgd_bad' [-Werror=implicit-function-declaration]
include/asm-generic/pgtable.h: In function 'pud_none_or_clear_bad':
include/asm-generic/pgtable.h:269:6: error: request for member 'pgd' in something not a structure or union

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>