mbox series

[00/12] nfc: constify, continued (part 2)

Message ID 20210729104022.47761-1-krzysztof.kozlowski@canonical.com
Headers show
Series nfc: constify, continued (part 2) | expand

Message

Krzysztof Kozlowski July 29, 2021, 10:40 a.m. UTC
Hi,

On top of:
nfc: constify pointed data
https://lore.kernel.org/lkml/20210726145224.146006-1-krzysztof.kozlowski@canonical.com/

Best regards,
Krzysztof


Krzysztof Kozlowski (12):
  nfc: constify passed nfc_dev
  nfc: mei_phy: constify buffer passed to mei_nfc_send()
  nfc: port100: constify several pointers
  nfc: trf7970a: constify several pointers
  nfc: virtual_ncidev: constify pointer to nfc_dev
  nfc: nfcsim: constify drvdata (struct nfcsim)
  nfc: fdp: drop unneeded cast for printing firmware size in dev_dbg()
  nfc: fdp: use unsigned int as loop iterator
  nfc: fdp: constify several pointers
  nfc: microread: constify several pointers
  nfc: mrvl: constify several pointers
  nfc: mrvl: constify static nfcmrvl_if_ops

 drivers/nfc/fdp/fdp.c             | 27 +++++++++++-----------
 drivers/nfc/fdp/fdp.h             |  2 +-
 drivers/nfc/fdp/i2c.c             |  6 ++---
 drivers/nfc/mei_phy.c             |  2 +-
 drivers/nfc/microread/i2c.c       |  2 +-
 drivers/nfc/microread/microread.c |  4 ++--
 drivers/nfc/microread/microread.h |  2 +-
 drivers/nfc/nfcmrvl/fw_dnld.c     | 16 +++++++------
 drivers/nfc/nfcmrvl/i2c.c         |  4 ++--
 drivers/nfc/nfcmrvl/main.c        |  4 ++--
 drivers/nfc/nfcmrvl/nfcmrvl.h     |  6 ++---
 drivers/nfc/nfcmrvl/spi.c         |  6 ++---
 drivers/nfc/nfcmrvl/uart.c        |  4 ++--
 drivers/nfc/nfcmrvl/usb.c         |  2 +-
 drivers/nfc/nfcsim.c              |  2 +-
 drivers/nfc/port100.c             | 37 +++++++++++++++++--------------
 drivers/nfc/trf7970a.c            | 17 +++++++-------
 drivers/nfc/virtual_ncidev.c      |  2 +-
 include/net/nfc/nfc.h             |  4 ++--
 19 files changed, 78 insertions(+), 71 deletions(-)

Comments

Krzysztof Kozlowski July 29, 2021, 10:48 a.m. UTC | #1
On 29/07/2021 12:40, Krzysztof Kozlowski wrote:
> Several functions do not modify pointed data so arguments and local
> variables can be const for correctness and safety.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/nfc/nfcmrvl/fw_dnld.c | 16 +++++++++-------
>  drivers/nfc/nfcmrvl/i2c.c     |  2 +-
>  drivers/nfc/nfcmrvl/main.c    |  2 +-
>  drivers/nfc/nfcmrvl/nfcmrvl.h |  2 +-
>  drivers/nfc/nfcmrvl/spi.c     |  4 ++--
>  drivers/nfc/nfcmrvl/uart.c    |  2 +-
>  6 files changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c
> index aaccb8b76b3e..edac56b01fd1 100644
> --- a/drivers/nfc/nfcmrvl/fw_dnld.c
> +++ b/drivers/nfc/nfcmrvl/fw_dnld.c
> @@ -129,7 +129,7 @@ static void fw_dnld_timeout(struct timer_list *t)
>  }
>  
>  static int process_state_reset(struct nfcmrvl_private *priv,
> -			       struct sk_buff *skb)
> +			       const struct sk_buff *skb)
>  {
>  	if (sizeof(nci_pattern_core_reset_ntf) != skb->len ||
>  	    memcmp(skb->data, nci_pattern_core_reset_ntf,
> @@ -145,7 +145,8 @@ static int process_state_reset(struct nfcmrvl_private *priv,
>  	return 0;
>  }
>  
> -static int process_state_init(struct nfcmrvl_private *priv, struct sk_buff *skb)
> +static int process_state_init(struct nfcmrvl_private *priv,
> +			      const struct sk_buff *skb)
>  {
>  	struct nci_core_set_config_cmd cmd;
>  
> @@ -175,7 +176,7 @@ static void create_lc(struct nfcmrvl_private *priv)
>  }
>  
>  static int process_state_set_ref_clock(struct nfcmrvl_private *priv,
> -				       struct sk_buff *skb)
> +				       const struct sk_buff *skb)
>  {
>  	struct nci_core_set_config_cmd cmd;
>  
> @@ -221,7 +222,7 @@ static int process_state_set_ref_clock(struct nfcmrvl_private *priv,
>  }
>  
>  static int process_state_set_hi_config(struct nfcmrvl_private *priv,
> -				       struct sk_buff *skb)
> +				       const struct sk_buff *skb)
>  {
>  	if (sizeof(nci_pattern_core_set_config_rsp) != skb->len ||
>  	    memcmp(skb->data, nci_pattern_core_set_config_rsp, skb->len))
> @@ -232,7 +233,7 @@ static int process_state_set_hi_config(struct nfcmrvl_private *priv,
>  }
>  
>  static int process_state_open_lc(struct nfcmrvl_private *priv,
> -				 struct sk_buff *skb)
> +				 const struct sk_buff *skb)
>  {
>  	if (sizeof(nci_pattern_core_conn_create_rsp) >= skb->len ||
>  	    memcmp(skb->data, nci_pattern_core_conn_create_rsp,
> @@ -347,7 +348,7 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv,
>  }
>  
>  static int process_state_close_lc(struct nfcmrvl_private *priv,
> -				  struct sk_buff *skb)
> +				  const struct sk_buff *skb)
>  {
>  	if (sizeof(nci_pattern_core_conn_close_rsp) != skb->len ||
>  	    memcmp(skb->data, nci_pattern_core_conn_close_rsp, skb->len))
> @@ -358,7 +359,8 @@ static int process_state_close_lc(struct nfcmrvl_private *priv,
>  	return 0;
>  }
>  
> -static int process_state_boot(struct nfcmrvl_private *priv, struct sk_buff *skb)
> +static int process_state_boot(struct nfcmrvl_private *priv,
> +			      const struct sk_buff *skb)
>  {
>  	if (sizeof(nci_pattern_proprietary_boot_rsp) != skb->len ||
>  	    memcmp(skb->data, nci_pattern_proprietary_boot_rsp, skb->len))
> diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c
> index 59a529e72d96..6e659e77c8a2 100644
> --- a/drivers/nfc/nfcmrvl/i2c.c
> +++ b/drivers/nfc/nfcmrvl/i2c.c
> @@ -182,8 +182,8 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node,
>  static int nfcmrvl_i2c_probe(struct i2c_client *client,
>  			     const struct i2c_device_id *id)
>  {
> +	const struct nfcmrvl_platform_data *pdata;
>  	struct nfcmrvl_i2c_drv_data *drv_data;
> -	struct nfcmrvl_platform_data *pdata;
>  	struct nfcmrvl_platform_data config;
>  	int ret;
>  
> diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
> index 6e9e7ce8792c..d8e48bdaf652 100644
> --- a/drivers/nfc/nfcmrvl/main.c
> +++ b/drivers/nfc/nfcmrvl/main.c
> @@ -93,7 +93,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
>  				void *drv_data,
>  				struct nfcmrvl_if_ops *ops,
>  				struct device *dev,
> -				struct nfcmrvl_platform_data *pdata)
> +				const struct nfcmrvl_platform_data *pdata)
>  {
>  	struct nfcmrvl_private *priv;
>  	int rc;
> diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h
> index a715543bc9bf..84fafa95965e 100644
> --- a/drivers/nfc/nfcmrvl/nfcmrvl.h
> +++ b/drivers/nfc/nfcmrvl/nfcmrvl.h
> @@ -94,7 +94,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
>  				void *drv_data,
>  				struct nfcmrvl_if_ops *ops,
>  				struct device *dev,
> -				struct nfcmrvl_platform_data *pdata);
> +				const struct nfcmrvl_platform_data *pdata);
>  
>  
>  void nfcmrvl_chip_reset(struct nfcmrvl_private *priv);
> diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c
> index 66696321c645..7b015bb33fc9 100644
> --- a/drivers/nfc/nfcmrvl/spi.c
> +++ b/drivers/nfc/nfcmrvl/spi.c
> @@ -106,7 +106,7 @@ static struct nfcmrvl_if_ops spi_ops = {
>  	.nci_update_config = nfcmrvl_spi_nci_update_config,
>  };
>  
> -static int nfcmrvl_spi_parse_dt(struct device_node *node,
> +static int nfcmrvl_spi_parse_dt(const struct device_node *node,
>  				struct nfcmrvl_platform_data *pdata)

This one is not correct (yet) as it depends on changes in OF/IRQ. I just
found compile configuration which triggers here warning.

Please skip this one patch.


Best regards,
Krzysztof
patchwork-bot+netdevbpf@kernel.org July 29, 2021, 11:30 a.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu, 29 Jul 2021 12:40:10 +0200 you wrote:
> Hi,
> 
> On top of:
> nfc: constify pointed data
> https://lore.kernel.org/lkml/20210726145224.146006-1-krzysztof.kozlowski@canonical.com/
> 
> Best regards,
> Krzysztof
> 
> [...]

Here is the summary with links:
  - [01/12] nfc: constify passed nfc_dev
    https://git.kernel.org/netdev/net-next/c/dd8987a394c0
  - [02/12] nfc: mei_phy: constify buffer passed to mei_nfc_send()
    https://git.kernel.org/netdev/net-next/c/894a6e158633
  - [03/12] nfc: port100: constify several pointers
    https://git.kernel.org/netdev/net-next/c/9a4af01c35a5
  - [04/12] nfc: trf7970a: constify several pointers
    https://git.kernel.org/netdev/net-next/c/ea050c5ee74a
  - [05/12] nfc: virtual_ncidev: constify pointer to nfc_dev
    https://git.kernel.org/netdev/net-next/c/83428dbbac51
  - [06/12] nfc: nfcsim: constify drvdata (struct nfcsim)
    https://git.kernel.org/netdev/net-next/c/582fdc98adc8
  - [07/12] nfc: fdp: drop unneeded cast for printing firmware size in dev_dbg()
    https://git.kernel.org/netdev/net-next/c/6c755b1d2511
  - [08/12] nfc: fdp: use unsigned int as loop iterator
    https://git.kernel.org/netdev/net-next/c/c3e26b6dc1b4
  - [09/12] nfc: fdp: constify several pointers
    https://git.kernel.org/netdev/net-next/c/3d463dd5023b
  - [10/12] nfc: microread: constify several pointers
    https://git.kernel.org/netdev/net-next/c/a751449f8b47
  - [11/12] nfc: mrvl: constify several pointers
    https://git.kernel.org/netdev/net-next/c/fe53159fe3e0
  - [12/12] nfc: mrvl: constify static nfcmrvl_if_ops
    https://git.kernel.org/netdev/net-next/c/2695503729da

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html