diff mbox series

iio: light: tsl2772: fix reading proximity-diodes from device tree

Message ID 20230404011455.339454-1-bmasney@redhat.com (mailing list archive)
State Accepted
Headers show
Series iio: light: tsl2772: fix reading proximity-diodes from device tree | expand

Commit Message

Brian Masney April 4, 2023, 1:14 a.m. UTC
tsl2772_read_prox_diodes() will correctly parse the properties from
device tree to determine which proximity diode(s) to read from, however
it didn't actually set this value on the struct tsl2772_settings. Let's
go ahead and fix that.

Reported-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/lkml/20230327120823.1369700-1-trix@redhat.com/
Fixes: 94cd1113aaa0 ("iio: tsl2772: add support for reading proximity led settings from device tree")
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/iio/light/tsl2772.c | 1 +
 1 file changed, 1 insertion(+)

Comments

kernel test robot April 4, 2023, 7:13 a.m. UTC | #1
Hi Brian,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v6.3-rc5 next-20230403]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Brian-Masney/iio-light-tsl2772-fix-reading-proximity-diodes-from-device-tree/20230404-091630
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20230404011455.339454-1-bmasney%40redhat.com
patch subject: [PATCH] iio: light: tsl2772: fix reading proximity-diodes from device tree
config: x86_64-randconfig-a001-20230403 (https://download.01.org/0day-ci/archive/20230404/202304041451.gj8oasQp-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/9701bd10d6409568197894b603f8a1e23280e82b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Brian-Masney/iio-light-tsl2772-fix-reading-proximity-diodes-from-device-tree/20230404-091630
        git checkout 9701bd10d6409568197894b603f8a1e23280e82b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/iio/light/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304041451.gj8oasQp-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iio/light/tsl2772.c:599:30: error: use of undeclared identifier 'prox_diode_mask'; did you mean 'protnone_mask'?
           chip->settings.prox_diode = prox_diode_mask;
                                       ^~~~~~~~~~~~~~~
                                       protnone_mask
   arch/x86/include/asm/pgtable-invert.h:22:19: note: 'protnone_mask' declared here
   static inline u64 protnone_mask(u64 val)
                     ^
   1 error generated.


vim +599 drivers/iio/light/tsl2772.c

   572	
   573	static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
   574	{
   575		struct device *dev = &chip->client->dev;
   576		int i, ret, num_leds;
   577		u32 leds[TSL2772_MAX_PROX_LEDS];
   578	
   579		ret = device_property_count_u32(dev, "amstaos,proximity-diodes");
   580		if (ret < 0)
   581			return ret;
   582	
   583		num_leds = ret;
   584		if (num_leds > TSL2772_MAX_PROX_LEDS)
   585			num_leds = TSL2772_MAX_PROX_LEDS;
   586	
   587		ret = device_property_read_u32_array(dev, "amstaos,proximity-diodes", leds, num_leds);
   588		if (ret < 0) {
   589			dev_err(dev, "Invalid value for amstaos,proximity-diodes: %d.\n", ret);
   590			return ret;
   591		}
   592	
   593		for (i = 0; i < num_leds; i++) {
   594			if (leds[i] > 1) {
   595				dev_err(dev, "Invalid value %d in amstaos,proximity-diodes.\n", leds[i]);
   596				return -EINVAL;
   597			}
   598		}
 > 599		chip->settings.prox_diode = prox_diode_mask;
   600	
   601		return 0;
   602	}
   603
Brian Masney April 4, 2023, 11:13 a.m. UTC | #2
Hi kernel test robot maintainers,

On Tue, Apr 04, 2023 at 03:13:24PM +0800, kernel test robot wrote:
> Hi Brian,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on jic23-iio/togreg]
> [also build test ERROR on linus/master v6.3-rc5 next-20230403]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Brian-Masney/iio-light-tsl2772-fix-reading-proximity-diodes-from-device-tree/20230404-091630
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> patch link:    https://lore.kernel.org/r/20230404011455.339454-1-bmasney%40redhat.com
> patch subject: [PATCH] iio: light: tsl2772: fix reading proximity-diodes from device tree
> config: x86_64-randconfig-a001-20230403 (https://download.01.org/0day-ci/archive/20230404/202304041451.gj8oasQp-lkp@intel.com/config)
> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/intel-lab-lkp/linux/commit/9701bd10d6409568197894b603f8a1e23280e82b
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Brian-Masney/iio-light-tsl2772-fix-reading-proximity-diodes-from-device-tree/20230404-091630
>         git checkout 9701bd10d6409568197894b603f8a1e23280e82b
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/iio/light/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202304041451.gj8oasQp-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
> >> drivers/iio/light/tsl2772.c:599:30: error: use of undeclared identifier 'prox_diode_mask'; did you mean 'protnone_mask'?
>            chip->settings.prox_diode = prox_diode_mask;
>                                        ^~~~~~~~~~~~~~~
>                                        protnone_mask
>    arch/x86/include/asm/pgtable-invert.h:22:19: note: 'protnone_mask' declared here
>    static inline u64 protnone_mask(u64 val)
>                      ^
>    1 error generated.
> 
> 
> vim +599 drivers/iio/light/tsl2772.c
> 
>    572	
>    573	static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
>    574	{
>    575		struct device *dev = &chip->client->dev;
>    576		int i, ret, num_leds;
>    577		u32 leds[TSL2772_MAX_PROX_LEDS];
>    578	
>    579		ret = device_property_count_u32(dev, "amstaos,proximity-diodes");
>    580		if (ret < 0)
>    581			return ret;
>    582	
>    583		num_leds = ret;
>    584		if (num_leds > TSL2772_MAX_PROX_LEDS)
>    585			num_leds = TSL2772_MAX_PROX_LEDS;
>    586	
>    587		ret = device_property_read_u32_array(dev, "amstaos,proximity-diodes", leds, num_leds);
>    588		if (ret < 0) {
>    589			dev_err(dev, "Invalid value for amstaos,proximity-diodes: %d.\n", ret);
>    590			return ret;
>    591		}
>    592	
>    593		for (i = 0; i < num_leds; i++) {
>    594			if (leds[i] > 1) {
>    595				dev_err(dev, "Invalid value %d in amstaos,proximity-diodes.\n", leds[i]);
>    596				return -EINVAL;
>    597			}
>    598		}
>  > 599		chip->settings.prox_diode = prox_diode_mask;
>    600	
>    601		return 0;
>    602	}
>    603	

This doesn't contain the code that's in iio/togreg [1], and that's why
the build failed. I originally developed / built this against
next-20230330. I just checked linus/master, next-20230404, iio/testing,
and all have the expected code that defines prox_diode_mask.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/tree/drivers/iio/light/tsl2772.c?h=togreg#n593

Brian
Uwe Kleine-König April 4, 2023, 12:35 p.m. UTC | #3
Hello Brian,

On Tue, Apr 04, 2023 at 07:13:03AM -0400, Brian Masney wrote:
> This doesn't contain the code that's in iio/togreg [1], and that's why
> the build failed. I originally developed / built this against
> next-20230330. I just checked linus/master, next-20230404, iio/testing,
> and all have the expected code that defines prox_diode_mask.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/tree/drivers/iio/light/tsl2772.c?h=togreg#n593

You might want to make use of the --base parameter to git format-patch
for you next submission. With that the auto builders have a chance to
test on the right tree.

Best regards
Uwe
Brian Masney April 4, 2023, 10:36 p.m. UTC | #4
On Tue, Apr 04, 2023 at 02:35:44PM +0200, Uwe Kleine-König wrote:
> Hello Brian,
> 
> On Tue, Apr 04, 2023 at 07:13:03AM -0400, Brian Masney wrote:
> > This doesn't contain the code that's in iio/togreg [1], and that's why
> > the build failed. I originally developed / built this against
> > next-20230330. I just checked linus/master, next-20230404, iio/testing,
> > and all have the expected code that defines prox_diode_mask.
> > 
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/tree/drivers/iio/light/tsl2772.c?h=togreg#n593
> 
> You might want to make use of the --base parameter to git format-patch
> for you next submission. With that the auto builders have a chance to
> test on the right tree.

I'll add the --base parameter next time. However, I think the issue is
that this compiler error is triggered by this patch [1] that's not in
any maintainer trees. I suspect the kernel test robot still has that in
it's local tree from a previous round of testing against this driver.

[1] https://lore.kernel.org/lkml/20230327120823.1369700-1-trix@redhat.com/

Brian
Jonathan Cameron April 8, 2023, 9:47 a.m. UTC | #5
On Mon,  3 Apr 2023 21:14:55 -0400
Brian Masney <bmasney@redhat.com> wrote:

> tsl2772_read_prox_diodes() will correctly parse the properties from
> device tree to determine which proximity diode(s) to read from, however
> it didn't actually set this value on the struct tsl2772_settings. Let's
> go ahead and fix that.
> 
> Reported-by: Tom Rix <trix@redhat.com>
> Link: https://lore.kernel.org/lkml/20230327120823.1369700-1-trix@redhat.com/
> Fixes: 94cd1113aaa0 ("iio: tsl2772: add support for reading proximity led settings from device tree")
> Signed-off-by: Brian Masney <bmasney@redhat.com>

Applied to the fixes-togreg branch of iio.git and marked for stable.

thanks,

Jonathan

> ---
>  drivers/iio/light/tsl2772.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
> index ad50baa0202c..e823c145f679 100644
> --- a/drivers/iio/light/tsl2772.c
> +++ b/drivers/iio/light/tsl2772.c
> @@ -601,6 +601,7 @@ static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
>  			return -EINVAL;
>  		}
>  	}
> +	chip->settings.prox_diode = prox_diode_mask;
>  
>  	return 0;
>  }
diff mbox series

Patch

diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
index ad50baa0202c..e823c145f679 100644
--- a/drivers/iio/light/tsl2772.c
+++ b/drivers/iio/light/tsl2772.c
@@ -601,6 +601,7 @@  static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
 			return -EINVAL;
 		}
 	}
+	chip->settings.prox_diode = prox_diode_mask;
 
 	return 0;
 }