Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7013857rwp; Tue, 18 Jul 2023 08:50:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlG09uP0RyFT0FX1PUB9fiDEQ9mAWOIKKzB83ivfZzyGfNXfUN2xcA7kVyb76OX+9wjiojW6 X-Received: by 2002:ac2:43c7:0:b0:4f9:6528:fb1e with SMTP id u7-20020ac243c7000000b004f96528fb1emr14451038lfl.51.1689695418255; Tue, 18 Jul 2023 08:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689695418; cv=none; d=google.com; s=arc-20160816; b=N94PY0+gtEL2a7ErB20lnZKBqTjHh8u8KEIJtQfDWhh/IXXmvFntkiatjyxA58+OIP /T3Owqxd4khsG92CoeeUXJ6HhnqxK47xj02uSMuCEuoBn3HXpwBZlsJWDoBWmX7ZLiYw t6BStcaeCjx2HOmbQQ4qCm/4oflb01bYnzD3Ay+dzerG9VEdeNBPV2VrFuZQayEqv2tR 4CDePOdwDcA97qeHIKYanqMs38sUZqMBLp9BTLyerGBqHiy7fWovrSbJe8LwmklSBsjV rYkDLpOFVy66WHteTeJVZnau+j4Q2xqtF/qURGJaUJEYMOSbCM5nDZENlTyQEVS0F4zN lpgQ== 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; bh=Ogca6oDwSF/jF6WPZhqU5HgDe1JP3YkcPpEYHWuntoM=; fh=Jui9p0NBcRKPG1sfEV1p0CUJ/hOxH5uYABb6IznSxBs=; b=g/khIu9eZ6YRPXKkt+pbtrEefdLaLDKCX0Kt3O4tmvN1L0x3OhCKvIU/EHG2KhIORZ g4Izi+QEVXlSxnlo+tfdcTBex/+fs3VZRu1WqEdqu3Wz2iwSx+QeqYacbwqlMwPxggQx 8T3oCEQqKQYk4I/oqbXrTqgAuxEywwyqu6XGzLhN1DaFAt9n+xcML9qBu4jFmfLQWRt2 BqDeEFnN5TQgUkUOSnSdOhWQfB+fVLgwLbH207P04Vlby9FWZ0TX4dRfLby+9lQVG+jd e9QNbBE9E93gdpVZ43WdAmPl1bA5Nr7mmzPYMBx1uosQfp/tnfOWG5GRQVeiwmlBdVL+ KEcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020aa7da11000000b0051e23edcddcsi1419839eds.122.2023.07.18.08.49.53; Tue, 18 Jul 2023 08:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232019AbjGRP30 (ORCPT + 99 others); Tue, 18 Jul 2023 11:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233637AbjGRP3Y (ORCPT ); Tue, 18 Jul 2023 11:29:24 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1046A1723 for ; Tue, 18 Jul 2023 08:29:20 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qLmdW-00007C-2y; Tue, 18 Jul 2023 15:29:15 +0000 Date: Tue, 18 Jul 2023 16:29:07 +0100 From: Daniel Golle To: Srinivas Kandagatla Cc: Miquel Raynal , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] nvmem: core: clear sysfs attributes for each NVMEM device Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 03:55:56PM +0100, Srinivas Kandagatla wrote: > HI Daniel, > > On 18/07/2023 14:55, Daniel Golle wrote: > > Set nvmem_cells_group.bin_attrs to NULL in case of an NVMEM device not > > having any cells in order to make sure sysfs attributes of a previously > > registered NVMEM device are not accidentally reused for a follow-up > > device which doesn't have any cells. > > > > Fixes: 757f8b3835c9 ("nvmem: core: Expose cells through sysfs") > > These patches are dropped out of nvmem next branch as it was breaking some > existing users. Ok. I've encountered those commits in linux-next and can confirm that they were definitely also breaking things here, hence my patches at least partially fixing that. I agree that reverting them for now and reworking them seems to be the better option in this case, hence my patches won't be needed as such. > > > --srini > > Signed-off-by: Daniel Golle > > --- > > drivers/nvmem/core.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > > index 6c04a9cf6919f..70e951088826d 100644 > > --- a/drivers/nvmem/core.c > > +++ b/drivers/nvmem/core.c > > @@ -458,9 +458,10 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem) > > mutex_lock(&nvmem_mutex); > > - if (list_empty(&nvmem->cells)) > > + if (list_empty(&nvmem->cells)) { > > + nvmem_cells_group.bin_attrs = NULL; > > goto unlock_mutex; > > - > > + } > > /* Allocate an array of attributes with a sentinel */ > > ncells = list_count_nodes(&nvmem->cells); > > cells_attrs = devm_kcalloc(&nvmem->dev, ncells + 1,