[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b185c9f-7fa2-349d-9f72-3c787ac30377@huawei.com>
Date: Wed, 8 Jan 2020 16:08:44 +0000
From: John Garry <john.garry@...wei.com>
To: James Bottomley <jejb@...ux.ibm.com>,
Greg KH <gregkh@...uxfoundation.org>
CC: luojiaxing <luojiaxing@...wei.com>,
"saravanak@...gle.com" <saravanak@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linuxarm <linuxarm@...wei.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH v1] driver core: Use list_del_init to replace list_del at
device_links_purge()
On 08/01/2020 16:01, James Bottomley wrote:
>>>> cdev->dev = NULL;
>>>> return device_add(&cdev->cdev);
>>>> }
>>>> }
>>>> return -ENODEV;
>>>> }
>>> The design of the code is simply to remove the link to the inserted
>>> device which has been removed.
>>>
>>> I*think* this means the calls to device_del and device_add are
>>> unnecessary and should go. enclosure_remove_links and the put of
>>> the
>>> enclosed device should be sufficient.
>> That would make more sense than trying to "reuse" the device
>> structure
>> here by tearing it down and adding it back.
> OK, let's try that. This should be the patch if someone can try it
> (I've compile tested it, but the enclosure system is under a heap of
> stuff in the garage).
I can test it now.
But it is a bit suspicious that we had the device_del() and device_add()
at all, especially since the code change makes it look a bit more like
pre-43d8eb9cfd0 ("ses: add support for enclosure component hot removal")
John
>
> James
>
> ---
>
> diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
> index 6d27ccfe0680..3c2d405bc79b 100644
> --- a/drivers/misc/enclosure.c
> +++ b/drivers/misc/enclosure.c
> @@ -406,10 +406,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev)
> cdev = &edev->component[i];
> if (cdev->dev == dev) {
> enclosure_remove_links(cdev);
> - device_del(&cdev->cdev);
> put_device(dev);
> cdev->dev = NULL;
> - return device_add(&cdev->cdev);
> + return 0;
> }
> }
> return -ENODEV;
Powered by blists - more mailing lists