All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer
@ 2016-07-28 22:40 Matt Ranostay
  2016-07-29  6:19 ` Daniel Baluta
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Ranostay @ 2016-07-28 22:40 UTC (permalink / raw)
  To: linux-iio; +Cc: giorgio.nicole, Matt Ranostay, Daniel Baluta

Reported-by: Giorgio <giorgio.nicole@arcor.de>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 drivers/iio/adc/ti-ads1015.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 73cbf0b54e54..fe96af6059d5 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = {
 #ifdef CONFIG_OF
 static int ads1015_get_channels_config_of(struct i2c_client *client)
 {
-	struct ads1015_data *data = i2c_get_clientdata(client);
+	struct iio_dev *indio_dev = i2c_get_clientdata(client);
+	struct ads1015_data *data = iio_priv(indio_dev);
 	struct device_node *node;
 
 	if (!client->dev.of_node ||
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer
  2016-07-28 22:40 [PATCH] iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer Matt Ranostay
@ 2016-07-29  6:19 ` Daniel Baluta
  2016-07-29  7:39   ` Matt Ranostay
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Baluta @ 2016-07-29  6:19 UTC (permalink / raw)
  To: Matt Ranostay; +Cc: linux-iio, giorgio.nicole, Daniel Baluta

On Fri, Jul 29, 2016 at 1:40 AM, Matt Ranostay <mranostay@gmail.com> wrote:
> Reported-by: Giorgio <giorgio.nicole@arcor.de>
> Cc: Daniel Baluta <daniel.baluta@intel.com>
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
> ---
>  drivers/iio/adc/ti-ads1015.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 73cbf0b54e54..fe96af6059d5 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = {
>  #ifdef CONFIG_OF
>  static int ads1015_get_channels_config_of(struct i2c_client *client)
>  {
> -       struct ads1015_data *data = i2c_get_clientdata(client);
> +       struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +       struct ads1015_data *data = iio_priv(indio_dev);
>         struct device_node *node;
>
>         if (!client->dev.of_node ||
> --

Hi Matt,

Giorgio already sent a patch for this. I think we should go on his way
since he found the bug.

Daniel.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer
  2016-07-29  6:19 ` Daniel Baluta
@ 2016-07-29  7:39   ` Matt Ranostay
  2016-08-16 18:43     ` [PATCH 1/1] iio:ti-ads1015: fix a wrong pointer definition Giorgio Dal Molin
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Ranostay @ 2016-07-29  7:39 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: linux-iio, Giorgio

On Thu, Jul 28, 2016 at 11:19 PM, Daniel Baluta <daniel.baluta@intel.com> wrote:
> On Fri, Jul 29, 2016 at 1:40 AM, Matt Ranostay <mranostay@gmail.com> wrote:
>> Reported-by: Giorgio <giorgio.nicole@arcor.de>
>> Cc: Daniel Baluta <daniel.baluta@intel.com>
>> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
>> ---
>>  drivers/iio/adc/ti-ads1015.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
>> index 73cbf0b54e54..fe96af6059d5 100644
>> --- a/drivers/iio/adc/ti-ads1015.c
>> +++ b/drivers/iio/adc/ti-ads1015.c
>> @@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = {
>>  #ifdef CONFIG_OF
>>  static int ads1015_get_channels_config_of(struct i2c_client *client)
>>  {
>> -       struct ads1015_data *data = i2c_get_clientdata(client);
>> +       struct iio_dev *indio_dev = i2c_get_clientdata(client);
>> +       struct ads1015_data *data = iio_priv(indio_dev);
>>         struct device_node *node;
>>
>>         if (!client->dev.of_node ||
>> --
>
> Hi Matt,
>
> Giorgio already sent a patch for this. I think we should go on his way
> since he found the bug.

Ah! see both a bug report and patch earlier now :)

Although do you know if there are anymore drivers we had to make a iio
version of hwmon for the triggered buffer? I suspect this was a simple
copy and paste error from the hwmon driver

>
> Daniel.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] iio:ti-ads1015: fix a wrong pointer definition.
  2016-07-29  7:39   ` Matt Ranostay
@ 2016-08-16 18:43     ` Giorgio Dal Molin
  2016-08-21 10:01       ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Giorgio Dal Molin @ 2016-08-16 18:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Giorgio Dal Molin, jic23

The call to i2c_get_clientdata(client) returns a struct iio_dev*, not
the needed struct ads1015_data*. We need here an intermediate step as
in the function: void ads1015_get_channels_config(struct i2c_client *client).

Signed-off-by: Giorgio Dal Molin <giorgio.nicole@arcor.de>
---
 drivers/iio/adc/ti-ads1015.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 1ef39877..066abaf 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -489,7 +489,8 @@ static struct iio_info ads1115_info = {
 #ifdef CONFIG_OF
 static int ads1015_get_channels_config_of(struct i2c_client *client)
 {
-	struct ads1015_data *data = i2c_get_clientdata(client);
+	struct iio_dev *indio_dev = i2c_get_clientdata(client);
+	struct ads1015_data *data = iio_priv(indio_dev);
 	struct device_node *node;
 
 	if (!client->dev.of_node ||
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] iio:ti-ads1015: fix a wrong pointer definition.
  2016-08-16 18:43     ` [PATCH 1/1] iio:ti-ads1015: fix a wrong pointer definition Giorgio Dal Molin
@ 2016-08-21 10:01       ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2016-08-21 10:01 UTC (permalink / raw)
  To: Giorgio Dal Molin, linux-iio; +Cc: jic23

On 16/08/16 19:43, Giorgio Dal Molin wrote:
> The call to i2c_get_clientdata(client) returns a struct iio_dev*, not
> the needed struct ads1015_data*. We need here an intermediate step as
> in the function: void ads1015_get_channels_config(struct i2c_client *client).
> 
> Signed-off-by: Giorgio Dal Molin <giorgio.nicole@arcor.de>
Applied with the addition of a fixes tag to the fixes-togreg branch
of iio.git.

I've also marked this for stable.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/ti-ads1015.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 1ef39877..066abaf 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -489,7 +489,8 @@ static struct iio_info ads1115_info = {
>  #ifdef CONFIG_OF
>  static int ads1015_get_channels_config_of(struct i2c_client *client)
>  {
> -	struct ads1015_data *data = i2c_get_clientdata(client);
> +	struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +	struct ads1015_data *data = iio_priv(indio_dev);
>  	struct device_node *node;
>  
>  	if (!client->dev.of_node ||
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-21 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 22:40 [PATCH] iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer Matt Ranostay
2016-07-29  6:19 ` Daniel Baluta
2016-07-29  7:39   ` Matt Ranostay
2016-08-16 18:43     ` [PATCH 1/1] iio:ti-ads1015: fix a wrong pointer definition Giorgio Dal Molin
2016-08-21 10:01       ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.