All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: document mmc_hw_reset
@ 2020-09-16  9:01 Wolfram Sang
  2020-09-16  9:47 ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2020-09-16  9:01 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang

Add documentation for mmc_hw_reset to make sure the intended use case is
clear.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

While working on this, I get the feeling this function should be renamed
to 'mmc_card_reset' or something similar. 'hw' is still confusing
because it could easily be the host controller, too. I volunteer to
prepare a patch if we can agree on a better name.

 drivers/mmc/core/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8ccae6452b9c..a9ad72a18d1b 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2063,6 +2063,16 @@ static void mmc_hw_reset_for_init(struct mmc_host *host)
 	host->ops->hw_reset(host);
 }
 
+/**
+ * mmc_hw_reset - reset the card
+ * @host: MMC host to which the card is attached
+ *
+ * Reset the remote card. This function is only for upper layers, like the
+ * block layer or card drivers. You cannot use it in host drivers (struct
+ * mmc_card might be gone then).
+ *
+ * Return: 0 on success, -errno on failure
+ */
 int mmc_hw_reset(struct mmc_host *host)
 {
 	int ret;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: document mmc_hw_reset
  2020-09-16  9:01 [PATCH] mmc: core: document mmc_hw_reset Wolfram Sang
@ 2020-09-16  9:47 ` Ulf Hansson
  2020-09-18 21:47   ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2020-09-16  9:47 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc

On Wed, 16 Sep 2020 at 11:01, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Add documentation for mmc_hw_reset to make sure the intended use case is
> clear.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> While working on this, I get the feeling this function should be renamed
> to 'mmc_card_reset' or something similar. 'hw' is still confusing
> because it could easily be the host controller, too. I volunteer to
> prepare a patch if we can agree on a better name.

You have a point. Although we also have mmc_sw_reset().

Another thing that I would like to change is to make both of these
functions take a struct mmc_card* as in-parameter, rather than the
current struct mmc_host*.

Not sure that it would completely solve the confusion, but at least it
would be a little more clear.

>
>  drivers/mmc/core/core.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 8ccae6452b9c..a9ad72a18d1b 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2063,6 +2063,16 @@ static void mmc_hw_reset_for_init(struct mmc_host *host)
>         host->ops->hw_reset(host);
>  }
>
> +/**
> + * mmc_hw_reset - reset the card
> + * @host: MMC host to which the card is attached
> + *
> + * Reset the remote card. This function is only for upper layers, like the

Perhaps make it clear that it's a full (or hw) reset, not just a reset
(as it could also be a soft reset). Moreover, I think you can skip
"remote".

> + * block layer or card drivers. You cannot use it in host drivers (struct
> + * mmc_card might be gone then).
> + *
> + * Return: 0 on success, -errno on failure
> + */
>  int mmc_hw_reset(struct mmc_host *host)
>  {
>         int ret;
> --
> 2.28.0
>

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: document mmc_hw_reset
  2020-09-16  9:47 ` Ulf Hansson
@ 2020-09-18 21:47   ` Wolfram Sang
  2020-09-24 12:49     ` Ulf Hansson
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2020-09-18 21:47 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]

On Wed, Sep 16, 2020 at 11:47:10AM +0200, Ulf Hansson wrote:
> On Wed, 16 Sep 2020 at 11:01, Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> >
> > Add documentation for mmc_hw_reset to make sure the intended use case is
> > clear.
> >
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > ---
> >
> > While working on this, I get the feeling this function should be renamed
> > to 'mmc_card_reset' or something similar. 'hw' is still confusing
> > because it could easily be the host controller, too. I volunteer to
> > prepare a patch if we can agree on a better name.
> 
> You have a point. Although we also have mmc_sw_reset().

Ah, I didn't know that. Though, mmc_card_{hw|sw}_reset() sounds still
way better to me.

> Another thing that I would like to change is to make both of these
> functions take a struct mmc_card* as in-parameter, rather than the
> current struct mmc_host*.
> 
> Not sure that it would completely solve the confusion, but at least it
> would be a little more clear.

Maybe if we do both, it will be really clear? :)

> > +/**
> > + * mmc_hw_reset - reset the card
> > + * @host: MMC host to which the card is attached
> > + *
> > + * Reset the remote card. This function is only for upper layers, like the
> 
> Perhaps make it clear that it's a full (or hw) reset, not just a reset
> (as it could also be a soft reset). Moreover, I think you can skip
> "remote".

OK, will send V2 in a minute.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: core: document mmc_hw_reset
  2020-09-18 21:47   ` Wolfram Sang
@ 2020-09-24 12:49     ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2020-09-24 12:49 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc

On Fri, 18 Sep 2020 at 23:48, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Wed, Sep 16, 2020 at 11:47:10AM +0200, Ulf Hansson wrote:
> > On Wed, 16 Sep 2020 at 11:01, Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> > >
> > > Add documentation for mmc_hw_reset to make sure the intended use case is
> > > clear.
> > >
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > ---
> > >
> > > While working on this, I get the feeling this function should be renamed
> > > to 'mmc_card_reset' or something similar. 'hw' is still confusing
> > > because it could easily be the host controller, too. I volunteer to
> > > prepare a patch if we can agree on a better name.
> >
> > You have a point. Although we also have mmc_sw_reset().
>
> Ah, I didn't know that. Though, mmc_card_{hw|sw}_reset() sounds still
> way better to me.

I fully agree.

>
> > Another thing that I would like to change is to make both of these
> > functions take a struct mmc_card* as in-parameter, rather than the
> > current struct mmc_host*.
> >
> > Not sure that it would completely solve the confusion, but at least it
> > would be a little more clear.
>
> Maybe if we do both, it will be really clear? :)

Makes perfect sense to me.

>
> > > +/**
> > > + * mmc_hw_reset - reset the card
> > > + * @host: MMC host to which the card is attached
> > > + *
> > > + * Reset the remote card. This function is only for upper layers, like the
> >
> > Perhaps make it clear that it's a full (or hw) reset, not just a reset
> > (as it could also be a soft reset). Moreover, I think you can skip
> > "remote".
>
> OK, will send V2 in a minute.
>

I have applied that one. Let's deal with potential additional
improvements on top.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-24 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16  9:01 [PATCH] mmc: core: document mmc_hw_reset Wolfram Sang
2020-09-16  9:47 ` Ulf Hansson
2020-09-18 21:47   ` Wolfram Sang
2020-09-24 12:49     ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.