28 Jan, 2008

40 commits

  • This patch adds a variant of the interface, blk_end_request_callback(),
    which has driver callback feature.

    Drivers may need to do special works between end_that_request_first()
    and end_that_request_last().
    For such drivers, blk_end_request_callback() allows it to pass
    a callback function which is called between end_that_request_first()
    and end_that_request_last().

    This interface is only for fallback of other blk_end_request interfaces.
    Drivers should avoid their tricky behaviors and use other interfaces
    as much as possible.

    Currently, only one driver, ide-cd, needs this interface.
    So this interface should/will be removed, after the driver removes
    such tricky behaviors.

    o ide-cd (cdrom_newpc_intr())
    In PIO mode, cdrom_newpc_intr() needs to defer end_that_request_last()
    until the device clears DRQ_STAT and raises an interrupt after
    end_that_request_first().
    So end_that_request_first() and end_that_request_last() are called
    separately in cdrom_newpc_intr().

    This means blk_end_request_callback() has to return without
    completing request even if no leftover in the request.
    To satisfy the requirement, callback function has return value
    so that drivers can tell blk_end_request_callback() to return
    without completing request.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts "normal" parts of ide to use blk_end_request
    interfaces. Related 'uptodate' arguments are converted to 'error'.

    The conversion of 'uptodate' to 'error' is done only for the internal
    function, __ide_end_request().
    ide_end_request() was not changed since it's exported and used
    by many ide drivers.

    With this patch, blkdev_dequeue_request() in __ide_end_request() is
    moved to blk_end_request, since blk_end_request takes care of
    dequeueing request like below:

    if (!list_empty(&rq->queuelist))
    blkdev_dequeue_request(rq);

    In the case of ide,
    o 'dequeue' variable of __ide_end_request() is 1 only when the request
    is still linked to the queue (i.e. rq->queuelist is not empty)
    o 'dequeue' variable of __ide_end_request() is 0 only when the request
    has already been removed from the queue (i.e. rq->queuelist is empty)
    So blk_end_request can handle it correctly although ide always run
    thought the code above.

    Cc: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts cpqarray to use blk_end_request interfaces.
    Related 'ok' arguments are converted to 'error'.

    cpqarray is a little bit different from "normal" drivers.
    cpqarray directly calls bio_endio() and disk_stat_add()
    when completing request. But those can be replaced with
    __end_that_request_first().
    After the replacement, request completion procedures of
    those drivers become like the following:
    o end_that_request_first()
    o add_disk_randomness()
    o end_that_request_last()
    This can be converted to __blk_end_request() by following
    the rule (b) mentioned in the patch subject
    "[PATCH 01/30] blk_end_request: add new request completion interface".

    Cc: Mike Miller
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts cciss to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    cciss is a little bit different from "normal" drivers.
    cciss directly calls bio_endio() and disk_stat_add()
    when completing request. But those can be replaced with
    __end_that_request_first().
    After the replacement, request completion procedures of
    those drivers become like the following:
    o end_that_request_first()
    o add_disk_randomness()
    o end_that_request_last()
    This can be converted to blk_end_request() by following
    the rule (a) mentioned in the patch subject
    "[PATCH 01/30] blk_end_request: add new request completion interface".

    Cc: Mike Miller
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts ide-scsi to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    Cc: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts s390 to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interfaces of internal functions below are changed:
    o dasd_end_request
    o tapeblock_end_request

    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: linux390@de.ibm.com
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts mmc to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    Cc: Pierre Ossman
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts i2o_block to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interface of internal function, i2o_block_end_request(),
    is changed.

    Cc: Markus Lidel
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts viocd to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interface of internal function, viocd_end_request(),
    is changed.

    Cc: Stephen Rothwell
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts xen-blkfront to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    Cc: Jeremy Fitzhardinge
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts viodasd to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interface of internal function, viodasd_end_request(),
    is changed.

    Cc: Stephen Rothwell
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts sx8 to use blk_end_request interfaces.
    Related 'uptodate' and 'is_ok' arguments are converted to 'error'.

    As a result, the interfaces of internal functions below are changed.
    o carm_end_request_queued
    o carm_end_rq
    o carm_handle_array_info
    o carm_handle_scan_chan
    o carm_handle_generic
    o carm_handle_rw

    The 'is_ok' is set at only one place in carm_handle_resp() below:

    int is_ok = (status == RMSG_OK);

    And the value is propagated to all functions above, and no modification
    in other places.
    So the actual conversion of the 'is_ok' is done at only one place above.

    Cc: Jeff Garzik
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts sunvdc to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interface of internal function, vdc_end_request(),
    is changed.

    Cc: David S. Miller
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts ps3disk to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    Cc: Geoff Levand
    Cc: Geert Uytterhoeven
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts nbd to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    Cc: Paul Clements
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts floppy to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interface of internal function, floppy_end_request(),
    is changed.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts DAC960 to use blk_end_request interfaces.
    Related 'UpToDate' arguments are converted to 'Error'.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts um to use blk_end_request interfaces.
    Related 'uptodate' arguments are converted to 'error'.

    As a result, the interface of internal function, ubd_end_request(),
    is changed.

    Cc: Jeff Dike
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts arm's OMAP mailbox driver to use
    blk_end_request interfaces.

    If the original code was converted literally, blk_end_request would
    be called with '-EIO' because end_that_request_last() were called
    with '0' (i.e. failure).
    But I think these '0's are bugs in the original code because it's
    unlikely that all requests are treated as failure.
    (The bugs should have no effect unless these requests have an end_io
    callback.)

    So I changed them to pass '0' (i.e. success) to blk_end_request.

    Cc: Toshihiro Kobayashi
    Cc: Hiroshi DOYU
    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch converts core parts of block layer to use blk_end_request
    interfaces. Related 'uptodate' arguments are converted to 'error'.

    'dequeue' argument was originally introduced for end_dequeued_request(),
    where no attempt should be made to dequeue the request as it's already
    dequeued.
    However, it's not necessary as it can be checked with
    list_empty(&rq->queuelist).
    (Dequeued request has empty list and queued request doesn't.)
    And it has been done in blk_end_request interfaces.

    As a result of this patch, end_queued_request() and
    end_dequeued_request() become identical. A future patch will merge
    and rename them and change users of those functions.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch adds/exports functions to get the size of request in bytes.
    They are useful because blk_end_request interfaces take bytes
    as a completed I/O size instead of sectors.

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • This patch adds 2 new interfaces for request completion:
    o blk_end_request() : called without queue lock
    o __blk_end_request() : called with queue lock held

    blk_end_request takes 'error' as an argument instead of 'uptodate',
    which current end_that_request_* take.
    The meanings of values are below and the value is used when bio is
    completed.
    0 : success
    < 0 : error

    Some device drivers call some generic functions below between
    end_that_request_{first/chunk} and end_that_request_last().
    o add_disk_randomness()
    o blk_queue_end_tag()
    o blkdev_dequeue_request()
    These are called in the blk_end_request interfaces as a part of
    generic request completion.
    So all device drivers become to call above functions.
    To decide whether to call blkdev_dequeue_request(), blk_end_request
    uses list_empty(&rq->queuelist) (blk_queued_rq() macro is added for it).
    So drivers must re-initialize it using list_init() or so before calling
    blk_end_request if drivers use it for its specific purpose.
    (Currently, there is no driver which completes request without
    re-initializing the queuelist after used it. So rq->queuelist
    can be used for the purpose above.)

    "Normal" drivers can be converted to use blk_end_request()
    in a standard way shown below.

    a) end_that_request_{chunk/first}
    spin_lock_irqsave()
    (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
    end_that_request_last()
    spin_unlock_irqrestore()
    => blk_end_request()

    b) spin_lock_irqsave()
    end_that_request_{chunk/first}
    (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
    end_that_request_last()
    spin_unlock_irqrestore()
    => spin_lock_irqsave()
    __blk_end_request()
    spin_unlock_irqsave()

    c) spin_lock_irqsave()
    (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
    end_that_request_last()
    spin_unlock_irqrestore()
    => blk_end_request() or spin_lock_irqsave()
    __blk_end_request()
    spin_unlock_irqrestore()

    Signed-off-by: Kiyoshi Ueda
    Signed-off-by: Jun'ichi Nomura
    Signed-off-by: Jens Axboe

    Kiyoshi Ueda
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6: (54 commits)
    MAINTIANERS: just use Mike gmail e-mail for contact and pawn the serial driver off onto Sonic
    [Blackfin] arch: remove old I2C BF54x porting.
    [Blackfin] arch: Add the semtimedop syscall. Upstream uClibc doesn't compile without it.
    [Blackfin] arch: fix bug kernel boot message: memory information is not reasonable
    [Blackfin] arch: use common flash driver to setup partitions rather than the bf5xx-flash driver
    [Blackfin] arch: Fix bug - kernel build with Debug option enabled fails to boot up
    [Blackfin] arch: Fix bug Only RTC interrupt can wake up deeper sleep core.
    [Blackfin] arch: Add proper SW System Reset delay sequence
    [Blackfin] arch: Update copyright date
    [Blackfin] arch: GPIO API cleanup and anomaly update
    [Blackfin] arch: Fix BUG gpio_direction_output API is not compatitable with GENERIC_GPIO API interface
    [Blackfin] arch: Initial checkin of the memory protection support.
    [Blackfin] arch: set_bfin_dma_config shouldnt set SYNC or RESTART by default - add argument or option
    [Blackfin] arch: Add some comments - fix semicolons
    [Blackfin] arch: move all code related to CPLB handling into a new subdirectory under kernel/
    [Blackfin] arch: print out list of modules if kernel is crashing and tell people if the kernel is tainted
    [Blackfin] arch: enable generic GPIO based I2C driver in STAMP-BF533, EZKIT-BF533 and EZKIT-BF561 boards
    [Blackfin] arch: Don't oops_in_progress if single step is comming from the kernel
    [Blackfin] arch: Fix BUG - kernel sometimes would stuck with KEYBOARD_GPIO on
    [Blackfin] arch: update to latest anomaly sheets
    ...

    Linus Torvalds
     
  • All the users of this driver explicitly specify the I2C bus numbers
    to be used in their platform data. Make the driver respect that.

    Signed-off-by: Kalle Pokki
    Cc: Bryan Wu
    Signed-off-by: Jean Delvare

    Kalle Pokki
     
  • Convert the i2c-au1550 bus driver to platform driver, and
    register a platform device for the Alchemy Db/Pb series of
    boards.

    Signed-off-by: Manuel Lauss
    Signed-off-by: Jean Delvare

    Manuel Lauss
     
  • Zero-bytes transfers would leave the bus transaction unfinished
    (no i2c stop is sent), with the following transfer actually
    sending the slave address to the previously addressed device,
    resulting in weird device failures (e.g. reset minute register
    values in my RTC).
    This patch instructs the controller to send an I2C STOP right after
    the slave address in case of a zero-byte transfer.

    Signed-off-by: Manuel Lauss
    Signed-off-by: Jean Delvare

    Manuel Lauss
     
  • Propagate the error values returned by i2c_wait() instead of overriding
    them with a meaningless -1.

    Signed-off-by: Jon Smirl
    Signed-off-by: Jean Delvare

    Jon Smirl
     
  • This adds a i2c_new_dummy() primitive to help work with devices
    that consume multiple addresses, which include many I2C eeproms
    and at least one RTC.

    Signed-off-by: David Brownell
    Signed-off-by: Jean Delvare

    David Brownell
     
  • It is no longer required to hold adapter->clist_lock to call
    i2c_check_addr.

    Signed-off-by: Jean Delvare
    Cc: David Brownell

    Jean Delvare
     
  • We only need to hold adapter->clist_lock when we touch the client list.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • This goes on top of the patch removing most i2c_adapter.clients usage,
    updating i2c_attach_client:

    - Don't call device_register() while holding clist_lock. This
    removes a self-deadlock when on the i2c_driver.probe() path,
    for drivers that need to attach new devices (e.g. dummies).

    - Remove a redundant address check. The driver model core does
    this as a consequence of guaranteeing unique names.

    - Move the "device registered" diagnostic so that it never lies;
    previously, on error paths it would falsely report success.

    Signed-off-by: David Brownell
    Signed-off-by: Jean Delvare

    David Brownell
     
  • The redundant i2c client list maintained by i2c-core is going away
    soon, so drivers should stop using it now. Instead, they can use the
    standard iterator provided by the device driver model
    (device_for_each_child).

    Signed-off-by: Jean Delvare
    Cc: David Brownell
    Cc: Michael Hunold

    Jean Delvare
     
  • The i2c_adapter.clients list of i2c_client nodes duplicates driver
    model state. This patch starts removing that list, letting us remove
    most existing users of those i2c-core lists.

    * The core I2C code now iterates over the driver model's list instead
    of the i2c-internal one in some places where it's safe:
    - Passing a command/ioctl to each client, a mechanims
    used almost exclusively by DVB adapters;
    - Device address checking, in both i2c-core and i2c-dev.

    * Provide i2c_verify_client() to use with driver model iterators.

    * Flag the relevant i2c_adapter and i2c_client fields as deprecated,
    to help prevent new users from appearing.

    For the moment the list needs to stick around, since some issues show
    up when deleting devices created by legacy I2C drivers. (They don't
    follow standard driver model rules. Removing those devices can cause
    self-deadlocks.)

    Signed-off-by: David Brownell
    Signed-off-by: Jean Delvare

    David Brownell
     
  • Add support for another variant of the VT8237. I couldn't test
    I2C block support but I assume it is present as well.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • Checking the PCI function number doesn't add any value, and it makes
    adding dynamic IDs to the driver more difficult. Drop this check.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • The i2c-amd756 and i2c-viapro drivers make use of the driver_data
    field of the PCI device ID. When adding device IDs dynamically (by
    writing to the new_id sysfs file) you cannot set the value of this
    field by default. It has to be allowed explicitly. Do that, and
    check the value so that the user can't crash the kernel accidentally.

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

    Jean Delvare
     
  • Add polling I2C transfer implementation for PXA I2C. This is needed
    for cases where I2C transactions have to occur at times interrups are
    disabled.

    Signed-off-by: Mike Rapoport
    Acked-by: eric miao
    Signed-off-by: Jean Delvare

    Mike Rapoport
     
  • Allow i2c_transfer to be called in contexts where sleeping is not allowed.
    It is the reponsability of the caller to ensure that the underlying i2c bus
    driver will not sleep either.

    Signed-off-by: Mike Rapoport
    Signed-off-by: Jean Delvare

    Mike Rapoport
     
  • The implementation is unsafe, and anyway one can achieve the same from
    userspace using i2c-dev + i2cdetect.

    Also tag i2c_sibyte_add_bus __init.

    Signed-off-by: Jean Delvare
    Cc: Ralf Baechle

    Jean Delvare
     
  • Discard all I2C driver IDs that aren't used anywhere. That's not just a
    couple of them, but more like 49 or one quarter of all defined IDs! And
    this is just a first pass, next will come all IDs that are set but
    never used, or used but never set.

    Signed-off-by: Jean Delvare

    Jean Delvare