Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp891997pxb; Wed, 6 Oct 2021 18:16:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgaEyJt79fAkNLSjbAkCrExMy7HBf0EKazS5YP0OthKuk12Y2nQFesM8tFIaPAZob6g0fI X-Received: by 2002:a17:90b:3583:: with SMTP id mm3mr2135767pjb.31.1633569390750; Wed, 06 Oct 2021 18:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633569390; cv=none; d=google.com; s=arc-20160816; b=YusV0B8C72a42V8BFEPApOjxZm8ydnjiKZz3y4VvDhHKuj7vJI+1czRbmGShcP2eYM oz8CzMkqe59y4lh30F1lR6lGxI+WdAoS3jhlOB1f6n9GuzTxYCs3eNACtG9yadVY9p3c FaKKMQ7uqrMXTxbkpqD+S+9uuP6yCPIVcsjyY14xvoecsPMvfLLxe7w8UYRsKj+Bsiwv qZO63aeNvYhIzpD6lA6W+AYMpqLhQIsJtch9e5X9XTArUC7jKQFxs1qp302nNBaMkWb2 GZrGfnxe1dNUbM4GcVTMv5RrdqZEbeVL+eacowvR72YyrseWoulqkRpirYUziZPyep3P 6XVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=m1RXT0HKfhkF80qBBFrD7o1Digzwr88Vjm6uogtzkXw=; b=XbO6mgbhl9jDdxodEgYLcALcLVu5xFrH6fzFF0g+fWUO47QV5VwebfElpVnYEJL54h 0Uc3YYTcWLdF1wJCQDCD36N30KtrHDBEqNrV4NF4yEVCKU8ZOZjPLXD0TpBSnAXO7jPq QzB5o7hVv83IldviCMlIvvalvEsw3hV01p4xcuUY00hcEGx5vUDYbI4au0+U9etZkMQu rXy41ciJakbuU8AW2n/dz3sqfzXq53Y81zDfWI3zRYQgBJqamslwXDu/7/ZzYyMMYkN4 JVbPG8wT8urxYLohPwEtf9ifwIT6giou3ztNKHmLiGI19bNTUnPJ57fMJC1nZaIyjKay JfqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=gbOT1++M; 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=bewilderbeest.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q15si8371981plx.191.2021.10.06.18.16.18; Wed, 06 Oct 2021 18:16:30 -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=@bewilderbeest.net header.s=thorn header.b=gbOT1++M; 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=bewilderbeest.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240084AbhJGAMt (ORCPT + 99 others); Wed, 6 Oct 2021 20:12:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240033AbhJGAMM (ORCPT ); Wed, 6 Oct 2021 20:12:12 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EB05C061767; Wed, 6 Oct 2021 17:10:11 -0700 (PDT) Received: from hatter.bewilderbeest.net (71-212-29-146.tukw.qwest.net [71.212.29.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id B13EEB11; Wed, 6 Oct 2021 17:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1633565410; bh=m1RXT0HKfhkF80qBBFrD7o1Digzwr88Vjm6uogtzkXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gbOT1++MJbeyR+JEdu/exweu5sXz1+O20WUNQ5n+F4mEMLiTZAQDj7TPnLRB7PCnJ c/fIYdJ5gmDoeuX8WLApoapKBdA0UQ/VQteF29l3L5oUkr26LdRU5jA0lVE+gL2N0y ImJ+ORbdxfmZEa5GTX9UgHpYWwmbktXLq8xlGTl8= From: Zev Weiss To: openbmc@lists.ozlabs.org Cc: Greg Kroah-Hartman , Jeremy Kerr , Joel Stanley , Rob Herring , devicetree@vger.kernel.org, Zev Weiss , Frank Rowand , linux-kernel@vger.kernel.org Subject: [PATCH 4/9] of: add self parameter to __of_sysfs_remove_bin_file() Date: Wed, 6 Oct 2021 17:09:49 -0700 Message-Id: <20211007000954.30621-5-zev@bewilderbeest.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211007000954.30621-1-zev@bewilderbeest.net> References: <20211007000954.30621-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); /* illegal phandle value (set when unresolved) */ #define OF_PHANDLE_ILLEGAL 0xdeadbeef -- 2.33.0