Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1035308pxb; Wed, 6 Oct 2021 22:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjhKMnV79EZlubomLZ4cH2r5Yp+Jf2gdAfq2fbgEJ7C4tUlYTIiq3qpb1w7VHrGd44jbEe X-Received: by 2002:a17:906:b6d0:: with SMTP id ec16mr3226034ejb.229.1633584482282; Wed, 06 Oct 2021 22:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633584482; cv=none; d=google.com; s=arc-20160816; b=bPk/XLTloC++/9kMAInYrHimtqC7OhFHm5ZEgvMLJaJzDIcpNIO8pspGd+t0kq2iAS qSLl1Id2RykLNOL6zKnvUmpXqVZ66JDQRHrzQk9GRDNt3DcrCDLxHxC/dzreshw8MmRA KGCkYy/+G8IeucWPOJDd1RsVyXChS68No05312PsZthyqBtG2i8Y198KQOyGMmnRfO3d bx8PXLx6CzGRcUxcZpqCNKHPn/s6nnVdkSgkPmzwFflV9fUHJ1RCyPqriE/ZbA/YNEIs 72+o67OcaOoFDuH2xSsd92ch4KQUi1aa4PdI0vT/Bk3toyGe4GCVes2FEg36/JEeboqq AjSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pYaWvRXn37P8BD/yAtHE6cIrxKR4YrvdsM/UUB1Uo4M=; b=Qea9URCuNEZbD7JPiCi2WJPmAAdOhDJ8aCdOulziArXkERkZwkZ/EL9HOwdBgXFxQF JsU1/c1mv5wH35LGf0ehelToWqIqvYfvs6tZ0B60BZZgqY9dMp1CVFuIrH1NN5bb6vL0 9jVkMu0ekdt+tfHhqLsY+kFbaPQkdL/91HVqW6bTm/m92Sw0iT3VHOIL6LNDa6oO2CLu Le24Ax0YIuG0koH2uavSy5uDf/7oB0rEsoeZHDviYCfBC1/DV01bYVNkdHgnZsz68ORJ vrdGvayfN212GjgOPPU7n/xGf9OYtjzrYhSAQIXCmXiYBlHseHK5A6LYY0jshjrjioay Q7Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YsPZWJif; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si36266142ejy.596.2021.10.06.22.27.26; Wed, 06 Oct 2021 22:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YsPZWJif; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232160AbhJGF1G (ORCPT + 99 others); Thu, 7 Oct 2021 01:27:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbhJGF1F (ORCPT ); Thu, 7 Oct 2021 01:27:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B6B06120D; Thu, 7 Oct 2021 05:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633584312; bh=bD5PfoEo/tEYlEn8Ehu6qpmPGIYWbDXQp6oPPjygNFQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YsPZWJifT+sYj6zmxfKZ+ZGfxMjSLlehEpmcTQMgv0X6MXKP2f8YGlVr53D17c9z2 xNUU/PQbBTBXWbvQ6fIlQZRj1y0G5/sB0iBM7/Xd9IaOEBV6sAh6z44QqNG3R5FwOp wdcesGlLyp3Dyofm01Q+TAcv1J9NFoxcb1oilmro= Date: Thu, 7 Oct 2021 07:25:09 +0200 From: Greg Kroah-Hartman To: Zev Weiss Cc: openbmc@lists.ozlabs.org, Jeremy Kerr , Joel Stanley , Rob Herring , devicetree@vger.kernel.org, Frank Rowand , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/9] of: add self parameter to __of_sysfs_remove_bin_file() Message-ID: References: <20211007000954.30621-1-zev@bewilderbeest.net> <20211007000954.30621-5-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211007000954.30621-5-zev@bewilderbeest.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 06, 2021 at 05:09:49PM -0700, Zev Weiss wrote: > This allows using the function to remove a bin_attribute from that > attribute's own methods (by calling sysfs_remove_bin_file_self() > instead of sysfs_remove_bin_file()). > > Signed-off-by: Zev Weiss > --- > drivers/of/kobj.c | 13 ++++++++----- > drivers/of/of_private.h | 2 +- > 2 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c > index 6675b5e56960..06d6c90f7aa1 100644 > --- a/drivers/of/kobj.c > +++ b/drivers/of/kobj.c > @@ -84,12 +84,15 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) > return rc; > } > > -void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop) > +void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop, bool self) > { > if (!IS_ENABLED(CONFIG_SYSFS)) > return; > > - sysfs_remove_bin_file(&np->kobj, &prop->attr); > + if (self) > + sysfs_remove_bin_file_self(&np->kobj, &prop->attr); > + else > + sysfs_remove_bin_file(&np->kobj, &prop->attr); > kfree(prop->attr.attr.name); > } > > @@ -97,7 +100,7 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop) > { > /* at early boot, bail here and defer setup to of_init() */ > if (of_kset && of_node_is_attached(np)) > - __of_sysfs_remove_bin_file(np, prop); > + __of_sysfs_remove_bin_file(np, prop, false); > } > > void __of_update_property_sysfs(struct device_node *np, struct property *newprop, > @@ -108,7 +111,7 @@ void __of_update_property_sysfs(struct device_node *np, struct property *newprop > return; > > if (oldprop) > - __of_sysfs_remove_bin_file(np, oldprop); > + __of_sysfs_remove_bin_file(np, oldprop, false); > __of_add_property_sysfs(np, newprop); > } > > @@ -157,7 +160,7 @@ void __of_detach_node_sysfs(struct device_node *np) > /* only remove properties if on sysfs */ > if (of_node_is_attached(np)) { > for_each_property_of_node(np, pp) > - __of_sysfs_remove_bin_file(np, pp); > + __of_sysfs_remove_bin_file(np, pp, false); > kobject_del(&np->kobj); > } > > diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h > index 75e67b8bb826..fff157c63907 100644 > --- a/drivers/of/of_private.h > +++ b/drivers/of/of_private.h > @@ -134,7 +134,7 @@ extern int __of_update_property(struct device_node *np, > extern void __of_detach_node(struct device_node *np); > > extern void __of_sysfs_remove_bin_file(struct device_node *np, > - struct property *prop); > + struct property *prop, bool selfremove); Ick, no, now you have to go and find the function declaration every time you see this called. Adding random boolean flags to functions is not how to make an api that works well, sorry. greg k-h