From: Chanwoo Choi <cwchoi00@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
linux-kernel@vger.kernel.org
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Subject: Re: [PATCH v2 1/5] extcon: Make the allocation and freeing to be private calls
Date: Fri, 7 Apr 2023 04:19:08 +0900 [thread overview]
Message-ID: <806934f5-2992-6085-ab75-909e11e7a95c@gmail.com> (raw)
In-Reply-To: <20230405152745.24959-2-andriy.shevchenko@linux.intel.com>
Hi,
On 23. 4. 6. 00:27, Andy Shevchenko wrote:
> The extcon_dev_allocate() and extcon_dev_free() are not used
> outside of the extcon framework. Moreover, the struct extcon_dev
> can't be filled outside of the framework either after allocation.
> The registration part, for instance, requires a parent device to
> be set and that's done in the devm_extcon_dev_allocate() wrapper.
>
> Taking the above into account, sumply move the mentioned APIs to
> the private headers.
>
> Alternatively, the pointer to the parent device can be added to
> the extcon_dev_allocate(), but since there are no users and magnitude
> of the change it makes a little sense to go this way.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
The role of extcon_dev_allocate is not that supporting to touch
the internal data of struct extcon_dev. Some driver needs
the removing sequence between extcon device and their used resource
like irq/opp/regulator or others.
When they need some sequence of resource freeing, it should be supported.
I think that there is no benefit to move into driver/extcon. It might
limit the various use-case of extcon_dev_allocate.
> ---
> drivers/extcon/extcon.h | 4 ++++
> include/linux/extcon-provider.h | 9 ---------
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h
> index 15616446140d..49e4ed9f6450 100644
> --- a/drivers/extcon/extcon.h
> +++ b/drivers/extcon/extcon.h
> @@ -63,4 +63,8 @@ struct extcon_dev {
> struct device_attribute *d_attrs_muex;
> };
>
> +/* Following APIs allocate/free the memory of the extcon device. */
> +struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
> +void extcon_dev_free(struct extcon_dev *edev);
> +
> #endif /* __LINUX_EXTCON_INTERNAL_H__ */
> diff --git a/include/linux/extcon-provider.h b/include/linux/extcon-provider.h
> index fa70945f4e6b..db474ae3c711 100644
> --- a/include/linux/extcon-provider.h
> +++ b/include/linux/extcon-provider.h
> @@ -25,8 +25,6 @@ void devm_extcon_dev_unregister(struct device *dev,
> struct extcon_dev *edev);
>
> /* Following APIs allocate/free the memory of the extcon device. */
> -struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
> -void extcon_dev_free(struct extcon_dev *edev);
> struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
> const unsigned int *cable);
> void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
> @@ -78,13 +76,6 @@ static inline int devm_extcon_dev_register(struct device *dev,
> static inline void devm_extcon_dev_unregister(struct device *dev,
> struct extcon_dev *edev) { }
>
> -static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
> -{
> - return ERR_PTR(-ENOSYS);
> -}
> -
> -static inline void extcon_dev_free(struct extcon_dev *edev) { }
> -
> static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
> const unsigned int *cable)
> {
--
Best Regards,
Samsung Electronics
Chanwoo Choi
next prev parent reply other threads:[~2023-04-06 19:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 15:27 [PATCH v2 0/5] extcon: Core cleanups and documentation fixes Andy Shevchenko
2023-04-05 15:27 ` [PATCH v2 1/5] extcon: Make the allocation and freeing to be private calls Andy Shevchenko
2023-04-06 19:19 ` Chanwoo Choi [this message]
2023-04-05 15:27 ` [PATCH v2 2/5] extcon: Get rid of not really used name field in struct extcon_dev Andy Shevchenko
2023-04-06 19:26 ` Chanwoo Choi
2023-04-11 11:37 ` Andy Shevchenko
2023-04-11 11:42 ` Andy Shevchenko
2023-04-05 15:27 ` [PATCH v2 3/5] extcon: Use unique number for the extcon device ID Andy Shevchenko
2023-04-05 15:27 ` [PATCH v2 4/5] extcon: Use sizeof(*pointer) instead of sizeof(type) Andy Shevchenko
2023-04-06 19:33 ` Chanwoo Choi
2023-04-05 15:27 ` [PATCH v2 5/5] extcon: Drop unneeded assignments Andy Shevchenko
2023-04-06 19:35 ` Chanwoo Choi
2023-04-11 11:43 ` Andy Shevchenko
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=806934f5-2992-6085-ab75-909e11e7a95c@gmail.com \
--to=cwchoi00@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=cw00.choi@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/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
all inboxes | Powered by JetHome®