linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type
@ 2023-05-10 12:32 Simon Horman
  2023-05-11  7:32 ` Horatiu Vultur
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Simon Horman @ 2023-05-10 12:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Tharun Kumar P, Kumaravel Thiagarajan,
	Microchip Linux Driver Support, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, linux-i2c, llvm, Simon Horman

Rather than casting pci1xxxx_i2c_shutdown to an incompatible function type,
update the type to match that expected by __devm_add_action.

Reported by clang-16 with W-1:

 .../i2c-mchp-pci1xxxx.c:1159:29: error: cast from 'void (*)(struct pci1xxxx_i2c *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./include/linux/device.h:251:29: note: expanded from macro 'devm_add_action'
         __devm_add_action(release, action, data, #action)
                                   ^~~~~~

No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
index b21ffd6df927..5ef136c3ecb1 100644
--- a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
+++ b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
@@ -1118,8 +1118,10 @@ static int pci1xxxx_i2c_resume(struct device *dev)
 static DEFINE_SIMPLE_DEV_PM_OPS(pci1xxxx_i2c_pm_ops, pci1xxxx_i2c_suspend,
 			 pci1xxxx_i2c_resume);
 
-static void pci1xxxx_i2c_shutdown(struct pci1xxxx_i2c *i2c)
+static void pci1xxxx_i2c_shutdown(void *data)
 {
+	struct pci1xxxx_i2c *i2c = data;
+
 	pci1xxxx_i2c_config_padctrl(i2c, false);
 	pci1xxxx_i2c_configure_core_reg(i2c, false);
 }
@@ -1156,7 +1158,7 @@ static int pci1xxxx_i2c_probe_pci(struct pci_dev *pdev,
 	init_completion(&i2c->i2c_xfer_done);
 	pci1xxxx_i2c_init(i2c);
 
-	ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
+	ret = devm_add_action(dev, pci1xxxx_i2c_shutdown, i2c);
 	if (ret)
 		return ret;
 


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

* Re: [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type
  2023-05-10 12:32 [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type Simon Horman
@ 2023-05-11  7:32 ` Horatiu Vultur
  2023-05-11 14:20 ` Andi Shyti
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Horatiu Vultur @ 2023-05-11  7:32 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Tharun Kumar P, Kumaravel Thiagarajan,
	Microchip Linux Driver Support, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, linux-i2c, llvm

The 05/10/2023 14:32, Simon Horman wrote:
> 
> Rather than casting pci1xxxx_i2c_shutdown to an incompatible function type,
> update the type to match that expected by __devm_add_action.
> 
> Reported by clang-16 with W-1:
> 
>  .../i2c-mchp-pci1xxxx.c:1159:29: error: cast from 'void (*)(struct pci1xxxx_i2c *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>          ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  ./include/linux/device.h:251:29: note: expanded from macro 'devm_add_action'
>          __devm_add_action(release, action, data, #action)
>                                    ^~~~~~
> 
> No functional change intended.
> Compile tested only.

Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>

> 
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
>  drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> index b21ffd6df927..5ef136c3ecb1 100644
> --- a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> +++ b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> @@ -1118,8 +1118,10 @@ static int pci1xxxx_i2c_resume(struct device *dev)
>  static DEFINE_SIMPLE_DEV_PM_OPS(pci1xxxx_i2c_pm_ops, pci1xxxx_i2c_suspend,
>                          pci1xxxx_i2c_resume);
> 
> -static void pci1xxxx_i2c_shutdown(struct pci1xxxx_i2c *i2c)
> +static void pci1xxxx_i2c_shutdown(void *data)
>  {
> +       struct pci1xxxx_i2c *i2c = data;
> +
>         pci1xxxx_i2c_config_padctrl(i2c, false);
>         pci1xxxx_i2c_configure_core_reg(i2c, false);
>  }
> @@ -1156,7 +1158,7 @@ static int pci1xxxx_i2c_probe_pci(struct pci_dev *pdev,
>         init_completion(&i2c->i2c_xfer_done);
>         pci1xxxx_i2c_init(i2c);
> 
> -       ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
> +       ret = devm_add_action(dev, pci1xxxx_i2c_shutdown, i2c);
>         if (ret)
>                 return ret;
> 
> 

-- 
/Horatiu

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

* Re: [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type
  2023-05-10 12:32 [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type Simon Horman
  2023-05-11  7:32 ` Horatiu Vultur
@ 2023-05-11 14:20 ` Andi Shyti
  2023-05-17  9:43 ` Tharunkumar.Pasumarthi
  2023-06-05  8:44 ` Wolfram Sang
  3 siblings, 0 replies; 5+ messages in thread
From: Andi Shyti @ 2023-05-11 14:20 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Tharun Kumar P, Kumaravel Thiagarajan,
	Microchip Linux Driver Support, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, linux-i2c, llvm

Hi Simon,

On Wed, May 10, 2023 at 02:32:17PM +0200, Simon Horman wrote:
> Rather than casting pci1xxxx_i2c_shutdown to an incompatible function type,
> update the type to match that expected by __devm_add_action.
> 
> Reported by clang-16 with W-1:
> 
>  .../i2c-mchp-pci1xxxx.c:1159:29: error: cast from 'void (*)(struct pci1xxxx_i2c *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>          ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  ./include/linux/device.h:251:29: note: expanded from macro 'devm_add_action'
>          __devm_add_action(release, action, data, #action)
>                                    ^~~~~~
> 
> No functional change intended.
> Compile tested only.
> 
> Signed-off-by: Simon Horman <horms@kernel.org>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

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

* Re: [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type
  2023-05-10 12:32 [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type Simon Horman
  2023-05-11  7:32 ` Horatiu Vultur
  2023-05-11 14:20 ` Andi Shyti
@ 2023-05-17  9:43 ` Tharunkumar.Pasumarthi
  2023-06-05  8:44 ` Wolfram Sang
  3 siblings, 0 replies; 5+ messages in thread
From: Tharunkumar.Pasumarthi @ 2023-05-17  9:43 UTC (permalink / raw)
  To: horms, wsa; +Cc: nathan, llvm, ndesaulniers, linux-i2c, UNGLinuxDriver, trix

On Wed, 2023-05-10 at 14:32 +0200, Simon Horman wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> Rather than casting pci1xxxx_i2c_shutdown to an incompatible function
> type,
> update the type to match that expected by __devm_add_action.
> 
> Reported by clang-16 with W-1:
> 
>  .../i2c-mchp-pci1xxxx.c:1159:29: error: cast from 'void (*)(struct
> pci1xxxx_i2c *)' to 'void (*)(void *)' converts to incompatible
> function type [-Werror,-Wcast-function-type-strict]
>          ret = devm_add_action(dev, (void (*)(void
> *))pci1xxxx_i2c_shutdown, i2c);
>                                    
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  ./include/linux/device.h:251:29: note: expanded from macro
> 'devm_add_action'
>          __devm_add_action(release, action, data, #action)
>                                    ^~~~~~
> 
> No functional change intended.
> Compile tested only.
> 
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
>  drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> index b21ffd6df927..5ef136c3ecb1 100644
> --- a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> +++ b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
> @@ -1118,8 +1118,10 @@ static int pci1xxxx_i2c_resume(struct device
> *dev)
>  static DEFINE_SIMPLE_DEV_PM_OPS(pci1xxxx_i2c_pm_ops,
> pci1xxxx_i2c_suspend,
>                          pci1xxxx_i2c_resume);
> 
> -static void pci1xxxx_i2c_shutdown(struct pci1xxxx_i2c *i2c)
> +static void pci1xxxx_i2c_shutdown(void *data)
>  {
> +       struct pci1xxxx_i2c *i2c = data;
> +
>         pci1xxxx_i2c_config_padctrl(i2c, false);
>         pci1xxxx_i2c_configure_core_reg(i2c, false);
>  }
> @@ -1156,7 +1158,7 @@ static int pci1xxxx_i2c_probe_pci(struct
> pci_dev *pdev,
>         init_completion(&i2c->i2c_xfer_done);
>         pci1xxxx_i2c_init(i2c);
> 
> -       ret = devm_add_action(dev, (void (*)(void
> *))pci1xxxx_i2c_shutdown, i2c);
> +       ret = devm_add_action(dev, pci1xxxx_i2c_shutdown, i2c);
>         if (ret)
>                 return ret;
> 
> 

Reviewed-by: Tharun Kumar P<tharunkumar.pasumarthi@microchip.com>

---
with Best Regards,
Tharun Kumar P

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

* Re: [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type
  2023-05-10 12:32 [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type Simon Horman
                   ` (2 preceding siblings ...)
  2023-05-17  9:43 ` Tharunkumar.Pasumarthi
@ 2023-06-05  8:44 ` Wolfram Sang
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2023-06-05  8:44 UTC (permalink / raw)
  To: Simon Horman
  Cc: Tharun Kumar P, Kumaravel Thiagarajan,
	Microchip Linux Driver Support, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, linux-i2c, llvm

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

On Wed, May 10, 2023 at 02:32:17PM +0200, Simon Horman wrote:
> Rather than casting pci1xxxx_i2c_shutdown to an incompatible function type,
> update the type to match that expected by __devm_add_action.
> 
> Reported by clang-16 with W-1:
> 
>  .../i2c-mchp-pci1xxxx.c:1159:29: error: cast from 'void (*)(struct pci1xxxx_i2c *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>          ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  ./include/linux/device.h:251:29: note: expanded from macro 'devm_add_action'
>          __devm_add_action(release, action, data, #action)
>                                    ^~~~~~
> 
> No functional change intended.
> Compile tested only.
> 
> Signed-off-by: Simon Horman <horms@kernel.org>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-06-05  8:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 12:32 [PATCH] i2c: mchp-pci1xxxx: Avoid cast to incompatible function type Simon Horman
2023-05-11  7:32 ` Horatiu Vultur
2023-05-11 14:20 ` Andi Shyti
2023-05-17  9:43 ` Tharunkumar.Pasumarthi
2023-06-05  8:44 ` Wolfram Sang

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).