09 May, 2009

3 commits

  • This reverts commit 006f4571a15fae3a0575f2a0f9e9b63b3d1012f8:

    This patch moves platform_data from struct device into
    struct platform_device, based on the two ideas:

    1. Now all platform_driver is registered by platform_driver_register,
    which makes probe()/release()/... of platform_driver passed parameter
    of platform_device *, so platform driver can get platform_data from
    platform_device;

    2. Other kind of devices do not need to use platform_data, we can
    decrease size of device if moving it to platform_device.

    Taking into consideration of thousands of files to be fixed and they
    can't be finished in one night(maybe it will take a long time), so we
    keep platform_data in device to allow two kind of cases coexist until
    all platform devices pass its platfrom data from
    platform_device->platform_data.

    All patches to do this kind of conversion are welcome.

    As we don't really want to do it, it was a bad idea.

    Cc: David Brownell
    Cc: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This reverts commit ce21c7bcd796fc4f45d48781b7e85f493cc55ee5:
    We will remove platform_data field from struct device until
    all platform devices pass its specific data from platfom_device
    and all platform drivers use platform specific data passed by
    platform_device->platform_data. This kind of conversion will
    need a long time, for thousands of files is affected.

    To make the conversion easily, we allow platform specific data
    passed by struct device or struct platform_device and platform
    driver may use it from struct device or struct platform_device.

    As we really don't want to do this at all.

    Cc: David Brownell
    Cc: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • Fix function parameter notation in platform.c;
    fixes kernel-doc warnings.

    Signed-off-by: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     

17 Apr, 2009

1 commit

  • V3 of the early platform driver implementation.

    Platform drivers are great for embedded platforms because we can separate
    driver configuration from the actual driver. So base addresses,
    interrupts and other configuration can be kept with the processor or board
    code, and the platform driver can be reused by many different platforms.

    For early devices we have nothing today. For instance, to configure early
    timers and early serial ports we cannot use platform devices. This
    because the setup order during boot. Timers are needed before the
    platform driver core code is available. The same goes for early printk
    support. Early in this case means before initcalls.

    These early drivers today have their configuration either hard coded or
    they receive it using some special configuration method. This is working
    quite well, but if we want to support both regular kernel modules and
    early devices then we need to have two ways of configuring the same
    driver. A single way would be better.

    The early platform driver patch is basically a set of functions that allow
    drivers to register themselves and architecture code to locate them and
    probe. Registration happens through early_param(). The time for the
    probe is decided by the architecture code.

    See Documentation/driver-model/platform.txt for more details.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Magnus Damm
    Cc: Paul Mundt
    Cc: Kay Sievers
    Cc: David Brownell
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Magnus Damm
     

25 Mar, 2009

4 commits

  • We will remove platform_data field from struct device until
    all platform devices pass its specific data from platfom_device
    and all platform drivers use platform specific data passed by
    platform_device->platform_data. This kind of conversion will
    need a long time, for thousands of files is affected.

    To make the conversion easily, we allow platform specific data
    passed by struct device or struct platform_device and platform
    driver may use it from struct device or struct platform_device.

    Signed-off-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • This patch moves platform_data from struct device into
    struct platform_device, based on the two ideas:

    1. Now all platform_driver is registered by platform_driver_register,
    which makes probe()/release()/... of platform_driver passed parameter
    of platform_device *, so platform driver can get platform_data from
    platform_device;

    2. Other kind of devices do not need to use platform_data, we can
    decrease size of device if moving it to platform_device.

    Taking into consideration of thousands of files to be fixed and they
    can't be finished in one night(maybe it will take a long time), so we
    keep platform_data in device to allow two kind of cases coexist until
    all platform devices pass its platfrom data from
    platform_device->platform_data.

    All patches to do this kind of conversion are welcome.

    Signed-off-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • Now platform_device is being widely used on SoC processors where the
    peripherals are attached to the system bus, which is simple enough.

    However, silicon IPs for these SoCs are usually shared heavily across
    a family of processors, even products from different companies. This
    makes the original simple driver name based matching insufficient, or
    simply not straight-forward.

    Introduce a module id table for platform devices, and makes it clear
    that a platform driver is able to support some shared IP and handle
    slight differences across different platforms (by 'driver_data').
    Module alias is handled automatically when a MODULE_DEVICE_TABLE()
    is defined.

    To not disturb the current platform drivers too much, the matched id
    entry is recorded and can be retrieved by platform_get_device_id().

    Signed-off-by: Eric Miao
    Cc: Kay Sievers
    Cc: Ben Dooks
    Signed-off-by: Greg Kroah-Hartman

    Eric Miao
     
  • This helps the code look more consistent and cleaner.

    Signed-off-by: Eric Miao
    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Eric Miao
     

07 Jan, 2009

2 commits

  • Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • PM: Simplify the new suspend/hibernation framework for devices

    Following the discussion at the Kernel Summit, simplify the new
    device PM framework by merging 'struct pm_ops' and
    'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops'
    from 'struct platform_driver' and 'struct pci_driver'.

    After this change, the suspend/hibernation callbacks will only
    reside in 'struct device_driver' as well as at the bus type/
    device class/device type level. Accordingly, PCI and platform
    device drivers are now expected to put their suspend/hibernation
    callbacks into the 'struct device_driver' embedded in
    'struct pci_driver' or 'struct platform_driver', respectively.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Jesse Barnes
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

17 Oct, 2008

4 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits)
    UIO: Fix mapping of logical and virtual memory
    UIO: add automata sercos3 pci card support
    UIO: Change driver name of uio_pdrv
    UIO: Add alignment warnings for uio-mem
    Driver core: add bus_sort_breadthfirst() function
    NET: convert the phy_device file to use bus_find_device_by_name
    kobject: Cleanup kobject_rename and !CONFIG_SYSFS
    kobject: Fix kobject_rename and !CONFIG_SYSFS
    sysfs: Make dir and name args to sysfs_notify() const
    platform: add new device registration helper
    sysfs: use ilookup5() instead of ilookup5_nowait()
    PNP: create device attributes via default device attributes
    Driver core: make bus_find_device_by_name() more robust
    usb: turn dev_warn+WARN_ON combos into dev_WARN
    debug: use dev_WARN() rather than WARN_ON() in device_pm_add()
    debug: Introduce a dev_WARN() function
    sysfs: fix deadlock
    device model: Do a quickcheck for driver binding before doing an expensive check
    Driver core: Fix cleanup in device_create_vargs().
    Driver core: Clarify device cleanup.
    ...

    Linus Torvalds
     
  • Add resource_type() and IORESOURCE_TYPE_BITS. They make it easier to add
    more resource types without having to rewrite tons of code.

    Signed-off-by: Magnus Damm
    Cc: Ben Dooks
    Cc: Jean Delvare
    Cc: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Magnus Damm
     
  • Add a helper that registers simple platform_device w/o resources but with
    parent and device data.

    This is usefull to cleanup platform code from code that registers such
    simple devices as leds-gpio, generic-bl, etc.

    Signed-off-by: Dmitry Baryshkov
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Baryshkov
     
  • This patch makes the needlessly global struct platform_pm_ops static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Greg Kroah-Hartman

    Adrian Bunk
     

11 Jun, 2008

1 commit


11 Mar, 2008

1 commit

  • There's a bug in the current implementation of dma_get_required_mask()
    where it ands the returned mask with the current device mask. This
    rather defeats the purpose if you're using the call to determine what
    your mask should be (since you will at that time have the default
    DMA_32BIT_MASK). This bug results in any driver that uses this function
    *always* getting a 32 bit mask, which is wrong.

    Fix by removing the and with dev->dma_mask.

    Signed-off-by: James Bottomley
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    James Bottomley
     

25 Jan, 2008

4 commits


13 Oct, 2007

3 commits

  • While platform_device.id is a u32, platform_device_add() handles "-1"
    as a special id value. This has potential for confusion and bugs.
    Making it an int instead should prevent problems from happening in
    the future.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • This changes the uevent buffer functions to use a struct instead of a
    long list of parameters. It does no longer require the caller to do the
    proper buffer termination and size accounting, which is currently wrong
    in some places. It fixes a known bug where parts of the uevent
    environment are overwritten because of wrong index calculations.

    Many thanks to Mathieu Desnoyers for finding bugs and improving the
    error handling.

    Signed-off-by: Kay Sievers
    Cc: Mathieu Desnoyers
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • Prefix platform modalias strings with "platform:", which
    modprobe config to blacklist alias resolving if userspace
    configures it.

    Send uevents for all platform devices.

    Add MODULE_ALIAS's to: pxa2xx_pcmcia, ds1742 and pcspkr to trigger
    module autoloading by userspace.

    $ modinfo pcspkr
    alias: platform:pcspkr
    license: GPL
    description: PC Speaker beeper driver
    ...

    $ modprobe -n -v platform:pcspkr
    insmod /lib/modules/2.6.23-rc3-g28e8351a-dirty/kernel/drivers/input/misc/pcspkr.ko

    Signed-off-by: Kay Sievers
    Cc: David Brownell
    Cc: Atsushi Nemoto
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

09 May, 2007

2 commits

  • Typo: iwithout -> without.

    Signed-off-by: Márton Németh
    Signed-off-by: Adrian Bunk

    Márton Németh
     
  • We've had various reports of some legacy "probe the hardware" style
    platform drivers having nasty problems with hotplug support.

    The core issue is that those legacy drivers don't fully conform to the
    driver model. They assume a role that should be the responsibility of
    infrastructure code: creating device nodes.

    The "modprobe" step in hotplugging relies on drivers to have split those
    roles into different modules. The lack of this split causes the problems.
    When a driver creates nodes for devices that don't exist (sending a hotplug
    event), then exits (aborting one modprobe) before the "modprobe $MODALIAS"
    step completes (by failing, since it's in the middle of a modprobe), the
    result can be an endless loop of modprobe invocations ... badness.

    This fix uses the newish per-device flag controlling issuance of "add"
    events. (A previous version of this patch used a per-device "driver can
    hotplug" flag, which only scrubbed $MODALIAS from the environment rather
    than suppressing the entire hotplug event.) It also shrinks that flag to
    one bit, saving a word in "struct device".

    So the net of this patch is removing some nasty failures with legacy
    drivers, while retaining hotplug capability for the majority of platform
    drivers.

    Signed-off-by: David Brownell
    Cc: Greg KH
    Cc: Andres Salomon
    Cc: Dominik Brodowski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Brownell
     

03 May, 2007

1 commit

  • In platform_device_del(), we currently delete the device resources
    first, then we delete the device itself. This causes a (minor) bug to
    occur when one unregisters a platform device before unregistering its
    platform driver, and the driver is requesting (in .probe()) and
    releasing (in .remove()) a resource of the device. The device
    resources are already gone by the time the driver gets the chance to
    release the resources it had been requesting, causing an error like:
    Trying to free nonexistent resource

    If the platform driver is unregistered first, the problem doesn't
    occur, as the driver will have the opportunity to release the
    resources it had requested before the device resources themselves are
    released. It's a bit odd that unregistering the driver first or the
    device first doesn't lead to the same result.

    So I believe that we should delete the device first in
    platform_device_del(). I've searched the git history and found that it
    used to be the case before 2.6.8, but was changed here:

    http://www.kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git;a=commitdiff;h=96ef7b3689936ee1e64b711511342026a8ce459c

    > 2004/07/14 16:09:44-07:00 dtor_core
    > [PATCH] Driver core: Fix OOPS in device_platform_unregister
    >
    > Driver core: platform_device_unregister should release resources first
    > and only then call device_unregister, otherwise if there
    > are no more references to the device it will be freed and
    > the fucntion will try to access freed memory.

    However we now have an explicit call to put_device() at the end of
    platform_device_unregister() so I guess the original problem no longer
    exists and it is safe to revert that change.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     

08 Feb, 2007

1 commit


14 Dec, 2006

2 commits


02 Dec, 2006

1 commit

  • 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
    Signed-off-by: Greg Kroah-Hartman

    David Brownell
     

26 Sep, 2006

1 commit

  • Teach platform_bus about the new suspend_late/resume_early PM calls,
    issued with IRQs off. Do we really need sysdev and friends any more,
    or can janitors start switching its users over to platform_device so
    we can do a minor code-ectomy?

    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    David Brownell
     

22 Jun, 2006

2 commits


22 Mar, 2006

1 commit


21 Mar, 2006

1 commit


14 Jan, 2006

1 commit


05 Jan, 2006

3 commits

  • Driver core: rearrange exports in platform.c

    The new way is to specify export right after symbol definition.
    Rearrange exports to follow new style to avoid mixing two styles
    in one file.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • Driver core: add platform_device_del function

    Having platform_device_del90 allows more straightforward error
    handling code in drivers registering platform devices.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     
  • There are cases in which a device's memory mapped registers overlap
    with another device's memory mapped registers. On several PowerPC
    devices this occurs for the MDIO bus, whose registers tended to overlap
    with one of the ethernet controllers.

    By switching from request_resource to insert_resource we can register
    the MDIO bus as a proper platform device and not hack around how we
    handle its memory mapped registers.

    Signed-off-by: Kumar Gala
    Signed-off-by: Greg Kroah-Hartman

    Kumar Gala
     

10 Nov, 2005

1 commit

  • Introduce struct platform_driver. This allows the platform device
    driver methods to be passed a platform_device structure instead of
    instead of a plain device structure, and therefore requiring casting
    in every platform driver.

    We introduce this in such a way that any existing platform drivers
    registered directly via driver_register continue to work as before,
    thereby allowing a gradual conversion to the new platform_driver
    methods.

    Signed-off-by: Russell King
    Acked-by: Greg Kroah-Hartman

    Russell King