Received: by 10.223.185.116 with SMTP id b49csp2603979wrg; Mon, 12 Feb 2018 12:26:13 -0800 (PST) X-Google-Smtp-Source: AH8x225rV0r/yeRhAur5fDDiz6Wj34quPzu5PGVRZCGDvSJ1/EGJOOON9OPO0Bz/pkwWz2poIzRm X-Received: by 10.101.101.142 with SMTP id u14mr10594033pgv.429.1518467173854; Mon, 12 Feb 2018 12:26:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518467173; cv=none; d=google.com; s=arc-20160816; b=QUU8Z1olKdBLhxYA/No1mA/+CfY4vboqQm0BrWOoOg0Z11BGVuYUJKqH/qyGxAd0uj QJetz3yazrPZTQn1G3IPYfjvCO1wyczBCcnkb6hv7TCjKbH8UUm6LmcO/aXEy1uxd+SC FxWbI9bF34/ErmHD2pX3TiYn00BfhtM8wdisjVDb3nqVPhi5HFvVVxQOYJuKjZ/a048B SpvfmixGChSWwNQ1/Wh2p3Re+svg7/u+F5c4XL/p4LEmZfGFof+h+v/pYWdNKzEGh3Mk vPVV/A7YOY0iFQ1WQ2MHIp6aZmwSzEt8MzEobhZNUfj2IS1QbT+mjAjTKFmnUMoyNcgQ YgbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date :arc-authentication-results; bh=RXhRX1RKkT8auwK7D34ATWH0bFZh3E9hPYcDnTj2oZA=; b=K1Rm+PmLO2V/ilgs9caW9197elwWDjoMA6cn1ZWuWUs1+qL8N9kAuZB6V0HI6/WTm3 3kWfB+2DsX/zWG/QQs+82X98ebaAmEbpV3BgpnTk3j8AXFhHqMjCj1wzT3rUwnYmcBmF 1gRCTO1mSpQSUkS9gGBP6FEUMy5PR4QcFKNpXy7UY2nT/2e7jDBFKpg/IacfnUDdSMuI Xyx/5sr6McttsZgxMzrJwW1X9jLsY8CB++yzDslo1Mb1EfgavCs2obizt16H7GSHsiCZ KWO1GL2vgrpiplGCw97ZvYy2YtgCEETIzqVdivosHSAuh5IoydcuAekH19sItX/6h53e ttzQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si373364pfb.378.2018.02.12.12.25.59; Mon, 12 Feb 2018 12:26:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753008AbeBLUZT (ORCPT + 99 others); Mon, 12 Feb 2018 15:25:19 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52272 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751021AbeBLUZS (ORCPT ); Mon, 12 Feb 2018 15:25:18 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1CKNjkp010461 for ; Mon, 12 Feb 2018 15:25:17 -0500 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 2g3ge73t08-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 12 Feb 2018 15:25:17 -0500 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 12 Feb 2018 13:25:16 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 12 Feb 2018 13:25:12 -0700 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1CKOv457209216; Mon, 12 Feb 2018 13:25:12 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2194778037; Mon, 12 Feb 2018 13:25:12 -0700 (MST) Received: from suka-w540.localdomain (unknown [9.70.94.25]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id EC37178047; Mon, 12 Feb 2018 13:25:11 -0700 (MST) Received: by suka-w540.localdomain (Postfix, from userid 1000) id 91C09229288; Mon, 12 Feb 2018 12:25:10 -0800 (PST) Date: Mon, 12 Feb 2018 12:25:10 -0800 From: Sukadev Bhattiprolu To: Michael Ellerman Cc: Benjamin Herrenschmidt , mikey@neuling.org, hbabu@us.ibm.com, linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured References: <1518234567-24869-1-git-send-email-sukadev@linux.vnet.ibm.com> <1518234567-24869-2-git-send-email-sukadev@linux.vnet.ibm.com> <87d11awzkp.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d11awzkp.fsf@concordia.ellerman.id.au> X-Operating-System: Linux 2.0.32 on an i486 User-Agent: Mutt/1.7.1 (2016-10-04) X-TM-AS-GCONF: 00 x-cbid: 18021220-0016-0000-0000-0000083E6163 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008524; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000252; SDB=6.00988787; UDB=6.00502019; IPR=6.00768142; BA=6.00005825; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019516; XFM=3.00000015; UTC=2018-02-12 20:25:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021220-0017-0000-0000-00003D704499 Message-Id: <20180212202510.GB28183@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-12_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802120259 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michael Ellerman [mpe@ellerman.id.au] wrote: > Sukadev Bhattiprolu writes: > > > When VAS is not configured in the system, make sure to remove > > the VAS debugfs directory and unregister the platform driver. > > > > Signed-off-by: Sukadev Bhattiprolu > ... > > diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c > > index aebbe95..f83e27d8 100644 > > --- a/arch/powerpc/platforms/powernv/vas.c > > +++ b/arch/powerpc/platforms/powernv/vas.c > > @@ -169,8 +169,11 @@ static int __init vas_init(void) > > found++; > > } > > > > - if (!found) > > + if (!found) { > > + platform_driver_unregister(&vas_driver); > > + vas_cleanup_dbgdir(); > > return -ENODEV; > > + } > > The better patch would be to move the call to vas_init_dbgdir() down > here, where we know we have successfully registered the driver. Well, when VAS is configured, init_vas_instance() expects the top level "vas" debugfs dir to already be setup. We could have each init_vas_instance() assume it is the first and unconditionally call vas_init_dbgdir(). vas_init_dbgdir() could make sure to initialize only once. Or, we could make a separate pass countng "ibm,vas" nodes. If there are none, skip both steps (dbgdir and registering platform driver). Sukadev