Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp995193ybl; Wed, 8 Jan 2020 09:11:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyjaV+7FpBI5Pm295eCtOTPDSyeNKL/Nras+KFRd9t2PYBEqfknClx2fsR+LM7Nb28vfpa+ X-Received: by 2002:a05:6830:1294:: with SMTP id z20mr4854051otp.60.1578503512464; Wed, 08 Jan 2020 09:11:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578503512; cv=none; d=google.com; s=arc-20160816; b=AixYQ3pphpwX5eWIsJTfXwkqrKCxQeyl2nHpPYgZJsHKBEkGSrXzd313M2Ud3vDOja Rizdy55K3mULZmMj3kpm32gIgVEabLoO1ZjQo5knDmbTyqlP7km1n53tmNEBsw75Tuwe v3TV58LG/Nk7nIJeRVDgguL6d4j8DeNlTHCnRx6ks+xfu3RiR1h/g4r6tVijDKQHOxJr yjecOdzUPHSvjrEcu+ty6jy6gaadN/rVTeBFpj3DXoNe1qOqrs7gWPK6AxZmKst4PgUq NouRLAiW0AqxuyLvtxxk+ipuK0zAyGHP+KgkjSKqMaTFXemeBCk8Xu3tKPcMKWk1iary 69Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=sCv73Va8B+FbKkGvBpN3Hx6IHsjg1UQjbuPfXCEzieA=; b=aK9UX6baOUGbeTMvglb9knsBH1MQpHUjbZeQCcUEAAbbbxPOlJYWD5+Uel90sRZiXa hfvQue+nONFONHz/SJypvwZpiUGBreEgai91ilPLIXzKRXqJumPfmx99u+jtUOEkUv6Z MokLXPGdy8suuNTsFgJOqhJsxAIjOM0W/igUSh9iqzFNMCWm5hlby8H98Lv0H4+lqnOB NL9dfY0tosM4rCym3Td2a27gYmRn505sGKxqSNyxIFkDvVTicMtwhtK4vWqEtv54g8+T JBwjnEby3IKaf3XRTQKrEzlVFWU+jG5XDK+HIZzZNsIzfhHACt0lbE1hE4rLIfIuU9RZ SsMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s68si2227354oih.275.2020.01.08.09.11.40; Wed, 08 Jan 2020 09:11:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729639AbgAHRKb (ORCPT + 99 others); Wed, 8 Jan 2020 12:10:31 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:2239 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729516AbgAHRKa (ORCPT ); Wed, 8 Jan 2020 12:10:30 -0500 Received: from LHREML710-CAH.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 6CC01DF89CB9F314160A; Wed, 8 Jan 2020 17:10:28 +0000 (GMT) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by LHREML710-CAH.china.huawei.com (10.201.108.33) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 8 Jan 2020 17:10:27 +0000 Received: from [127.0.0.1] (10.202.226.43) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 8 Jan 2020 17:10:27 +0000 Subject: Re: [PATCH v1] driver core: Use list_del_init to replace list_del at device_links_purge() From: John Garry To: James Bottomley , Greg KH CC: "Martin K . Petersen" , "linux-scsi@vger.kernel.org" , Linuxarm , "linux-kernel@vger.kernel.org" , "saravanak@google.com" , Arnd Bergmann References: <1578483244-50723-1-git-send-email-luojiaxing@huawei.com> <20200108122658.GA2365903@kroah.com> <73252c08-ac46-5d0d-23ec-16c209bd9b9a@huawei.com> <1578498695.3260.5.camel@linux.ibm.com> <20200108155700.GA2459586@kroah.com> <1578499287.3260.7.camel@linux.ibm.com> <4b185c9f-7fa2-349d-9f72-3c787ac30377@huawei.com> Message-ID: <3826a83d-a220-2f7d-59f6-efe8a4b995d7@huawei.com> Date: Wed, 8 Jan 2020 17:10:26 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <4b185c9f-7fa2-349d-9f72-3c787ac30377@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.202.226.43] X-ClientProxiedBy: lhreml729-chm.china.huawei.com (10.201.108.80) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/01/2020 16:08, John Garry wrote: > 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. > Yeah, that looks to have worked ok. SES disk locate was also fine after losing and rediscovering the disk. Thanks, John > 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; > > _______________________________________________ > Linuxarm mailing list > Linuxarm@huawei.com > http://hulk.huawei.com/mailman/listinfo/linuxarm > .