linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: core: propagate removable attribute to driver core
@ 2023-07-25 14:17 Thomas Weißschuh
  2023-07-29 12:28 ` Avri Altman
  2023-08-07 15:51 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2023-07-25 14:17 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, linux-kernel, Christoph Hellwig, Thomas Weißschuh

Userspace can use this to distinguish hotpluggable mmc devices such as
sdcards from non-hotpluggable ones such as eMMC.
One example is the lsblk tool from util-linux.

Note that dev_set_removable() is not related to GENHD_FL_REMOVABLE which
is not applicable as per the comment in drivers/mmc/core/block.c

Link: https://github.com/util-linux/util-linux/issues/2379
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/mmc/core/bus.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 2c3074a605fc..0af96548e7da 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -310,6 +310,9 @@ int mmc_add_card(struct mmc_card *card)
 
 
 	dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);
+	dev_set_removable(&card->dev,
+			  mmc_card_is_removable(card->host) ?
+			  DEVICE_REMOVABLE : DEVICE_FIXED);
 
 	switch (card->type) {
 	case MMC_TYPE_MMC:

---
base-commit: 0b5547c51827e053cc754db47d3ec3e6c2c451d2
change-id: 20230725-mmc-removable-5cfdca9ed062

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


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

* RE: [PATCH] mmc: core: propagate removable attribute to driver core
  2023-07-25 14:17 [PATCH] mmc: core: propagate removable attribute to driver core Thomas Weißschuh
@ 2023-07-29 12:28 ` Avri Altman
  2023-08-07 15:51 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Avri Altman @ 2023-07-29 12:28 UTC (permalink / raw)
  To: Thomas Weißschuh, Ulf Hansson
  Cc: linux-mmc, linux-kernel, Christoph Hellwig

> 
> Userspace can use this to distinguish hotpluggable mmc devices such as
> sdcards from non-hotpluggable ones such as eMMC.
> One example is the lsblk tool from util-linux.
> 
> Note that dev_set_removable() is not related to GENHD_FL_REMOVABLE
> which
> is not applicable as per the comment in drivers/mmc/core/block.c
> 
> Link: https://github.com/util-linux/util-linux/issues/2379
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

> ---
>  drivers/mmc/core/bus.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 2c3074a605fc..0af96548e7da 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -310,6 +310,9 @@ int mmc_add_card(struct mmc_card *card)
> 
> 
>         dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host),
> card->rca);
> +       dev_set_removable(&card->dev,
> +                         mmc_card_is_removable(card->host) ?
> +                         DEVICE_REMOVABLE : DEVICE_FIXED);
> 
>         switch (card->type) {
>         case MMC_TYPE_MMC:
> 
> ---
> base-commit: 0b5547c51827e053cc754db47d3ec3e6c2c451d2
> change-id: 20230725-mmc-removable-5cfdca9ed062
> 
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>


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

* Re: [PATCH] mmc: core: propagate removable attribute to driver core
  2023-07-25 14:17 [PATCH] mmc: core: propagate removable attribute to driver core Thomas Weißschuh
  2023-07-29 12:28 ` Avri Altman
@ 2023-08-07 15:51 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2023-08-07 15:51 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: linux-mmc, linux-kernel, Christoph Hellwig

On Tue, 25 Jul 2023 at 16:17, Thomas Weißschuh <linux@weissschuh.net> wrote:
>
> Userspace can use this to distinguish hotpluggable mmc devices such as
> sdcards from non-hotpluggable ones such as eMMC.
> One example is the lsblk tool from util-linux.
>
> Note that dev_set_removable() is not related to GENHD_FL_REMOVABLE which
> is not applicable as per the comment in drivers/mmc/core/block.c
>
> Link: https://github.com/util-linux/util-linux/issues/2379
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/core/bus.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 2c3074a605fc..0af96548e7da 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -310,6 +310,9 @@ int mmc_add_card(struct mmc_card *card)
>
>
>         dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca);
> +       dev_set_removable(&card->dev,
> +                         mmc_card_is_removable(card->host) ?
> +                         DEVICE_REMOVABLE : DEVICE_FIXED);
>
>         switch (card->type) {
>         case MMC_TYPE_MMC:
>
> ---
> base-commit: 0b5547c51827e053cc754db47d3ec3e6c2c451d2
> change-id: 20230725-mmc-removable-5cfdca9ed062
>
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>
>

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

end of thread, other threads:[~2023-08-07 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 14:17 [PATCH] mmc: core: propagate removable attribute to driver core Thomas Weißschuh
2023-07-29 12:28 ` Avri Altman
2023-08-07 15:51 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).