platform/adaptation/renesas_rcar/renesas_kernel.git
17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
Linus Torvalds [Sat, 2 Dec 2006 00:41:58 +0000 (16:41 -0800)]
Merge /pub/scm/linux/kernel/git/gregkh/usb-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (103 commits)
  usbcore: remove unused argument in autosuspend
  USB: keep count of unsuspended children
  USB hub: simplify remote-wakeup handling
  USB: struct usb_device: change flag to bitflag
  OHCI: make autostop conditional on CONFIG_PM
  USB: Add autosuspend support to the hub driver
  EHCI: Fix root-hub and port suspend/resume problems
  USB: create a new thread for every USB device found during the probe sequence
  USB: add driver for the USB debug devices
  USB: added dynamic major number for USB endpoints
  USB: pegasus error path not resetting task's state
  USB: endianness fix for asix.c
  USB: build the appledisplay driver
  USB serial: replace kmalloc+memset with kzalloc
  USB: hid-core: canonical defines for Apple USB device IDs
  USB: idmouse cleanup
  USB: make drivers/usb/core/driver.c:usb_device_match() static
  USB: lh7a40x_udc remove double declaration
  USB: pxa2xx_udc recognizes ixp425 rev b0 chip
  usbtouchscreen: add support for DMC TSC-10/25 devices
  ...

17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
Linus Torvalds [Sat, 2 Dec 2006 00:41:27 +0000 (16:41 -0800)]
Merge /pub/scm/linux/kernel/git/gregkh/pci-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (28 commits)
  PCI: make arch/i386/pci/common.c:pci_bf_sort static
  PCI: ibmphp_pci.c: fix NULL dereference
  pciehp: remove unnecessary pci_disable_msi
  pciehp: remove unnecessary free_irq
  PCI: rpaphp: change device tree examination
  PCI: Change memory allocation for acpiphp slots
  i2c-i801: SMBus patch for Intel ICH9
  PCI: irq: irq and pci_ids patch for Intel ICH9
  PCI: pci_{enable,disable}_device() nestable ports
  PCI: switch pci_{enable,disable}_device() to be nestable
  PCI: arch/i386/kernel/pci-dma.c: ioremap balanced with iounmap
  pci/i386: style cleanups
  PCI: Block on access to temporarily unavailable pci device
  pci: fix __pci_register_driver error handling
  pci: clear osc support flags if no _OSC method
  acpiphp: fix missing acpiphp_glue_exit()
  acpiphp: fix use of list_for_each macro
  Altix: Initial ACPI support - ROM shadowing.
  Altix: SN ACPI hotplug support.
  Altix: Add initial ACPI IO support
  ...

17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Linus Torvalds [Sat, 2 Dec 2006 00:41:07 +0000 (16:41 -0800)]
Merge /pub/scm/linux/kernel/git/gregkh/driver-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits)
  Driver core: show drivers in /sys/module/
  Documentation/driver-model/platform.txt update/rewrite
  Driver core: platform_driver_probe(), can save codespace
  driver core: Use klist_remove() in device_move()
  driver core: Introduce device_move(): move a device to a new parent.
  Driver core: make drivers/base/core.c:setup_parent() static
  driver core: Introduce device_find_child().
  sysfs: sysfs_write_file() writes zero terminated data
  cpu topology: consider sysfs_create_group return value
  Driver core: Call platform_notify_remove later
  ACPI: Change ACPI to use dev_archdata instead of firmware_data
  Driver core: add dev_archdata to struct device
  Driver core: convert sound core to use struct device
  Driver core: change mem class_devices to be real devices
  Driver core: convert fb code to use struct device
  Driver core: convert firmware code to use struct device
  Driver core: convert mmc code to use struct device
  Driver core: convert ppdev code to use struct device
  Driver core: convert PPP code to use struct device
  Driver core: convert cpuid code to use struct device
  ...

17 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
Linus Torvalds [Sat, 2 Dec 2006 00:40:13 +0000 (16:40 -0800)]
Merge git://git./linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  [CIFS] Fix timezone handling on stat to os/2
  [CIFS] Incorrect hardlink count when original file is cached (oplocked)

17 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial
Linus Torvalds [Sat, 2 Dec 2006 00:38:18 +0000 (16:38 -0800)]
Merge git://git./linux/kernel/git/bunk/trivial

* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial:
  Fix typos in drivers/isdn/hisax/isdnl2.c
  Fix typos in doc and comments
  BUG_ON conversion for fs/aio.c
  BUG_ON conversion for drivers/mmc/omap.c
  BUG_ON conversion for drivers/media/video/pwc/pwc-if.c
  Fix misc .c/.h comment typos
  Fix misc Kconfig typos
  Fix typos in /Documentation : Misc
  Fix typos in /Documentation : 'U-Z'
  Fix typos in /Documentation : 'T''
  Fix jiffies.h comment
  tabify MAINTAINERS
  fix spelling error in include/linux/kernel.h
  mqueue.h: don't include linux/types.h

17 years agoDriver core: show drivers in /sys/module/
Kay Sievers [Fri, 24 Nov 2006 11:15:25 +0000 (12:15 +0100)]
Driver core: show drivers in /sys/module/

Show the drivers, which belong to the module:
  $ ls -l /sys/module/usbcore/drivers/
  hub -> ../../../bus/usb/drivers/hub
  usb -> ../../../bus/usb/drivers/usb
  usbfs -> ../../../bus/usb/drivers/usbfs

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDocumentation/driver-model/platform.txt update/rewrite
David Brownell [Fri, 17 Nov 2006 07:30:14 +0000 (23:30 -0800)]
Documentation/driver-model/platform.txt update/rewrite

This is almost a rewrite of the driver-model/platform.txt documentation;
the previous text was obsolete (for several years), evidently it never
got updated to match the change from being a PC "legacy_bus" to the more
widely used core bus for most embedded systems.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: platform_driver_probe(), can save codespace
David Brownell [Fri, 17 Nov 2006 07:28:47 +0000 (23:28 -0800)]
Driver core: platform_driver_probe(), can save codespace

This defines a new platform_driver_probe() method allowing the driver's
probe() method, and its support code+data, to safely live in __init
sections for typical system configurations.

Many system-on-chip processors could benefit from this API, to the tune
of recovering hundreds to thousands of bytes per driver.  That's memory
which is currently wasted holding code which can never be called after
system startup, yet can not be removed.   It can't be removed because of
the linkage requirement that pointers to init section code (like, ideally,
probe support) must not live in other sections (like driver method tables)
after those pointers would be invalid.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agodriver core: Use klist_remove() in device_move()
Cornelia Huck [Wed, 22 Nov 2006 16:49:39 +0000 (17:49 +0100)]
driver core: Use klist_remove() in device_move()

As pointed out by Alan Stern, device_move needs to use klist_remove which waits
until removal is complete.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agodriver core: Introduce device_move(): move a device to a new parent.
Cornelia Huck [Mon, 20 Nov 2006 16:07:51 +0000 (17:07 +0100)]
driver core: Introduce device_move(): move a device to a new parent.

Provide a function device_move() to move a device to a new parent device. Add
auxilliary functions kobject_move() and sysfs_move_dir().
kobject_move() generates a new uevent of type KOBJ_MOVE, containing the
previous path (DEVPATH_OLD) in addition to the usual values. For this, a new
interface kobject_uevent_env() is created that allows to add further
environmental data to the uevent at the kobject layer.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: make drivers/base/core.c:setup_parent() static
Adrian Bunk [Fri, 17 Nov 2006 01:19:44 +0000 (02:19 +0100)]
Driver core: make drivers/base/core.c:setup_parent() static

This patch makes the needlessly global setup_parent() static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agodriver core: Introduce device_find_child().
Cornelia Huck [Thu, 16 Nov 2006 14:42:07 +0000 (15:42 +0100)]
driver core: Introduce device_find_child().

Introduce device_find_child() to match device_for_each_child().

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agosysfs: sysfs_write_file() writes zero terminated data
Thomas Maier [Sun, 22 Oct 2006 17:17:47 +0000 (19:17 +0200)]
sysfs: sysfs_write_file() writes zero terminated data

since most of the files in sysfs are text files,
it would be nice, if the "store" function called
during sysfs_write_file() gets a zero terminated
string / data.
The current implementation seems not to ensure this.
(But only if it is the first time the zeroed buffer
page is allocated.)

So the buffer can be scanned by sscanf() easily,
for example.

This patch simply sets a \0 char behind the
data in buffer->page.

Signed-off-by: Thomas Maier <balagi@justmail.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agocpu topology: consider sysfs_create_group return value
Heiko Carstens [Thu, 9 Nov 2006 03:46:09 +0000 (19:46 -0800)]
cpu topology: consider sysfs_create_group return value

Take return value of sysfs_create_group() into account.  That function got
called in case of CPU_ONLINE notification.  Since callbacks are not allowed
to fail on CPU_ONLINE notification do the sysfs group creation on
CPU_UP_PREPARE notification.

Also remember if creation succeeded in a bitmask.  So it's possible to know
whether it's legal to call sysfs_remove_group or not.

In addition some other minor stuff:

- since CPU_UP_PREPARE might fail add CPU_UP_CANCELED handling as well.
- use hotcpu_notifier instead of register_hotcpu_notifier.
- #ifdef code that isn't needed in the !CONFIG_HOTPLUG_CPU case.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: Call platform_notify_remove later
Benjamin Herrenschmidt [Thu, 9 Nov 2006 03:46:14 +0000 (19:46 -0800)]
Driver core: Call platform_notify_remove later

Move the call to platform_notify_remove() to after the call to
bus_remove_device(), where it belongs.  It's bogus to notify the platform
of removal while drivers are still attached to the device and possibly
still operating since the platform might use this callback to tear down
some resources used by the driver (ACPI bits, iommu table, ...)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoACPI: Change ACPI to use dev_archdata instead of firmware_data
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:18:42 +0000 (17:18 +1100)]
ACPI: Change ACPI to use dev_archdata instead of firmware_data

Change ACPI to use dev_archdata instead of firmware_data

This patch changes ACPI to use the new dev_archdata on i386, x86_64
and ia64 (is there any other arch using ACPI ?) to store it's
acpi_handle.

It also removes the firmware_data field from struct device as this
was the only user.

Only build-tested on x86

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: add dev_archdata to struct device
Benjamin Herrenschmidt [Sat, 11 Nov 2006 06:18:39 +0000 (17:18 +1100)]
Driver core: add dev_archdata to struct device

Add arch specific dev_archdata to struct device

Adds an arch specific struct dev_arch to struct device. This enables
architecture to add specific fields to every device in the system, like
DMA operation pointers, NUMA node ID, firmware specific data, etc...

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Andi Kleen <ak@suse.de>
Acked-By: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert sound core to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert sound core to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

It also makes the struct sound_card to show up as a "real" device
where all the different sound class devices are placed as childs
and different card attribute files can hang off of. /sys/class/sound is
still a flat directory, but the symlink targets of all devices belonging
to the same card, point the the /sys/devices tree below the new card
device object.

Thanks to Kay for the updates to this patch.

Signed-off-by: Kay Sievers <kay.sievers@novell.com>
Acked-by: Jaroslav Kysela <perex@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: change mem class_devices to be real devices
Greg Kroah-Hartman [Wed, 26 Jul 2006 00:13:31 +0000 (17:13 -0700)]
Driver core: change mem class_devices to be real devices

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert fb code to use struct device
Greg Kroah-Hartman [Thu, 14 Sep 2006 14:30:59 +0000 (07:30 -0700)]
Driver core: convert fb code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert firmware code to use struct device
Greg Kroah-Hartman [Thu, 14 Sep 2006 14:30:59 +0000 (07:30 -0700)]
Driver core: convert firmware code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert mmc code to use struct device
Greg Kroah-Hartman [Tue, 12 Sep 2006 15:00:10 +0000 (17:00 +0200)]
Driver core: convert mmc code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert ppdev code to use struct device
Greg Kroah-Hartman [Tue, 12 Sep 2006 15:00:10 +0000 (17:00 +0200)]
Driver core: convert ppdev code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert PPP code to use struct device
Greg Kroah-Hartman [Tue, 12 Sep 2006 15:00:10 +0000 (17:00 +0200)]
Driver core: convert PPP code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert cpuid code to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert cpuid code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert msr code to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert msr code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoI2C: convert i2c-dev to use struct device instead of struct class_device
Greg Kroah-Hartman [Mon, 3 Jul 2006 20:46:24 +0000 (13:46 -0700)]
I2C: convert i2c-dev to use struct device instead of struct class_device

As class_device is going away eventually...

Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert raw device code to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert raw device code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert tty core to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert tty core to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Also fixes up the isdn drivers that were putting something in the class
device's directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: change misc class_devices to be real devices
Greg Kroah-Hartman [Thu, 27 Jul 2006 23:16:04 +0000 (16:16 -0700)]
Driver core: change misc class_devices to be real devices

This also ment that some of the misc drivers had to also be fixed
up as they were assuming the device was a class_device.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert vc code to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert vc code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: convert vt code to use struct device
Greg Kroah-Hartman [Tue, 8 Aug 2006 05:19:37 +0000 (22:19 -0700)]
Driver core: convert vt code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoCONFIG_SYSFS_DEPRECATED - class symlinks
Kay Sievers [Thu, 14 Sep 2006 09:23:28 +0000 (11:23 +0200)]
CONFIG_SYSFS_DEPRECATED - class symlinks

Turn off class symlinks CONFIG_SYSFS_DEPRECATED is enabled.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoCONFIG_SYSFS_DEPRECATED - PHYSDEV* uevent variables
Kay Sievers [Thu, 14 Sep 2006 09:23:28 +0000 (11:23 +0200)]
CONFIG_SYSFS_DEPRECATED - PHYSDEV* uevent variables

Disable the PHYSDEV* uevent variables if CONFIG_SYSFS_DEPRECATED is
enabled.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoCONFIG_SYSFS_DEPRECATED - device symlinks
Kay Sievers [Thu, 14 Sep 2006 09:23:28 +0000 (11:23 +0200)]
CONFIG_SYSFS_DEPRECATED - device symlinks

Turn off device symlinks CONFIG_SYSFS_DEPRECATED is enabled.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoCONFIG_SYSFS_DEPRECATED - bus symlinks
Kay Sievers [Thu, 14 Sep 2006 09:23:28 +0000 (11:23 +0200)]
CONFIG_SYSFS_DEPRECATED - bus symlinks

Turn off the bus symlinks if CONFIG_SYSFS_DEPRECATED is enabled

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: make old versions of udev work properly
Greg Kroah-Hartman [Mon, 23 Oct 2006 23:37:58 +0000 (00:37 +0100)]
Driver core: make old versions of udev work properly

If CONFIG_SYSFS_DEPRECATED is enabled, old versions of udev will work
properly with devices that are associated with a class.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoCONFIG_SYSFS_DEPRECATED
Kay Sievers [Thu, 14 Sep 2006 09:23:28 +0000 (11:23 +0200)]
CONFIG_SYSFS_DEPRECATED

Provide a way to support older versions of udev that are shipped in
older distros.  If this option is disabled, it will also turn off the
compatible symlinks in sysfs that older programs might rely on.

When in doubt, or if running a distro older than 2006, say Yes here.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver Core: Move virtual_device_parent() to core.c
Greg Kroah-Hartman [Mon, 23 Oct 2006 17:40:54 +0000 (10:40 -0700)]
Driver Core: Move virtual_device_parent() to core.c

It doesn't need to be global or in device.h

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: fix "driver" symlink timing
Kay Sievers [Sat, 7 Oct 2006 19:55:55 +0000 (21:55 +0200)]
Driver core: fix "driver" symlink timing

Create the "driver" link before the child device may be created by
the probing logic. This makes it possible for userspace (udev), to
determine the driver property of the parent device, at the time the
child device is created.

Signed-off-by: Kay Sievers <kay.sievers@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoDriver core: add notification of bus events
Benjamin Herrenschmidt [Wed, 25 Oct 2006 03:44:59 +0000 (13:44 +1000)]
Driver core: add notification of bus events

I finally did as you suggested and added the notifier to the struct
bus_type itself. There are still problems to be expected is something
attaches to a bus type where the code can hook in different struct
device sub-classes (which is imho a big bogosity but I won't even try to
argue that case now) but it will solve nicely a number of issues I've
had so far.

That also means that clients interested in registering for such
notifications have to do it before devices are added and after bus types
are registered. Fortunately, most bus types that matter for the various
usage scenarios I have in mind are registerd at postcore_initcall time,
which means I have a really nice spot at arch_initcall time to add my
notifiers.

There are 4 notifications provided. Device being added (before hooked to
the bus) and removed (failure of previous case or after being unhooked
from the bus), along with driver being bound to a device and about to be
unbound.

The usage I have for these are:

 - The 2 first ones are used to maintain a struct device_ext that is
hooked to struct device.firmware_data. This structure contains for now a
pointer to the Open Firmware node related to the device (if any), the
NUMA node ID (for quick access to it) and the DMA operations pointers &
iommu table instance for DMA to/from this device. For bus types I own
(like IBM VIO or EBUS), I just maintain that structure directly from the
bus code when creating the devices. But for bus types managed by generic
code like PCI or platform (actually, of_platform which is a variation of
platform linked to Open Firmware device-tree), I need this notifier.

 - The other two ones have a completely different usage scenario. I have
cases where multiple devices and their drivers depend on each other. For
example, the IBM EMAC network driver needs to attach to a MAL DMA engine
which is a separate device, and a PHY interface which is also a separate
device. They are all of_platform_device's (well, about to be with my
upcoming patches) but there is no say in what precise order the core
will "probe" them and instanciate the various modules. The solution I
found for that is to have the drivers for emac to use multithread_probe,
and wait for a driver to be bound to the target MAL and PHY control
devices (the device-tree contains reference to the MAL and PHY interface
nodes, which I can then match to of_platform_devices). Right now, I've
been polling, but with that notifier, I can more cleanly wait (with a
timeout of course).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: make arch/i386/pci/common.c:pci_bf_sort static
Adrian Bunk [Thu, 16 Nov 2006 12:16:23 +0000 (13:16 +0100)]
PCI: make arch/i386/pci/common.c:pci_bf_sort static

This patch makes the needlessly global pci_bf_sort static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: ibmphp_pci.c: fix NULL dereference
Adrian Bunk [Fri, 17 Nov 2006 01:19:25 +0000 (02:19 +0100)]
PCI: ibmphp_pci.c: fix NULL dereference

The correct order is: NULL check before dereference

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agopciehp: remove unnecessary pci_disable_msi
Kenji Kaneshige [Mon, 13 Nov 2006 23:13:09 +0000 (15:13 -0800)]
pciehp: remove unnecessary pci_disable_msi

This patch fixes the problem that "irq XX: nobody cared" kernel oops
is reported when pciehp is once rmmoded and insmoded again. The cause
of this problem is pciehp driver calls pci_disable_msi() at controller
release time, even though it must be done by PCI Express Port Bus
driver. This patch removes unnecessary pci_disable_msi() call from
pciehp driver.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agopciehp: remove unnecessary free_irq
Kenji Kaneshige [Mon, 13 Nov 2006 23:13:00 +0000 (15:13 -0800)]
pciehp: remove unnecessary free_irq

This patch fixes the problem that the following error messages is
reported when pciehp driver is rmmoded.

Trying to free already-free IRQ XX

The cause of this problem is that pciehp driver is doing unknown 2nd
free_irq at driver unloading. This patch removes this unknown 2nd
free_irq call.

Note: The pciehp driver should be adapted to standard device driver
mode.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: rpaphp: change device tree examination
John Rose [Mon, 13 Nov 2006 23:12:52 +0000 (15:12 -0800)]
PCI: rpaphp: change device tree examination

Change the criterion that RPA PCI Hotplug and RPA DLPAR use when
determining the hotplug capabilities of a given device node.  The
"device_type" property is less consistent than "name" across PCI nodes
on newer hardware.

Signed-off-by: John Rose <johnrose@austin.ibm.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Change memory allocation for acpiphp slots
Rolf Eike Beer [Mon, 13 Nov 2006 23:12:45 +0000 (15:12 -0800)]
PCI: Change memory allocation for acpiphp slots

Change memory allocation for acpiphp slots

Change the "struct slot" that acpiphp uses for managing it's slots to
directly contain the memory for the needed struct hotplug_slot_info and
the slot's name. This way we need only two memory allocations per slot
instead of four.

While we are at it: make_slot_name() is just a wrapper around snprintf()
knowing the right arguments to call it. Since the function makes just one
function call and is only called from one place I inlined it by hand.

Finally this fixes a possible bug waiting for someone to hit it. There were
two unused local variables in acpiphp_register_hotplug_slot(). gcc did not
find them because they were used in memory allocations with sizeof(*var).
They had the same types as the target of the allocation, but nevertheless
this was just weird.

Signed-off-by: Rolf Eike Beer <eike-hotplug@sf-tec.de>
Acked-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoi2c-i801: SMBus patch for Intel ICH9
Jason Gaston [Wed, 22 Nov 2006 23:19:12 +0000 (15:19 -0800)]
i2c-i801: SMBus patch for Intel ICH9

This updated patch adds the Intel ICH9 LPC and SMBus Controller DID's.  Thi=
s patch relies on the irq ICH9 patch to pci_ids.h.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: irq: irq and pci_ids patch for Intel ICH9
Jason Gaston [Wed, 22 Nov 2006 23:15:08 +0000 (15:15 -0800)]
PCI: irq: irq and pci_ids patch for Intel ICH9

This updated patch adds the Intel ICH9 LPC and SMBus Controller DID's.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: pci_{enable,disable}_device() nestable ports
Inaky Perez-Gonzalez [Wed, 22 Nov 2006 20:40:32 +0000 (12:40 -0800)]
PCI: pci_{enable,disable}_device() nestable ports

Change drivers/message/i20 pci driver to simply do a nestable
enable()/disable() instead of checking for it.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: switch pci_{enable,disable}_device() to be nestable
Inaky Perez-Gonzalez [Wed, 22 Nov 2006 20:40:31 +0000 (12:40 -0800)]
PCI: switch pci_{enable,disable}_device() to be nestable

Changes the pci_{enable,disable}_device() functions to work in a
nested basis, so that eg, three calls to enable_device() require three
calls to disable_device().

The reason for this is to simplify PCI drivers for
multi-interface/capability devices. These are devices that cram more
than one interface in a single function. A relevant example of that is
the Wireless [USB] Host Controller Interface (similar to EHCI) [see
http://www.intel.com/technology/comms/wusb/whci.htm].

In these kind of devices, multiple interfaces are accessed through a
single bar and IRQ line. For that, the drivers map only the smallest
area of the bar to access their register banks and use shared IRQ
handlers.

However, because the order at which those drivers load cannot be known
ahead of time, the sequence in which the calls to pci_enable_device()
and pci_disable_device() cannot be predicted. Thus:

1. driverA     starts     pci_enable_device()
2. driverB     starts     pci_enable_device()
3. driverA     shutdown   pci_disable_device()
4. driverB     shutdown   pci_disable_device()

between steps 3 and 4, driver B would loose access to it's device,
even if it didn't intend to.

By using this modification, the device won't be disabled until all the
callers to enable() have called disable().

This is implemented by replacing 'struct pci_dev->is_enabled' from a
bitfield to an atomic use count. Each caller to enable increments it,
each caller to disable decrements it. When the count increments from 0
to 1, __pci_enable_device() is called to actually enable the
device. When it drops to zero, pci_disable_device() actually does the
disabling.

We keep the backend __pci_enable_device() for pci_default_resume() to
use and also change the sysfs method implementation, so that userspace
enabling/disabling the device doesn't disable it one time too much.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: arch/i386/kernel/pci-dma.c: ioremap balanced with iounmap
Amol Lad [Tue, 17 Oct 2006 04:32:50 +0000 (10:02 +0530)]
PCI: arch/i386/kernel/pci-dma.c: ioremap balanced with iounmap

ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.

Tested (compilation only):
- using allmodconfig
- making sure the files are compiling without any warning/error due to
new changes

Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agopci/i386: style cleanups
Randy Dunlap [Tue, 17 Oct 2006 17:17:58 +0000 (10:17 -0700)]
pci/i386: style cleanups

Mostly CodingStyle cleanups for arch/i386/pci/i386.c:
- fit in 80 columns;
- use a #defined value instead of an inline constant;
Also change one resource_size_t (DBG) printk from %08lx to %lx since
it can be more than 32 bits (more than 8 hexits).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Block on access to temporarily unavailable pci device
Matthew Wilcox [Thu, 19 Oct 2006 15:41:28 +0000 (09:41 -0600)]
PCI: Block on access to temporarily unavailable pci device

The existing implementation of pci_block_user_cfg_access() was recently
criticised for providing out of date information and for returning errors
on write, which applications won't be expecting.

This reimplementation uses a global wait queue and a bit per device.
I've open-coded prepare_to_wait() / finish_wait() as I could optimise
it significantly by knowing that the pci_lock protected us at all points.

It looked a bit funny to be doing a spin_unlock_irqsave(); schedule(),
so I used spin_lock_irq() for the _user versions of pci_read_config and
pci_write_config.  Not carrying a flags pointer around made the code
much less nasty.

Attempts to block an already blocked device hit a BUG() and attempts to
unblock an already unblocked device hit a WARN().  If we need to block
access to a device from userspace, it's because it's unsafe for even
another bit of the kernel to access the device.  An attempt to block
a device for a second time means we're about to access the device to
perform some other operation, which could provoke undefined behaviour
from the device.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Acked-by: Adam Belay <abelay@novell.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agopci: fix __pci_register_driver error handling
Akinobu Mita [Thu, 9 Nov 2006 03:53:59 +0000 (19:53 -0800)]
pci: fix __pci_register_driver error handling

__pci_register_driver() error path forgot to unwind.
driver_unregister() needs to be called when pci_create_newid_file() failed.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agopci: clear osc support flags if no _OSC method
Kristen Carlson Accardi [Mon, 30 Oct 2006 21:08:12 +0000 (13:08 -0800)]
pci: clear osc support flags if no _OSC method

So it looks like pci aer code will call pci_osc_support_set to tell the
firmware about  OSC_EXT_PCI_CONFIG_SUPPORT flag.  that causes
ctrlset_buf[OSC_SUPPORT_TYPE] to evaluate to true when pciehp calls
pci_osc_control_set() is called (to attempt to use OSC to gain native
pcie control from firmware), regardless of whether or not _OSC was
actually successfully executed.  That causes this section of code:
 if (ctrlset_buf[OSC_SUPPORT_TYPE] &&
                ((global_ctrlsets & ctrlset) != ctrlset)) {
                return AE_SUPPORT;
        }
to be hit.

This patch will reset the OSC_SUPPORT_TYPE field if _OSC fails, and then
would allow pciehp to go ahead and try to run _OSC again.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoacpiphp: fix missing acpiphp_glue_exit()
Akinobu Mita [Mon, 30 Oct 2006 21:08:04 +0000 (13:08 -0800)]
acpiphp: fix missing acpiphp_glue_exit()

acpiphp_glue_exit() needs to be called to unwind when no slots found.
(It fixes data corruption when reloading acpiphp driver with no such devices)

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoacpiphp: fix use of list_for_each macro
Akinobu Mita [Mon, 30 Oct 2006 21:07:58 +0000 (13:07 -0800)]
acpiphp: fix use of list_for_each macro

This patch fixes invalid usage of list_for_each()

list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node;
...
}

This code works while the member of list node is located at the
head of struct acpiphp_bridge.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoAltix: Initial ACPI support - ROM shadowing.
John Keller [Wed, 4 Oct 2006 21:49:52 +0000 (16:49 -0500)]
Altix: Initial ACPI support - ROM shadowing.

Support a shadowed ROM when running with an ACPI capable PROM.

Define a new dev.resource flag IORESOURCE_ROM_BIOS_COPY to
describe the case of a BIOS shadowed ROM, which can then
be used to avoid pci_map_rom() making an unneeded call to
pci_enable_rom().

Signed-off-by: John Keller <jpk@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoAltix: SN ACPI hotplug support.
John Keller [Wed, 4 Oct 2006 21:49:35 +0000 (16:49 -0500)]
Altix: SN ACPI hotplug support.

A few minor changes to the way slot/device fixup is done.

No need to be calling sn_pci_controller_fixup(), as
a root bus cannot be hotplugged.

Signed-off-by: John Keller <jpk@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoAltix: Add initial ACPI IO support
John Keller [Wed, 4 Oct 2006 21:49:25 +0000 (16:49 -0500)]
Altix: Add initial ACPI IO support

First phase in introducing ACPI support to SN.
In this phase, when running with an ACPI capable PROM,
the DSDT will define the root busses and all SN nodes
(SGIHUB, SGITIO). An ACPI bus driver will be registered
for the node devices, with the acpi_pci_root_driver being
used for the root busses. An ACPI vendor descriptor is
now used to pass platform specific information for both
nodes and busses, eliminating the need for the current
SAL calls. Also, with ACPI support, SN fixup code is no longer
needed to initiate the PCI bus scans, as the acpi_pci_root_driver
does that.

However, to maintain backward compatibility with non-ACPI capable
PROMs, none of the current 'fixup' code can been deleted, though
much restructuring has been done. For example, the bulk of the code
in io_common.c is relocated code that is now common regardless
of what PROM is running, while io_acpi_init.c and io_init.c contain
routines specific to an ACPI or non ACPI capable PROM respectively.

A new pci bus fixup platform vector has been created to provide
a hook for invoking platform specific bus fixup from pcibios_fixup_bus().

The size of io_space[] has been increased to support systems with
large IO configurations.

Signed-off-by: John Keller <jpk@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Delete unused extern in powermac/pci.c
Matthew Wilcox [Tue, 10 Oct 2006 14:01:22 +0000 (08:01 -0600)]
PCI: Delete unused extern in powermac/pci.c

This file no longer uses pci_cache_line_size, so delete the declaration

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Replace HAVE_ARCH_PCI_MWI with PCI_DISABLE_MWI
Matthew Wilcox [Tue, 10 Oct 2006 14:01:21 +0000 (08:01 -0600)]
PCI: Replace HAVE_ARCH_PCI_MWI with PCI_DISABLE_MWI

pSeries is the only architecture left using HAVE_ARCH_PCI_MWI and it's
really inappropriate for its needs.  It really wants to disable MWI
altogether.  So here are a pair of stub implementations for pci_set_mwi
and pci_clear_mwi.

Also rename pci_generic_prep_mwi to pci_set_cacheline_size since that
better reflects what it does.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Use pci_generic_prep_mwi on sparc64
Matthew Wilcox [Tue, 10 Oct 2006 14:01:20 +0000 (08:01 -0600)]
PCI: Use pci_generic_prep_mwi on sparc64

The setting of the CACHE_LINE_SIZE register in sparc64's pci
initialisation code isn't quite adequate as the device may have
incompatible requirements.  The generic code tests for this, so switch
sparc64 over to using it.

Since sparc64 has different L1 cache line size and PCI cache line size,
it would need to override the generic code like i386 and ia64 do.  We
know what the cache line size is at compile time though, so introduce a
new optional constant PCI_CACHE_LINE_BYTES.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: David Miller <davem@davemloft.net>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Use pci_generic_prep_mwi on ia64
Matthew Wilcox [Tue, 10 Oct 2006 14:01:19 +0000 (08:01 -0600)]
PCI: Use pci_generic_prep_mwi on ia64

The pci_generic_prep_mwi() code does everything that pcibios_prep_mwi()
does on ia64.  All we need to do is be sure that pci_cache_line_size
is set appropriately, and we can delete pcibios_prep_mwi().

Using SMP_CACHE_BYTES as the default was wrong on uniprocessor machines
as it is only 8 bytes.  The default in the generic code of L1_CACHE_BYTES
is at least as good.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: quirks: fix the festering mess that claims to handle IDE quirks
Alan Cox [Tue, 3 Oct 2006 23:41:26 +0000 (00:41 +0100)]
PCI: quirks: fix the festering mess that claims to handle IDE quirks

The number of permutations of crap we do is amazing and almost all of it
has the wrong effect in 2.6.

At the heart of this is the PCI SFF magic which says that compatibility
mode PCI IDE controllers use ISA IRQ routing and hard coded addresses
not the BAR values. The old quirks variously clears them, sets them,
adjusts them and then IDE ignores the result.

In order to drive all this garbage out and to do it portably we need to
handle the SFF rules directly and properly. Because we know the device
BAR 0-3 are not used in compatibility mode we load them with the values
that are implied (and indeed which many controllers actually
thoughtfully put there in this mode anyway).

This removes special cases in the IDE layer and libata which now knows
that bar 0/1/2/3 always contain the correct address. It means our
resource allocation map is accurate from boot, not "mostly accurate"
after ide is loaded, and it shoots lots of code. There is also lots more
code and magic constant knowledge to shoot once this is in and settled.

Been in my test tree for a while both with drivers/ide and with libata.
Wants some -mm shakedown in case I've missed something dumb or there are
corner cases lurking.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: save/restore PCI-X state
Stephen Hemminger [Thu, 9 Nov 2006 00:17:15 +0000 (16:17 -0800)]
PCI: save/restore PCI-X state

Shouldn't PCI-X state be saved/restored?  No device really needs this
right now. qla24xx (fc HBA) and mthca (infiniband) don't do suspend,
and sky2 resets its tweaks when links are brought up.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Make some MSI-X #defines generic
Michael Ellerman [Tue, 7 Nov 2006 07:21:21 +0000 (18:21 +1100)]
PCI: Make some MSI-X #defines generic

Move some MSI-X #defines into pci_regs.h so they can be used
outside of drivers/pci.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoPCI: Let PCI_MULTITHREAD_PROBE not be broken
Greg Kroah-Hartman [Fri, 27 Oct 2006 23:12:30 +0000 (16:12 -0700)]
PCI: Let PCI_MULTITHREAD_PROBE not be broken

It's not really broken, but people keep running into other problems
caused by it.  Re-enable it so that the drivers get stress tested.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousbcore: remove unused argument in autosuspend
Alan Stern [Mon, 20 Nov 2006 16:38:46 +0000 (11:38 -0500)]
usbcore: remove unused argument in autosuspend

Thanks to several earlier patches, usb_autosuspend_device() and
usb_autoresume_device() are never called with a second argument other
than 1.  This patch (as819) removes the now-redundant argument.

It also consolidates some common code between those two routines,
putting it into a new subroutine called usb_autopm_do_device().  And
it includes a sizable kerneldoc update for the affected functions.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: keep count of unsuspended children
Alan Stern [Wed, 22 Nov 2006 21:55:54 +0000 (16:55 -0500)]
USB: keep count of unsuspended children

This patch (as818b) simplifies autosuspend processing by keeping track
of the number of unsuspended children of each USB hub.  This will
permit us to avoid a good deal of unnecessary work all the time; we
will no longer have to create a bunch of workqueue entries to carry
out autosuspend requests, only to have them fail because one of the
hub's children isn't suspended.

The basic idea is simple.  There already is a usage counter in the
usb_device structure for preventing autosuspends.  The patch just
increments that counter for every unsuspended child.  There's only one
tricky part: When a device disconnects we need to remember whether it
was suspended at the time (leave the counter alone) or not (decrement
the counter).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB hub: simplify remote-wakeup handling
Alan Stern [Mon, 20 Nov 2006 16:14:30 +0000 (11:14 -0500)]
USB hub: simplify remote-wakeup handling

This patch (as817) simplifies the remote-wakeup processing in the hub
driver.  Now instead of using a specialized code path, it relies on
the standard USB resume routines.  The hub_port_resume() function does
an initial get_port_status() to see whether the port has already
resumed itself (as it does when a remote-wakeup request is sent).
This will slow down handling of other resume events slightly, but not
enough to matter.

The patch also changes the hub_port_status() routine, making it return
an error if a short reply is received.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: struct usb_device: change flag to bitflag
Alan Stern [Mon, 20 Nov 2006 16:12:22 +0000 (11:12 -0500)]
USB: struct usb_device: change flag to bitflag

This patch (as816) changes an existing flag in the usb_device
structure to a bitflag, preparing the way for more bitflags to come
in the future.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoOHCI: make autostop conditional on CONFIG_PM
Alan Stern [Mon, 20 Nov 2006 16:06:59 +0000 (11:06 -0500)]
OHCI: make autostop conditional on CONFIG_PM

Unlike UHCI, OHCI does not exert any DMA load on the system when no
devices are connected.  Consequently there is no advantage to doing
an autostop other than the power savings, so we shouldn't compile the
necessary code unless CONFIG_PM is enabled.

This patch (as820) makes the root-hub suspend and resume routines
conditional on CONFIG_PM.  It also prevents autostop from activating
if the device_may_wakeup flag isn't set; some people use this flag to
alert the driver about Resume-Detect bugs in the hardware.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: Add autosuspend support to the hub driver
Alan Stern [Thu, 9 Nov 2006 19:44:33 +0000 (14:44 -0500)]
USB: Add autosuspend support to the hub driver

This patch (as742b) adds autosuspend/autoresume support to the USB hub
driver.  The largest aspect of the change is that we no longer need a
special flag for root hubs that want to be resumed.  Now every hub is
autoresumed whenever khubd needs to access it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoEHCI: Fix root-hub and port suspend/resume problems
Alan Stern [Thu, 9 Nov 2006 19:42:16 +0000 (14:42 -0500)]
EHCI: Fix root-hub and port suspend/resume problems

This patch (as738b) fixes numerous problems in the controller/root-hub
suspend/resume/remote-wakeup support in ehci-hcd:

The bus_resume() routine should wake up only the ports that
were suspended by bus_suspend().  Ports that were already
suspended should remain that way.

The interrupt mask is used to detect loss of power in the
bus_resume() routine (if the mask is 0 then power was lost).
However bus_suspend() always sets the mask to 0.  Instead the
mask should retain its normal value, with port-change-detect
interrupts disabled if remote wakeup is turned off.

The interrupt mask should be reset to its correct value at the
end of bus_resume() regardless of whether power was lost.

bus_resume() reinitializes the operational registers if power
was lost.  However those registers are not in the aux power
well, hence they can lose their values whenever the controller
is put into D3.  They should always be reinitialized.

When a port-change interrupt occurs and the root hub is
suspended, the interrupt handler should request a root-hub
resume instead of starting up the controller all by itself.

There's no need for the interrupt handler to request a
root-hub resume every time a suspended port sends a
remote-wakeup request.

The pci_resume() method doesn't need to check for connected
ports when deciding whether or not to reset the controller.
It can make that decision based on whether Vaux power was
maintained.

Even when the controller does not need to be reset,
pci_resume() must undo the effect of pci_suspend() by
re-enabling the interrupt mask.

If power was lost, pci_resume() must not call ehci_run().
At this point the root hub is still supposed to be suspended,
not running.  It's enough to rewrite the command register and
set the configured_flag.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: create a new thread for every USB device found during the probe sequence
Greg Kroah-Hartman [Fri, 11 Aug 2006 08:55:12 +0000 (01:55 -0700)]
USB: create a new thread for every USB device found during the probe sequence

Might speed up some systems.  If nothing else, a bad driver should not
take the whole USB subsystem down with it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add driver for the USB debug devices
Greg Kroah-Hartman [Tue, 9 Apr 2002 19:14:34 +0000 (12:14 -0700)]
USB: add driver for the USB debug devices

It's a simple usb-serial driver that just creates a tty device to read
and write from.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: added dynamic major number for USB endpoints
Sarah Bailey [Sun, 19 Nov 2006 06:30:16 +0000 (22:30 -0800)]
USB: added dynamic major number for USB endpoints

This patch is an update for Greg K-H's proposed usbfs2:
http://sourceforge.net/mailarchive/message.php?msg_id=19295229

It creates a dynamic major for USB endpoints and fixes
the endpoint minor calculation.

Signed-off-by: Sarah Bailey <saharabeara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: pegasus error path not resetting task's state
Oliver Neukum [Thu, 23 Nov 2006 14:40:17 +0000 (15:40 +0100)]
USB: pegasus error path not resetting task's state

there is an error path in the pegasus driver which can leave
the task in TASK_UNINTERRUPTIBLE. Depending on when it
schedules next, this can be bad.

Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: endianness fix for asix.c
Oliver Neukum [Thu, 23 Nov 2006 11:45:31 +0000 (12:45 +0100)]
USB: endianness fix for asix.c

the latest update for asix.c reverted some endianness fixes. This
reinstates them.

Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: build the appledisplay driver
Adrian Bunk [Fri, 24 Nov 2006 02:24:03 +0000 (03:24 +0100)]
USB: build the appledisplay driver

We do already have both the code and a config option, so why not build
this driver?  ;-)

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB serial: replace kmalloc+memset with kzalloc
Burman Yan [Wed, 22 Nov 2006 18:54:38 +0000 (20:54 +0200)]
USB serial: replace kmalloc+memset with kzalloc

Replace kmalloc+memset with kzalloc

Signed-off-by: Yan Burman <yan_952@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: hid-core: canonical defines for Apple USB device IDs
Julien BLACHE [Wed, 15 Nov 2006 05:00:17 +0000 (00:00 -0500)]
USB: hid-core: canonical defines for Apple USB device IDs

Use canonical defines for the Apple USB device IDs.
Also add the Geyser IV devices missing in my previous patch.

Signed-off-by: Julien BLACHE <jb@jblache.org>
Acked-by: Dmitry Torokhov <dtor@insightbb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: idmouse cleanup
Mariusz Kozlowski [Mon, 6 Nov 2006 16:37:20 +0000 (17:37 +0100)]
USB: idmouse cleanup

Just digging through code and found these needless variable initializations. So here is the patch.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: make drivers/usb/core/driver.c:usb_device_match() static
Adrian Bunk [Tue, 21 Nov 2006 21:02:54 +0000 (22:02 +0100)]
USB: make drivers/usb/core/driver.c:usb_device_match() static

usb_device_match() can now become static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: lh7a40x_udc remove double declaration
David Brownell [Mon, 20 Nov 2006 19:41:39 +0000 (11:41 -0800)]
USB: lh7a40x_udc remove double declaration

Remove minor double-declaration goof.

Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: pxa2xx_udc recognizes ixp425 rev b0 chip
David Brownell [Mon, 20 Nov 2006 19:38:57 +0000 (11:38 -0800)]
USB: pxa2xx_udc recognizes ixp425 rev b0 chip

Make the pxa2xx_udc driver recognize a newer revision of the IXP425 chip.

Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousbtouchscreen: add support for DMC TSC-10/25 devices
Holger Schurig [Fri, 17 Nov 2006 21:50:15 +0000 (22:50 +0100)]
usbtouchscreen: add support for DMC TSC-10/25 devices

Adds support for the DMC TSC-10 and TSC-25 usb touchscreen controllers.

Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: ftdi-elan.c: fixes and cleanups
Adrian Bunk [Mon, 20 Nov 2006 02:24:44 +0000 (03:24 +0100)]
USB: ftdi-elan.c: fixes and cleanups

This patch contains the following possible cleanups:
- make the needlessly global ftdi_release_platform_dev() static
- remove the unused usb_ftdi_elan_read_reg()
- proper prototypes for the following functions:
  - usb_ftdi_elan_read_pcimem()
  - usb_ftdi_elan_write_pcimem()

Note that the misplaced prototypes for the latter ones in
drivers/usb/host/u132-hcd.c were buggy. Depending on the calling
convention of the architecture calling one of them could have turned
your stack into garbage.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: make drivers/usb/host/u132-hcd.c:u132_hcd_wait static
Adrian Bunk [Mon, 20 Nov 2006 02:23:54 +0000 (03:23 +0100)]
USB: make drivers/usb/host/u132-hcd.c:u132_hcd_wait static

This patch makes the needlessly global "u132_hcd_wait" static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: cypress_m8 init error path fix
Mariusz Kozlowski [Fri, 17 Nov 2006 16:49:22 +0000 (17:49 +0100)]
usb: cypress_m8 init error path fix

If at some point cypress_init() fails deregister
only the resources that were registered until that point.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add ehci_hcd.ignore_oc parameter
David Brownell [Fri, 17 Nov 2006 07:34:58 +0000 (23:34 -0800)]
USB: add ehci_hcd.ignore_oc parameter

Certain boards seem to like to issue false overcurrent notifications, for
example on ports that don't have anything connected to them.  This looks
like a hardware error, at the level of noise to those ports' overcurrent
input signals (or non-debounced VBUS comparators).  This surfaces to users
as truly massive amounts of syslog spam from khubd (which is appropriate
for real hardware problems, except for the volume from multiple ports).

Using this new "ignore_oc" flag helps such systems work more sanely, by
preventing such indications from getting to khubd (and spam syslog).  The
downside is of course that true overcurrent errors will be masked; they'll
appear as spontaneous disconnects, without the diagnostics that will let
users troubleshoot issues like short circuited cables.

Note that the bulk of these reports seem to be with VIA southbridges, but
I think some were with Intel ones.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: EHCI hooks for high speed electrical tests
David Brownell [Fri, 17 Nov 2006 07:56:15 +0000 (23:56 -0800)]
USB: EHCI hooks for high speed electrical tests

EHCI hooks for high speed electrical tests of the root hub ports.

The expectation is that a usermode program actually triggers the test,
making the same control request it would make for an external hub.
Tests for peripheral upstream ports would issue a different request.
In all cases, the hardware needs re-initialization before it could
be used "normally" again (e.g. unplug/replug, rmmod/modprobe).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: net2280: don't send unwanted zero-length packets
Alan Stern [Thu, 16 Nov 2006 15:16:00 +0000 (10:16 -0500)]
USB: net2280: don't send unwanted zero-length packets

The net2280 driver is too eager to send zero-length packets when
IN tokens are received on ep0.  No such packet should be sent (the
driver should NAK) before the gadget driver has queued the proper
response.  Otherwise deferred responses are impossible.

This patch (as823) makes net2280 avoid sending ZLPs for IN transfers
on ep0 until a response has been submitted, and avoids stalling when an
OUT packet is received before a request has been submitted for an OUT
transfer on ep0.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: microtek possible memleak fix
Mariusz Kozlowski [Fri, 17 Nov 2006 10:53:23 +0000 (11:53 +0100)]
usb: microtek possible memleak fix

Possible memleak fix on error path. The changes:

- out_kfree2 and out_free_urb replaced
- missing scsi_host_put() added

Here it goes:

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add Digitech USB-Storage to unusual_devs.h
Jaco Kroon [Wed, 15 Nov 2006 09:02:08 +0000 (01:02 -0800)]
USB: add Digitech USB-Storage to unusual_devs.h

The mass storage device from Digitech designed for Flash Cards, as found
on (for example) the GNX4 device has issues with residue, similar to the
bug report at http://kerneltrap.org/node/6297.  This patch adds the
faulty storage device to unusual_devs.h, this not only reduces the noise
in dmesg but also increases the transfer speeds by a factor of 7x for me
(89kB/s -> 637kB/s).

T:  Bus=02 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1210 ProdID=0003 Rev= 1.00
S:  Manufacturer=DigiTech HMG
S:  Product=DigiTech Mass Storage
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50
Driver=usb-storage
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Signed-off-by: Jaco Kroon <jaco@kroon.co.za>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB core: fix compiler warning about usb_autosuspend_work
Alan Stern [Mon, 13 Nov 2006 20:02:04 +0000 (15:02 -0500)]
USB core: fix compiler warning about usb_autosuspend_work

This patch (as821) fixes a compiler warning when CONFIG_PM isn't on
("usb_autosuspend_work" defined but not used).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix aircable.c: inconsequent NULL checking
Naranjo Manuel Francisco [Wed, 15 Nov 2006 18:14:27 +0000 (15:14 -0300)]
USB: fix aircable.c: inconsequent NULL checking

> 2006/11/11, Adrian Bunk <bunk@stusta.de>:
> > The Coverity checker spotted the following in
> > drivers/usb/serial/aircable.c:
> >
> > <--  snip  -->
> >
> > ...
> > static void aircable_read(void *params)
> > {
> > ...

Hi everyone,
Sorry for the long time response but here is the patch, I think this way should
work, if anyone has any suggestion let me know. What I do now is, in case I
don't have the tty available I reschedule the work, I have tried it and it
works with no problem, I even tried removing the device, and didn't find
anything strange.

Signed-off-by: Naranjo Manuel <naranjo.manuel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoOHCI: change priority level of resume log message
Alan Stern [Mon, 6 Nov 2006 17:05:00 +0000 (12:05 -0500)]
OHCI: change priority level of resume log message

All the other root-hub suspend or resume log messages, in ohci-hcd or
any of the other host controller drivers, use the debug priority
level.  This patch (as815) makes the one single exception behave like
all the rest.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>