public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v1 1/1] device property: Add const qualifier to device_get_match_data() parameter
Date: Thu, 22 Sep 2022 20:22:54 +0000	[thread overview]
Message-ID: <YyzEHk2TTcsIO0ha@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20220922135410.49694-1-andriy.shevchenko@linux.intel.com>

Hi Andy,

Thanks for cc'ing me.

On Thu, Sep 22, 2022 at 04:54:10PM +0300, Andy Shevchenko wrote:
> Add const qualifier to the device_get_match_data() parameter.
> Some of the future users may utilize this function without
> forcing the type.

From const to non-const? This is what this patch does, right?

> 
> All the same, dev_fwnode() may be used with a const qualifier.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/base/property.c  | 4 ++--
>  include/linux/property.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index ed6f449f8e5c..4d6278a84868 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -17,7 +17,7 @@
>  #include <linux/property.h>
>  #include <linux/phy.h>
>  
> -struct fwnode_handle *dev_fwnode(struct device *dev)
> +struct fwnode_handle *dev_fwnode(const struct device *dev)

If you have const struct device pointer, then the embedded fwnode handle in
that object sure is const, too. Isn't it?

If you really have const struct device pointer (where do you?), then I'd
suggest to add another function, dev_fwnode_const() that is otherwise the
same except the argument as well as the return value are const.

Or alternatively define it as a macro and use _Generic()?

>  {
>  	return IS_ENABLED(CONFIG_OF) && dev->of_node ?
>  		of_fwnode_handle(dev->of_node) : dev->fwnode;
> @@ -1200,7 +1200,7 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
>  }
>  EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
>  
> -const void *device_get_match_data(struct device *dev)
> +const void *device_get_match_data(const struct device *dev)
>  {
>  	return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev);
>  }
> diff --git a/include/linux/property.h b/include/linux/property.h
> index a5b429d623f6..117cc200c656 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -32,7 +32,7 @@ enum dev_dma_attr {
>  	DEV_DMA_COHERENT,
>  };
>  
> -struct fwnode_handle *dev_fwnode(struct device *dev);
> +struct fwnode_handle *dev_fwnode(const struct device *dev);
>  
>  bool device_property_present(struct device *dev, const char *propname);
>  int device_property_read_u8_array(struct device *dev, const char *propname,
> @@ -387,7 +387,7 @@ bool device_dma_supported(struct device *dev);
>  
>  enum dev_dma_attr device_get_dma_attr(struct device *dev);
>  
> -const void *device_get_match_data(struct device *dev);
> +const void *device_get_match_data(const struct device *dev);
>  
>  int device_get_phy_mode(struct device *dev);
>  int fwnode_get_phy_mode(struct fwnode_handle *fwnode);

-- 
Regards,

Sakari Ailus

  parent reply	other threads:[~2022-09-22 20:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 13:54 [PATCH v1 1/1] device property: Add const qualifier to device_get_match_data() parameter Andy Shevchenko
2022-09-22 14:44 ` Heikki Krogerus
2022-09-22 20:22 ` Sakari Ailus [this message]
2022-09-23 10:25   ` Andy Shevchenko
2022-09-23 11:25     ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YyzEHk2TTcsIO0ha@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=djrscally@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox