06 Sep, 2005

40 commits

  • The sgi_xfer function returns 0 on success instead of the number of
    transfered messages as it is supposed to. This patch fixes that.

    Let's just hope that no client chip driver was relying on this
    misbehavior.

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

    Jean Delvare
     
  • When an i2c transfer is successful, an incorrect value is returned.
    This patch fixes that.

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

    Jean Delvare
     
  • The 'new_time' variable should be static.

    Signed-off-by: Mark A. Greer
    Signed-off-by: Greg Kroah-Hartman

    Mark A. Greer
     
  • The 'new_time' variable should be static.

    Signed-off-by: Mark A. Greer
    Signed-off-by: Greg Kroah-Hartman

    Mark A. Greer
     
  • The i2c-keywest driver has a "probe" module parameter which enables bus
    scanning at load time. This can be done in userspace with the i2cdetect
    tool (part of the lm_sensors package) instead. What's more, i2cdetect
    gives more control on the way the bus is scanned, and is safer
    (i2c-keywest currently scans reserved addresses and doesn't properly
    handle the famous 24RF08 corruption case.)

    Thus, I would propose that this module parameter be simply dropped.

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

    Jean Delvare
     
  • The pcilynx driver includes code to dump the contents of an i2c eeprom
    for debugging purposes. The same can be done from userspace using the
    i2cdump tool (part of the lm_sensors project) instead, in a more
    efficient and flexible way.

    Thus I would suggest that this functionality be simply dropped from the
    pcilynx driver.

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

    Jean Delvare
     
  •  
  • I2C_DEVNAME and i2c_clientname were introduced in 2.5.68 [1] to help
    media/video driver authors who wanted their code to be compatible with
    both Linux 2.4 and 2.6. The cause of the incompatibility has gone since
    [2], so I think we can get rid of them, as they tend to make the code
    harder to read and longer to preprocess/compile for no more benefit.

    I'd hope nobody seriously attempts to keep media/video driver compatible
    across Linux trees anymore, BTW.

    [1] http://marc.theaimsgroup.com/?l=linux-kernel&m=104930186524598&w=2
    [2] http://www.linuxhq.com/kernel/v2.6/0-test3/include/linux/i2c.h

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

    Jean Delvare
     
  • Now that the hardware monitoring drivers are no more part of the i2c
    subsystem, they probably deserve their own entry in MAINTAINERS.

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

    Jean Delvare
     
  • Delete an outdated comment about i2c_algorithm.id being computed
    from algo->id.

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

    Jean Delvare
     
  • The I2C_ALGO_* constants have no more users, delete them. Also update
    the comments in i2c-id.h so that they reflect the current state of the
    file.

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

    Jean Delvare
     
  • In theory, there should be no more users of I2C_ALGO_* at this point.
    However, it happens that several drivers were using I2C_ALGO_* for
    adapter ids, so we need to correct these before we can get rid of all
    the I2C_ALGO_* definitions.

    Note that this also fixes a bug in media/video/tvaudio.c:

    /* don't attach on saa7146 based cards,
    because dedicated drivers are used */
    if ((adap->id & I2C_ALGO_SAA7146))
    return 0;

    This test was plain broken, as it would succeed for many more adapters
    than just the saa7146: any those id would share at least one bit with
    the saa7146 id. We are really lucky that the few other adapters we want
    this driver to work with did not fulfill that condition.

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

    Jean Delvare
     
  • Merge the algorithm id part (16 upper bits) of the i2c adapters ids
    into the definition of the adapters ids directly. After that, we don't
    need to OR both ids together for each i2c_adapter structure.

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

    Jean Delvare
     
  • There are no more users of i2c_algorithm.id, so we can finally drop
    this structure member.

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

    Jean Delvare
     
  • Don't rely on i2c_algorithm.id to alter the i2c adapter's id, use the
    I2C_ALGO_* value directly instead, because i2c_algorithm will soon
    have no id member no more.

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

    Jean Delvare
     
  • Use the adapter id rather than the algorithm id to detect the i2c-isa
    pseudo-adapter. This saves one level of dereferencing, and the
    algorithm ids will soon be gone anyway.

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

    Jean Delvare
     
  • The name member of the i2c_algorithm is never used, although all
    drivers conscientiously fill it. We can drop it completely, this
    structure doesn't need to have a name.

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

    Jean Delvare
     
  • The 24RF08 corruption would better be prevented at i2c-core level than
    at chip driver level, for several reasons:
    * The second quick write should happen as soon as possible after the
    first one, so as to limit the risk that another command is issued on
    the bus inbetween, causing the corruption.
    * As a matter of fact, the protection code at driver level was reworked
    at least three times already, which proves how hard it is to get it
    right there, while it's straightforward at i2c-core level.
    * It's easy to add a new driver that would need the protection, and
    forget to add it. This did happen already.
    * As additional probing addresses can be passed to most i2c chip drivers
    as module parameters, virtually every i2c chip driver would need the
    protection if we want to be really safe.
    * Why duplicate code when we can easily avoid it?

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

    Jean Delvare
     
  • i2c_probe was quite complex and slow, so I rewrote it in a more
    efficient and hopefully clearer way.

    Note that this slightly changes the way the module parameters are
    handled. This shouldn't change anything for the most common cases
    though.

    For one thing, the function now respects the order of the parameters
    for address probing. It used to always do lower addresses first. The
    new approach gives the user more control.

    For another, ignore addresses don't overrule probe addresses anymore.
    This could have been restored the way it was at the cost of a few more
    lines of code, but I don't think it's worth it. Both lists are given
    as module parameters, so a user would be quite silly to specify the
    same addresses in both lists. The normal addresses list is the only
    one that isn't controlled by a module parameter, thus is the only one
    the user may reasonably want to remove an address from.

    Another significant change is the fact that i2c_probe() will no more
    stop when a detection function returns -ENODEV. Just because a driver
    found a chip it doesn't support isn't a valid reason to stop all
    probings for this one driver. This closes the long standing lm_sensors
    ticket #1807.

    http://www2.lm-sensors.nu/~lm78/readticket.cgi?ticket=1807

    I updated the documentation accordingly.

    In terms of algorithmic complexity, the new code is way better. If
    I is the ignore address count, P the probe address count, N the
    normal address count and F the force address count, the old code
    was doing 128 * (F + I + P + N) iterations max, while the new code
    does F + P + ((I+1) * N) iterations max. For the most common case
    where F, I and P are empty, this is down from 128 * N to N.

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

    Jean Delvare
     
  • This patch updates the VID entries, so any future
    Intel CPU will be detected as unknown rather than 9.0

    Signed-off-by: Rudolf Marek
    Signed-off-by: Greg Kroah-Hartman

    R.Marek@sh.cvut.cz
     
  • Use the common vid_from_reg function in lm78 rather than
    reimplementing it.

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

    Jean Delvare
     
  • I see very little reason why vid_from_reg is inlined. It is not
    exactly short, its parameters are seldom known in advance, and it is
    never called in speed critical areas. Uninlining it should cause
    little performance loss if any, and saves a signficant space as well
    as compilation time.

    As suggested by Alexey Dobriyan, I am leaving vid_to_reg inline for now,
    as it is short and has a single user so far.

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

    Jean Delvare
     
  • Delete DEFAULT_VRM from hwmon-vid.h, it has no more users.

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

    Jean Delvare
     
  • Cleanup hwmon-vid a bit, fixing typos, rewording some comments and
    reindenting properly at places.

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

    Jean Delvare
     
  • The only part left in i2c-sensor is the VRM/VRD/VID handling code.
    This is in no way related to i2c, so it doesn't belong there. Move
    the code to hwmon, where it belongs.

    Note that not all hardware monitoring drivers do VRM/VRD/VID
    operations, so less drivers depend on hwmon-vid than there were
    depending on i2c-sensor.

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

    Jean Delvare
     
  • The only thing left in i2c-sensor.h are module parameter definition
    macros. It's only an extension of what i2c.h offers, and this extension
    is not sensors-specific. As a matter of fact, a few non-sensors drivers
    use them. So we better merge them in i2c.h, and get rid of i2c-sensor.h
    altogether.

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

    Jean Delvare
     
  • The i2c_detect function has no more user, delete it.

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

    Jean Delvare
     
  • i2c_probe and i2c_detect now do the exact same thing and operate on
    the same data structure, so we can have everyone call i2c_probe.

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

    Jean Delvare
     
  • We now have two identical structures, i2c_address_data in i2c-sensor.h
    and i2c_client_address_data in i2c.h. We can kill one of them, I choose
    to keep the one in i2c.h as it makes more sense (this structure is not
    specific to sensors.)

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

    Jean Delvare
     
  • The way i2c-sensor handles forced addresses could be optimized. It
    defines a structure (i2c_force_data) to associate a module parameter
    with a given kind value, but in fact this kind value is always the
    index of the structure in each array it is used in. So this additional
    value can be omitted, and still be deduced in the code handling these
    arrays.

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

    Jean Delvare
     
  • Add support for kind-forced addresses to i2c_probe, like i2c_detect
    has for (essentially) hardware monitoring drivers.

    Note that this change will slightly increase the size of the drivers
    using I2C_CLIENT_INSMOD, with no immediate benefit. This is a
    requirement if we want to merge i2c_probe and i2c_detect though, and
    seems a reasonable price to pay in comparison with the previous
    cleanups which saved much more than that (such as the i2c-isa cleanup
    or the i2c address ranges removal.)

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

    Jean Delvare
     
  • Remove an unused macro and an outdated comment from the lm85 driver.

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

    Jean Delvare
     
  • Move SENSORS_LIMIT from i2c-sensor.h to hwmon.h, as it is in no way
    related to i2c.

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

    Jean Delvare
     
  • The debugging messages in i2c-core are more confusing than helpful. Some
    lack their trailing newline, some lack a prefix, some are redundant,
    some lack precious information. Here is my attempt to introduce some
    standardization in there.

    I also changed two messages in i2c-dev to make it clear they come from
    i2c-dev.

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

    Jean Delvare
     
  • Fix a typo in the i2c documentation: the i2c bus scanning tool found in
    lm_sensors is called i2cdetect, not i2c_detect.

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

    Jean Delvare
     
  • I've been running with this patch for a while now, and while I've never
    seen it trigger except with buggy hardware I think it is a cleaner way
    to handle a busy bus. I had -EBUSY until about 10 minutes ago but -EIO
    seems to be what most of the existing algo drivers will return in the
    same circumstances.

    Signed-off-by: Ian Campbell
    Signed-off-by: Greg Kroah-Hartman

    Ian Campbell
     
  • We could inline i2c_adapter_id, as it is really, really short. Doing
    so saves a few bytes both in i2c-core and in the drivers using this
    function.

    before after diff
    drivers/hwmon/adm1026.ko 41344 41305 -39
    drivers/hwmon/asb100.ko 27325 27246 -79
    drivers/hwmon/gl518sm.ko 20824 20785 -39
    drivers/hwmon/it87.ko 26419 26380 -39
    drivers/hwmon/lm78.ko 21424 21385 -39
    drivers/hwmon/lm85.ko 41034 40939 -95
    drivers/hwmon/w83781d.ko 39561 39514 -47
    drivers/hwmon/w83792d.ko 32979 32932 -47
    drivers/i2c/i2c-core.ko 24708 24531 -177

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

    Jean Delvare
     
  • Super-I/O find functions in hardware monitoring drivers can be tagged
    __init as they are only called from functions themselves tagged __init.
    Two of them (smsc47b397 and w83627ehf) already do, but the other four
    of them (it87, pc87360, smsc47m1 and w83627hf) did not.

    This saves a few bytes of memory after the drivers are loaded, 192 in
    the case of the it87 driver.

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

    Jean Delvare
     
  • We could refactor the error message 34 different i2c drivers print if
    i2c_detach_client() fails in this function itself. Saves quite a few
    lines of code. Documentation is updated to reflect that change.

    Note that this patch should be applied after Rudolf Marek's w83792d
    patches.

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

    Jean Delvare
     
  • This patch adds documentation entry for W83792D chip.

    Signed-off-by: Rudolf Marek
    Signed-off-by: Greg Kroah-Hartman

    R.Marek@sh.cvut.cz