Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274382

Re: [PATCH v2] Input: atmel_mxt_ts - Add maxtouch to I2C table for module autoload

From Javier Martinez Canillas <javier@osg.samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] Input: atmel_mxt_ts - Add maxtouch to I2C table for module autoload
Date 2015-11-20 20:50 +0100
Message-ID <qwZQZ-39H-3@gated-at.bofh.it> (permalink)
References <qwZei-2Vw-17@gated-at.bofh.it> <qwZnY-2Zc-15@gated-at.bofh.it> <qwZHj-363-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/20/2015 04:32 PM, Javier Martinez Canillas wrote:

[snip]

> 
> But is not complete because the .driver_data in i2c_device_id is an
> kernel_ulong_t while the .data in of_device_id is a const void * so
> some casting will be needed to add an OF table in some drivers that

Some casting in the tables *and* some logic to get the .data from the
OF table entries, so something like the following will be needed:

static int foo_i2c_probe(struct i2c_client *i2c,
                         const struct i2c_device_id *id)
{
        struct of_device_id *match;
        kernel_ulong_t data;

        if (i2c->dev.of_node) {
               match = of_match_node(of_match, i2c->dev.of_node);
	       if (!match)
                        return -EINVAL;

               data = (kernel_ulong_t)match->data;
        } else {
               data = id->driver_data;
	}
	...
}

while currently I2C drivers just rely on the model part of the compatible
string to match with the entry in the I2C device ID table and the core
always passing the correct .driver_data to the probe function.

So as you can see, converting all the drivers to not rely on the I2C table
requires some refactoring before proper OF modalias reporting can be used.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] Input: atmel_mxt_ts - Add maxtouch to I2C table for module autoload Javier Martinez Canillas <javier@osg.samsung.com> - 2015-11-20 20:10 +0100
  Re: [PATCH v2] Input: atmel_mxt_ts - Add maxtouch to I2C table for  module autoload Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-11-20 20:20 +0100
    Re: [PATCH v2] Input: atmel_mxt_ts - Add maxtouch to I2C table for  module autoload Javier Martinez Canillas <javier@osg.samsung.com> - 2015-11-20 20:40 +0100
      Re: [PATCH v2] Input: atmel_mxt_ts - Add maxtouch to I2C table for  module autoload Javier Martinez Canillas <javier@osg.samsung.com> - 2015-11-20 20:50 +0100

csiph-web