linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: mmc@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
	linux-serial@vger.kernel.org, brking@pobox.com
Subject: Re: [PATCH 3/6] hvcs: Remove sysfs group earlier
Date: Wed, 1 Feb 2023 21:04:35 +0100	[thread overview]
Message-ID: <Y9rF01SQ91VBjFa9@kroah.com> (raw)
In-Reply-To: <20230201195743.303163-4-brking@linux.vnet.ibm.com>

On Wed, Feb 01, 2023 at 01:57:40PM -0600, Brian King wrote:
> Cleanup the sysfs group earlier in remove. This eliminates
> errors coming from kernfs when attempting to remove a console
> device that is in use.
> 
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> ---
>  drivers/tty/hvc/hvcs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
> index 9131dcb2e8d8..9c5887d0c882 100644
> --- a/drivers/tty/hvc/hvcs.c
> +++ b/drivers/tty/hvc/hvcs.c
> @@ -688,8 +688,6 @@ static void hvcs_destruct_port(struct tty_port *p)
>  	spin_unlock_irqrestore(&hvcsd->lock, flags);
>  	spin_unlock(&hvcs_structs_lock);
>  
> -	sysfs_remove_group(&vdev->dev.kobj, &hvcs_attr_group);
> -
>  	kfree(hvcsd);
>  }
>  
> @@ -814,6 +812,8 @@ static void hvcs_remove(struct vio_dev *dev)
>  	 */
>  	tty_port_put(&hvcsd->port);
>  
> +	sysfs_remove_group(&dev->dev.kobj, &hvcs_attr_group);
> +

Why is this needed at all?  The files should be auto-removed when the
device is removed, right?

And calling sysfs_*() functions from a driver is a huge hint that
something is wrong here.  Worst case, this should be calling
device_remove_group(), but really, the default groups pointer should be
set and then you don't have to add/remove anything, it will all happen
automatically for you by the driver core at the properly place and time.

Can you do that instead of this change?  That should fix it all up
properly.

thanks,

greg k-h

  reply	other threads:[~2023-02-01 20:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 19:57 [PATCH 0/6] hvcs: Various hvcs device hotplug fixes Brian King
2023-02-01 19:57 ` [PATCH 1/6] hvcs: Fix hvcs port reference counting Brian King
2023-02-01 19:57 ` [PATCH 2/6] hvcs: Remove sysfs file prior to vio unregister Brian King
2023-02-01 20:05   ` Greg KH
2023-02-01 19:57 ` [PATCH 3/6] hvcs: Remove sysfs group earlier Brian King
2023-02-01 20:04   ` Greg KH [this message]
2023-02-01 19:57 ` [PATCH 4/6] hvcs: Get reference to tty in remove Brian King
2023-02-01 19:57 ` [PATCH 5/6] hvcs: Use vhangup in hotplug remove Brian King
2023-02-01 19:57 ` [PATCH 6/6] hvcs: Synchronize hotplug remove with port free Brian King

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=Y9rF01SQ91VBjFa9@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=brking@linux.vnet.ibm.com \
    --cc=brking@pobox.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mmc@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).