linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
@ 2023-01-11  4:37 XU pengfei
  2023-01-11  6:15 ` Ammar Faizi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: XU pengfei @ 2023-01-11  4:37 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, XU pengfei

Pointer variables of void * type do not require type cast.

Signed-off-by: XU pengfei <xupengfei@nfschina.com>
---
 drivers/hwmon/powr1220.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c
index f77dc6db31ac..501337ee5aa3 100644
--- a/drivers/hwmon/powr1220.c
+++ b/drivers/hwmon/powr1220.c
@@ -174,7 +174,7 @@ static umode_t
 powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
 		    attr, int channel)
 {
-	struct powr1220_data *chip_data = (struct powr1220_data *)data;
+	struct powr1220_data *chip_data = data;
 
 	if (channel >= chip_data->max_channels)
 		return 0;
-- 
2.18.2


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

* Re: [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
  2023-01-11  4:37 [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions XU pengfei
@ 2023-01-11  6:15 ` Ammar Faizi
  2023-01-11  6:27   ` Guenter Roeck
  2023-01-20 18:26 ` kernel test robot
  2023-01-20 19:08 ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Ammar Faizi @ 2023-01-11  6:15 UTC (permalink / raw)
  To: XU pengfei
  Cc: Guenter Roeck, Jean Delvare, Linux Kernel Mailing List, linux-hwmon

On 1/11/23 11:37 AM, XU pengfei wrote:
> Pointer variables of void * type do not require type cast.
> 
> Signed-off-by: XU pengfei <xupengfei@nfschina.com>
> ---
>   drivers/hwmon/powr1220.c | 2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c
> index f77dc6db31ac..501337ee5aa3 100644
> --- a/drivers/hwmon/powr1220.c
> +++ b/drivers/hwmon/powr1220.c
> @@ -174,7 +174,7 @@ static umode_t
>   powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
>   		    attr, int channel)
>   {
> -	struct powr1220_data *chip_data = (struct powr1220_data *)data;
> +	struct powr1220_data *chip_data = data;

Broken:

   CC [M]  drivers/hwmon/powr1220.o
drivers/hwmon/powr1220.c: In function ‘powr1220_is_visible’:
drivers/hwmon/powr1220.c:177:43: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   177 |         struct powr1220_data *chip_data = data;
       |                                           ^~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:249: drivers/hwmon/powr1220.o] Error 1
make[1]: *** [scripts/Makefile.build:465: drivers/hwmon] Error 2
make: *** [Makefile:1853: drivers] Error 2

-- 
Ammar Faizi

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

* Re: [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
  2023-01-11  6:15 ` Ammar Faizi
@ 2023-01-11  6:27   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-01-11  6:27 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: XU pengfei, Jean Delvare, Linux Kernel Mailing List, linux-hwmon

On Wed, Jan 11, 2023 at 01:15:17PM +0700, Ammar Faizi wrote:
> On 1/11/23 11:37 AM, XU pengfei wrote:
> > Pointer variables of void * type do not require type cast.
> > 
> > Signed-off-by: XU pengfei <xupengfei@nfschina.com>
> > ---
> >   drivers/hwmon/powr1220.c | 2 +-
> >   1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c
> > index f77dc6db31ac..501337ee5aa3 100644
> > --- a/drivers/hwmon/powr1220.c
> > +++ b/drivers/hwmon/powr1220.c
> > @@ -174,7 +174,7 @@ static umode_t
> >   powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
> >   		    attr, int channel)
> >   {
> > -	struct powr1220_data *chip_data = (struct powr1220_data *)data;
> > +	struct powr1220_data *chip_data = data;
> 
> Broken:
> 
>   CC [M]  drivers/hwmon/powr1220.o
> drivers/hwmon/powr1220.c: In function ‘powr1220_is_visible’:
> drivers/hwmon/powr1220.c:177:43: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>   177 |         struct powr1220_data *chip_data = data;
>       |                                           ^~~~
> cc1: all warnings being treated as errors
> make[2]: *** [scripts/Makefile.build:249: drivers/hwmon/powr1220.o] Error 1
> make[1]: *** [scripts/Makefile.build:465: drivers/hwmon] Error 2
> make: *** [Makefile:1853: drivers] Error 2
> 

Thanks for catching. Sigh. Wouldn't it be nice if submitters would
at least build test their patches ?

Guenter

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

* Re: [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
  2023-01-11  4:37 [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions XU pengfei
  2023-01-11  6:15 ` Ammar Faizi
@ 2023-01-20 18:26 ` kernel test robot
  2023-01-20 19:08 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-01-20 18:26 UTC (permalink / raw)
  To: XU pengfei, jdelvare, linux
  Cc: llvm, oe-kbuild-all, linux-hwmon, linux-kernel, XU pengfei

Hi XU,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on linus/master v6.2-rc4 next-20230120]
[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/XU-pengfei/hwmon-powr1220-remove-unnecessary-void-conversions/20230111-123826
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20230111043729.3792-1-xupengfei%40nfschina.com
patch subject: [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
config: i386-randconfig-a002 (https://download.01.org/0day-ci/archive/20230121/202301210219.P2QHV5eM-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/2eb252eb3b198f857b200cd1b3aee679a7129baa
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review XU-pengfei/hwmon-powr1220-remove-unnecessary-void-conversions/20230111-123826
        git checkout 2eb252eb3b198f857b200cd1b3aee679a7129baa
        # 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=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/hwmon/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/hwmon/powr1220.c:177:24: error: initializing 'struct powr1220_data *' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           struct powr1220_data *chip_data = data;
                                 ^           ~~~~
   1 error generated.


vim +177 drivers/hwmon/powr1220.c

   172	
   173	static umode_t
   174	powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
   175			    attr, int channel)
   176	{
 > 177		struct powr1220_data *chip_data = data;
   178	
   179		if (channel >= chip_data->max_channels)
   180			return 0;
   181	
   182		switch (type) {
   183		case hwmon_in:
   184			switch (attr) {
   185			case hwmon_in_input:
   186			case hwmon_in_highest:
   187			case hwmon_in_label:
   188				return 0444;
   189			default:
   190				break;
   191			}
   192			break;
   193		default:
   194			break;
   195		}
   196	
   197		return 0;
   198	}
   199	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
  2023-01-11  4:37 [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions XU pengfei
  2023-01-11  6:15 ` Ammar Faizi
  2023-01-20 18:26 ` kernel test robot
@ 2023-01-20 19:08 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-01-20 19:08 UTC (permalink / raw)
  To: XU pengfei, jdelvare, linux
  Cc: llvm, oe-kbuild-all, linux-hwmon, linux-kernel, XU pengfei

Hi XU,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on linus/master v6.2-rc4 next-20230120]
[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/XU-pengfei/hwmon-powr1220-remove-unnecessary-void-conversions/20230111-123826
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20230111043729.3792-1-xupengfei%40nfschina.com
patch subject: [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20230121/202301210322.r2vwtdN5-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/2eb252eb3b198f857b200cd1b3aee679a7129baa
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review XU-pengfei/hwmon-powr1220-remove-unnecessary-void-conversions/20230111-123826
        git checkout 2eb252eb3b198f857b200cd1b3aee679a7129baa
        # 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=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/hwmon/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/hwmon/powr1220.c:177:24: error: initializing 'struct powr1220_data *' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           struct powr1220_data *chip_data = data;
                                 ^           ~~~~
   1 error generated.


vim +177 drivers/hwmon/powr1220.c

   172	
   173	static umode_t
   174	powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
   175			    attr, int channel)
   176	{
 > 177		struct powr1220_data *chip_data = data;
   178	
   179		if (channel >= chip_data->max_channels)
   180			return 0;
   181	
   182		switch (type) {
   183		case hwmon_in:
   184			switch (attr) {
   185			case hwmon_in_input:
   186			case hwmon_in_highest:
   187			case hwmon_in_label:
   188				return 0444;
   189			default:
   190				break;
   191			}
   192			break;
   193		default:
   194			break;
   195		}
   196	
   197		return 0;
   198	}
   199	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

end of thread, other threads:[~2023-01-20 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11  4:37 [PATCH 1/1] hwmon: powr1220: remove unnecessary (void*) conversions XU pengfei
2023-01-11  6:15 ` Ammar Faizi
2023-01-11  6:27   ` Guenter Roeck
2023-01-20 18:26 ` kernel test robot
2023-01-20 19:08 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).