public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Martin Belanger <nitram_67@hotmail.com>
Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org, hare@suse.de,
	axboe@fb.com, hch@lst.de, sagi@grimberg.me, rafael@kernel.org,
	charles_rose@dell.com, stuart_hayes@dell.com,
	Martin Belanger <martin.belanger@dell.com>
Subject: Re: [PATCHv2 2/3] nvme: Add device_update_groups()
Date: Fri, 4 Feb 2022 08:42:15 +0100	[thread overview]
Message-ID: <YfzY1/LeVNCSdWs2@kroah.com> (raw)
In-Reply-To: <BL0PR13MB42916EA4483338B4BD37BA3E9C289@BL0PR13MB4291.namprd13.prod.outlook.com>

On Thu, Feb 03, 2022 at 04:17:47PM -0500, Martin Belanger wrote:
> From: Martin Belanger <martin.belanger@dell.com>
> 
> This is used to update the sysfs groups after device objects are fully
> initialized.

Ick, no, why?

What needs this and how is userspace going to handle groups changing
after the device is already announced to userspace?


> 
> Signed-off-by: Martin Belanger <martin.belanger@dell.com>
> ---
>  drivers/base/core.c    | 28 ++++++++++++++++++++++++++++
>  include/linux/device.h |  1 +
>  2 files changed, 29 insertions(+)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 3d6430eb0c6a..0b5f6d5d2459 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4473,6 +4473,34 @@ int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
>  }
>  EXPORT_SYMBOL_GPL(device_change_owner);
>  
> +/**
> + * device_update_groups - update the sysfs groups
> + * @dev: device.
> + *
> + * Returns 0 on success or error code on failure.
> + */
> +int device_update_groups(struct device *dev)
> +{
> +	struct class *class = dev->class;
> +	const struct device_type *type = dev->type;
> +	int error;
> +
> +	if (class) {
> +		error = sysfs_update_groups(&dev->kobj, class->dev_groups);

So you added new groups based on the class for the device after it was
registered?

That feels really wrong.


> +		if (error)
> +			return error;
> +	}
> +
> +	if (type) {
> +		error = sysfs_update_groups(&dev->kobj, type->groups);

How can the type groups have changed for the device after it was
registered?

What problem are you trying to solve here that requires this?  How are
you changing the groups for a class or type after a device is
registered?

confused,

greg k-h


  parent reply	other threads:[~2022-02-04  7:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220203211748.27542-1-nitram_67@hotmail.com>
2022-02-03 21:17 ` [PATCHv2 1/3] nvme: send uevent on connection up Martin Belanger
2022-02-03 21:17 ` [PATCHv2 2/3] nvme: Add device_update_groups() Martin Belanger
2022-02-04  2:22   ` Chaitanya Kulkarni
2022-02-04  7:04   ` driver core patch, was " Christoph Hellwig
2022-02-04  7:45     ` Greg KH
2022-02-04  7:31   ` Hannes Reinecke
2022-02-04  7:42   ` Greg KH [this message]
2022-02-03 21:17 ` [PATCHv2 3/3] nvme: Expose cntrltype and dctype through sysfs Martin Belanger
2022-02-04  7:32   ` Hannes Reinecke
2022-02-04  7:43   ` Greg KH
2022-02-04  7:45   ` Greg KH
2022-02-04 13:51     ` Belanger, Martin
2022-02-04 14:05       ` Greg KH
2022-02-06  9:09         ` Sagi Grimberg
2022-02-06 12:02           ` Greg KH
2022-02-06 15:55             ` Sagi Grimberg
2022-02-06  8:54     ` Sagi Grimberg
2022-02-06 12:00       ` Greg KH
2022-02-06 13:08       ` Hannes Reinecke
2022-02-06 13:15         ` Greg KH

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=YfzY1/LeVNCSdWs2@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=axboe@fb.com \
    --cc=charles_rose@dell.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.belanger@dell.com \
    --cc=nitram_67@hotmail.com \
    --cc=rafael@kernel.org \
    --cc=sagi@grimberg.me \
    --cc=stuart_hayes@dell.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