From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Subject: [PATCH v2 1/5] extcon: Make the allocation and freeing to be private calls
Date: Wed, 5 Apr 2023 18:27:41 +0300 [thread overview]
Message-ID: <20230405152745.24959-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230405152745.24959-1-andriy.shevchenko@linux.intel.com>
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>
---
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)
{
--
2.40.0.1.gaa8946217a0b
next prev parent reply other threads:[~2023-04-05 15:28 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 ` Andy Shevchenko [this message]
2023-04-06 19:19 ` [PATCH v2 1/5] extcon: Make the allocation and freeing to be private calls Chanwoo Choi
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=20230405152745.24959-2-andriy.shevchenko@linux.intel.com \
--to=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