[PATCH 2/4] siox: Provide a devm variant of siox_master_alloc()

Uwe Kleine-König posted 4 patches 1 year, 11 months ago
[PATCH 2/4] siox: Provide a devm variant of siox_master_alloc()
Posted by Uwe Kleine-König 1 year, 11 months ago
This allows to simplify siox master drivers in the next step.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/siox/siox-core.c | 24 ++++++++++++++++++++++++
 drivers/siox/siox.h      |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
index d4acab7036d6..9dd0bda03db3 100644
--- a/drivers/siox/siox-core.c
+++ b/drivers/siox/siox-core.c
@@ -707,6 +707,30 @@ struct siox_master *siox_master_alloc(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(siox_master_alloc);
 
+static void devm_siox_master_put(void *data)
+{
+	struct siox_master *smaster = data;
+
+	siox_master_put(smaster);
+}
+
+struct siox_master *devm_siox_master_alloc(struct device *dev,
+					   size_t size)
+{
+	struct siox_master *smaster;
+	int ret;
+
+	smaster = siox_master_alloc(dev, size);
+	if (!smaster)
+		return NULL;
+
+	ret = devm_add_action_or_reset(dev, devm_siox_master_put, smaster);
+	if (ret)
+		return NULL;
+
+	return smaster;
+}
+
 int siox_master_register(struct siox_master *smaster)
 {
 	int ret;
diff --git a/drivers/siox/siox.h b/drivers/siox/siox.h
index f08b43b713c5..b227e18b697a 100644
--- a/drivers/siox/siox.h
+++ b/drivers/siox/siox.h
@@ -45,5 +45,7 @@ static inline void siox_master_put(struct siox_master *smaster)
 	put_device(&smaster->dev);
 }
 
+struct siox_master *devm_siox_master_alloc(struct device *dev, size_t size);
+
 int siox_master_register(struct siox_master *smaster);
 void siox_master_unregister(struct siox_master *smaster);
-- 
2.43.0

Re: [PATCH 2/4] siox: Provide a devm variant of siox_master_alloc()
Posted by Uwe Kleine-König 1 year, 11 months ago
Hello,

On Mon, Feb 19, 2024 at 08:46:30AM +0100, Uwe Kleine-König wrote:
> +struct siox_master *devm_siox_master_alloc(struct device *dev,
> +					   size_t size)
> +{
> +	struct siox_master *smaster;
> +	int ret;
> +
> +	smaster = siox_master_alloc(dev, size);
> +	if (!smaster)
> +		return NULL;
> +
> +	ret = devm_add_action_or_reset(dev, devm_siox_master_put, smaster);
> +	if (ret)
> +		return NULL;
> +
> +	return smaster;
> +}

Here is missing an EXPORT_SYMBOL_GPL for devm_siox_master_alloc(). I
squashed this into to commit I created. Find the fixed commit at

	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git siox/for-next

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Re: [PATCH 2/4] siox: Provide a devm variant of siox_master_alloc()
Posted by Greg Kroah-Hartman 1 year, 11 months ago
On Thu, Mar 07, 2024 at 08:13:55AM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Mon, Feb 19, 2024 at 08:46:30AM +0100, Uwe Kleine-König wrote:
> > +struct siox_master *devm_siox_master_alloc(struct device *dev,
> > +					   size_t size)
> > +{
> > +	struct siox_master *smaster;
> > +	int ret;
> > +
> > +	smaster = siox_master_alloc(dev, size);
> > +	if (!smaster)
> > +		return NULL;
> > +
> > +	ret = devm_add_action_or_reset(dev, devm_siox_master_put, smaster);
> > +	if (ret)
> > +		return NULL;
> > +
> > +	return smaster;
> > +}
> 
> Here is missing an EXPORT_SYMBOL_GPL for devm_siox_master_alloc(). I
> squashed this into to commit I created. Find the fixed commit at
> 
> 	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git siox/for-next

Can you send me a "real" git pull request so that I can verify it is
what you say it is (ideally with a signed tag)?

thanks,

greg k-h
Re: [PATCH 2/4] siox: Provide a devm variant of siox_master_alloc()
Posted by Uwe Kleine-König 1 year, 11 months ago
Hello Greg,

On Thu, Mar 07, 2024 at 07:29:59AM +0000, Greg Kroah-Hartman wrote:
> On Thu, Mar 07, 2024 at 08:13:55AM +0100, Uwe Kleine-König wrote:
> > On Mon, Feb 19, 2024 at 08:46:30AM +0100, Uwe Kleine-König wrote:
> > > +struct siox_master *devm_siox_master_alloc(struct device *dev,
> > > +					   size_t size)
> > > +{
> > > +	struct siox_master *smaster;
> > > +	int ret;
> > > +
> > > +	smaster = siox_master_alloc(dev, size);
> > > +	if (!smaster)
> > > +		return NULL;
> > > +
> > > +	ret = devm_add_action_or_reset(dev, devm_siox_master_put, smaster);
> > > +	if (ret)
> > > +		return NULL;
> > > +
> > > +	return smaster;
> > > +}
> > 
> > Here is missing an EXPORT_SYMBOL_GPL for devm_siox_master_alloc(). I
> > squashed this into to commit I created. Find the fixed commit at
> > 
> > 	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git siox/for-next
> 
> Can you send me a "real" git pull request so that I can verify it is
> what you say it is (ideally with a signed tag)?

Sure, can do. I will do that tomorrow when (and if) my branch is in next
and so got a bit more exposure.

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
[PULL] siox changes for 6.9
Posted by Uwe Kleine-König 1 year, 11 months ago
Hello Greg,

On Thu, Mar 07, 2024 at 09:38:07AM +0100, Uwe Kleine-König wrote:
> On Thu, Mar 07, 2024 at 07:29:59AM +0000, Greg Kroah-Hartman wrote:
> > Can you send me a "real" git pull request so that I can verify it is
> > what you say it is (ideally with a signed tag)?
> 
> Sure, can do. I will do that tomorrow when (and if) my branch is in next
> and so got a bit more exposure.

That has worked so far. So here comes the requested pull request. I
dropped the two patches you collected in the meantime in your
char-misc-next branch. The two branches (i.e. your char-misc-next and
this PR's tag) merge without conflict.

The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:

  Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git tags/siox/for-greg-6.9-rc1

for you to fetch changes up to db418d5f1ca5b7bafc8eaa9393ea18a7901bb0ed:

  siox: bus-gpio: Simplify using devm_siox_* functions (2024-03-08 22:01:10 +0100)

Please pull this for the 6.9-rc1 merge window.

Thanks
Uwe

----------------------------------------------------------------
SIOX changes for 6.9-rc1

These patches rework how siox device registration works. This allows to
simplify the gpio bus driver using two new devm functions.

----------------------------------------------------------------
Uwe Kleine-König (4):
      siox: Don't pass the reference on a master in siox_master_register()
      siox: Provide a devm variant of siox_master_alloc()
      siox: Provide a devm variant of siox_master_register()
      siox: bus-gpio: Simplify using devm_siox_* functions

 drivers/siox/siox-bus-gpio.c | 62 ++++++++++++++------------------------------
 drivers/siox/siox-core.c     | 46 ++++++++++++++++++++++++++++++++
 drivers/siox/siox.h          |  4 +++
 3 files changed, 70 insertions(+), 42 deletions(-)

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Re: [PULL] siox changes for 6.9
Posted by Uwe Kleine-König 1 year, 11 months ago
Hello Greg,

[Cc += Linus]

On Fri, Mar 08, 2024 at 10:20:05PM +0100, Uwe Kleine-König wrote:
> On Thu, Mar 07, 2024 at 09:38:07AM +0100, Uwe Kleine-König wrote:
> > On Thu, Mar 07, 2024 at 07:29:59AM +0000, Greg Kroah-Hartman wrote:
> > > Can you send me a "real" git pull request so that I can verify it is
> > > what you say it is (ideally with a signed tag)?
> > 
> > Sure, can do. I will do that tomorrow when (and if) my branch is in next
> > and so got a bit more exposure.
> 
> That has worked so far. So here comes the requested pull request. I
> dropped the two patches you collected in the meantime in your
> char-misc-next branch. The two branches (i.e. your char-misc-next and
> this PR's tag) merge without conflict.
> 
> The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:
> 
>   Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)
> 
> are available in the Git repository at:
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git tags/siox/for-greg-6.9-rc1
> 
> for you to fetch changes up to db418d5f1ca5b7bafc8eaa9393ea18a7901bb0ed:
> 
>   siox: bus-gpio: Simplify using devm_siox_* functions (2024-03-08 22:01:10 +0100)
> 
> Please pull this for the 6.9-rc1 merge window.

I didn't hear anything back from you and wonder if there is still a
chance to get this in. I guess that's just you being busy with other
(and more important) stuff. Would it help you if I sent a pull request
to Linus directly?

The changes are in next leading to db418d5f1ca5 since next-20240308. (As
db418d5f1ca since next-20240312, I rebased as two of the six siox
patches got into char-misc-next that were picked up directly from the
mailing list. Before the rebase it was 4ab973203404.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Re: [PULL] siox changes for 6.9
Posted by Uwe Kleine-König 1 year, 10 months ago
Hello Greg,

On Sat, Mar 16, 2024 at 08:37:04AM +0100, Uwe Kleine-König wrote:
> On Fri, Mar 08, 2024 at 10:20:05PM +0100, Uwe Kleine-König wrote:
> > On Thu, Mar 07, 2024 at 09:38:07AM +0100, Uwe Kleine-König wrote:
> > > On Thu, Mar 07, 2024 at 07:29:59AM +0000, Greg Kroah-Hartman wrote:
> > > > Can you send me a "real" git pull request so that I can verify it is
> > > > what you say it is (ideally with a signed tag)?
> > > 
> > > Sure, can do. I will do that tomorrow when (and if) my branch is in next
> > > and so got a bit more exposure.
> > 
> > That has worked so far. So here comes the requested pull request. I
> > dropped the two patches you collected in the meantime in your
> > char-misc-next branch. The two branches (i.e. your char-misc-next and
> > this PR's tag) merge without conflict.
> > 
> > The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:
> > 
> >   Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)
> > 
> > are available in the Git repository at:
> > 
> >   https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git tags/siox/for-greg-6.9-rc1
> > 
> > for you to fetch changes up to db418d5f1ca5b7bafc8eaa9393ea18a7901bb0ed:
> > 
> >   siox: bus-gpio: Simplify using devm_siox_* functions (2024-03-08 22:01:10 +0100)
> > 
> > Please pull this for the 6.9-rc1 merge window.
> 
> I didn't hear anything back from you and wonder if there is still a
> chance to get this in. I guess that's just you being busy with other
> (and more important) stuff. Would it help you if I sent a pull request
> to Linus directly?
> 
> The changes are in next leading to db418d5f1ca5 since next-20240308. (As
> db418d5f1ca since next-20240312, I rebased as two of the six siox
> patches got into char-misc-next that were picked up directly from the
> mailing list. Before the rebase it was 4ab973203404.)

You probably saw me being impatient and sending the PR to Linus
directly. If not: These changes are already in the mainline now
(00453419575d6b4f5ce0f370da9421cf5253f103) and this is the thread you
can drop from your todo list. I removed the above tag from my repository
to (hopefully) prevent future confusion.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Re: [PULL] siox changes for 6.9
Posted by Greg Kroah-Hartman 1 year, 10 months ago
On Fri, Mar 22, 2024 at 08:22:16AM +0100, Uwe Kleine-König wrote:
> Hello Greg,
> 
> On Sat, Mar 16, 2024 at 08:37:04AM +0100, Uwe Kleine-König wrote:
> > On Fri, Mar 08, 2024 at 10:20:05PM +0100, Uwe Kleine-König wrote:
> > > On Thu, Mar 07, 2024 at 09:38:07AM +0100, Uwe Kleine-König wrote:
> > > > On Thu, Mar 07, 2024 at 07:29:59AM +0000, Greg Kroah-Hartman wrote:
> > > > > Can you send me a "real" git pull request so that I can verify it is
> > > > > what you say it is (ideally with a signed tag)?
> > > > 
> > > > Sure, can do. I will do that tomorrow when (and if) my branch is in next
> > > > and so got a bit more exposure.
> > > 
> > > That has worked so far. So here comes the requested pull request. I
> > > dropped the two patches you collected in the meantime in your
> > > char-misc-next branch. The two branches (i.e. your char-misc-next and
> > > this PR's tag) merge without conflict.
> > > 
> > > The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:
> > > 
> > >   Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)
> > > 
> > > are available in the Git repository at:
> > > 
> > >   https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git tags/siox/for-greg-6.9-rc1
> > > 
> > > for you to fetch changes up to db418d5f1ca5b7bafc8eaa9393ea18a7901bb0ed:
> > > 
> > >   siox: bus-gpio: Simplify using devm_siox_* functions (2024-03-08 22:01:10 +0100)
> > > 
> > > Please pull this for the 6.9-rc1 merge window.
> > 
> > I didn't hear anything back from you and wonder if there is still a
> > chance to get this in. I guess that's just you being busy with other
> > (and more important) stuff. Would it help you if I sent a pull request
> > to Linus directly?
> > 
> > The changes are in next leading to db418d5f1ca5 since next-20240308. (As
> > db418d5f1ca since next-20240312, I rebased as two of the six siox
> > patches got into char-misc-next that were picked up directly from the
> > mailing list. Before the rebase it was 4ab973203404.)
> 
> You probably saw me being impatient and sending the PR to Linus
> directly. If not: These changes are already in the mainline now
> (00453419575d6b4f5ce0f370da9421cf5253f103) and this is the thread you
> can drop from your todo list. I removed the above tag from my repository
> to (hopefully) prevent future confusion.

No worries, I see this is all in Linus's tree.  Sorry for the delay, I
was actually on vacation for once and didn't have the chance to do all
of this (and to be fair, you asked for the pull request way too late...)

thanks,

greg k-h
Re: [PULL] siox changes for 6.9
Posted by Uwe Kleine-König 1 year, 10 months ago
Hey Greg,

On Fri, Mar 22, 2024 at 08:31:15AM +0100, Greg Kroah-Hartman wrote:
> On Fri, Mar 22, 2024 at 08:22:16AM +0100, Uwe Kleine-König wrote:
> > You probably saw me being impatient and sending the PR to Linus
> > directly. If not: These changes are already in the mainline now
> > (00453419575d6b4f5ce0f370da9421cf5253f103) and this is the thread you
> > can drop from your todo list. I removed the above tag from my repository
> > to (hopefully) prevent future confusion.
> 
> No worries, I see this is all in Linus's tree.  Sorry for the delay, I
> was actually on vacation for once and didn't have the chance to do all
> of this

No need to be sorry. There are no hard feelings on my side. It's
important for indiviuals and also for the project that key persons are
not available at times.

> (and to be fair, you asked for the pull request way too late...)

I sent the pull request the day following you requesting it. If the
timing is so tight, a note about that would be helpful. (No offence
intended!)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |