From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71DC21E25FE for ; Fri, 8 Nov 2024 09:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731059906; cv=none; b=AXJ17koJDZ0eP/olkc4w9oGkiPRV4eqVcTKPSpbtRsRC/myORR5EHvmuzbNCkDWax9Lw1Nm3D1n7zFsn4iUQ8B9HolvB1rjPvG2ZwwGrIX9thS7MpB3f6eyBDv36xTubKjxnIKIB+357GmuaPgN848H+xRy2POImoHLH4c9W7K8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731059906; c=relaxed/simple; bh=yyYnt0zeYcifOtxkWb1a/lLSCIHVxKRnsZk+5f+PJTY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=po5Rkn6h/U0fJSP8FWZIddOazNkHUfrjSNMqTGVgtmDEOZiERc6P9lHG5wAQVDB3WqjOmx9McDeXIGLV3d/C/1UTI9jJpNtjVGKwncMbUlEfnJxnpu4a8bUfDgwCaWejqxR2EPcaxuPdEUrAj7wD2kavHHjlKdRK9ZIF7BsV2bs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=I4g+M9JO; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="I4g+M9JO" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-539e63c8678so2115942e87.0 for ; Fri, 08 Nov 2024 01:58:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731059901; x=1731664701; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5H92Szh7zfoJ1X3k0f3O/M8Kef9HnGfDZM9F62PdTF8=; b=I4g+M9JOrF1xRMDWUEXb+hV0tfimai65+InH3ry2IPlAT0QkdpzJ1/j6ZAuyk3/M7g QQYVl1HUQXROfyYmkP8WOLaDd+2pnly52JWiF2NaKuX44xxPmSl8hyV6R/XVDtNG3wGU i4WQCbln+zJEnXwqEl5Zqmq/YlrHeu0bQy0po6hV3Pqs4TZ7vfsVW+8O0sDyugKhZ09D oVx3yGexBkLcsSrYd6Flzzte0UZnaLQ7cHw0YECP2GanbEASaCVSLJuYjUrhlGMAfZwX 6YdfI4KsC1NRPptpbimRBoRu1DmQ1iVmkr0/cAciRhm0Oow4HpF0O1KihQSdeqoeAwE5 lGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731059901; x=1731664701; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5H92Szh7zfoJ1X3k0f3O/M8Kef9HnGfDZM9F62PdTF8=; b=Yv/mTrz7rwmJ5Gzo9KKpC77c54lChS+AHpkhls9kfDQgGIfbd3HZvyLCxgjt8371SF s9KKxRWouQPS1lGMmNQonzEw1Lb8tNa0VVafPF4d69AeTNarNxqw9kPrGywNYItOvpxj Xk4NGRSIK9qt+Aa5OXy2nRMbN2eqArXbaG5/YThXqGbqaihOarvk56dmNZEBT8E2+Vh2 IfrnqRYV5+8bThppI41QvDZSPDU5NSmSw3IrQHDazJVxtBg04EF8kwiKN4Xp4kbhYBbn dK6ItogkXRsp6wdyTUdC4dlKUn4Hfbdp9z/WFj4H0jFblFidYwJ/EXkYFrlzIEogW0Qz tLrQ== X-Forwarded-Encrypted: i=1; AJvYcCXcrXuObgrZo6kTi7gmhmrqDBmJrH4+7Vtk1fC+3FEtTKT+R02inVE/bCl8d3QNFI7hM20HfAGhj6ojRjM=@vger.kernel.org X-Gm-Message-State: AOJu0YxruI02P3aD/UNaGecAwWkBljiOYlZfKcQjFd6rbiu3646ob3cM fDKTM2OOZghw4GEzih6Q2ux3X6rdcSyL2R5L1lUZt9WRo4vrA/1AyruTD2VWMI0= X-Google-Smtp-Source: AGHT+IFRdqMG06HtkdzkHICdIIWrY7d6GXyCPZ8Qa2uAHGCAECQ9+blFxeuQwDqlNWgVG3erwh8s3g== X-Received: by 2002:a05:6512:2256:b0:539:905c:15ab with SMTP id 2adb3069b0e04-53d862e3e86mr1089619e87.32.1731059901467; Fri, 08 Nov 2024 01:58:21 -0800 (PST) Received: from [172.20.143.194] ([154.14.63.34]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-432b05e6042sm57204805e9.44.2024.11.08.01.58.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2024 01:58:21 -0800 (PST) Message-ID: Date: Fri, 8 Nov 2024 09:58:16 +0000 Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 04/10] nvmem: core: calculate bin_attribute size through bin_size() To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Greg Kroah-Hartman , "Rafael J. Wysocki" , Bjorn Helgaas , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , Simona Vetter , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Naveen Krishna Chatradhi , Carlos Bilbao , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , "David E. Box" , "James E.J. Bottomley" , "Martin K. Petersen" , Richard Henderson , Matt Turner , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Logan Gunthorpe , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui Cc: Dan Williams , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-cxl@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-mtd@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org References: <20241103-sysfs-const-bin_attr-v2-0-71110628844c@weissschuh.net> <20241103-sysfs-const-bin_attr-v2-4-71110628844c@weissschuh.net> Content-Language: en-US From: Srinivas Kandagatla In-Reply-To: <20241103-sysfs-const-bin_attr-v2-4-71110628844c@weissschuh.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 03/11/2024 17:03, Thomas Weißschuh wrote: > Stop abusing the is_bin_visible() callback to calculate the attribute > size. Instead use the new, dedicated bin_size() one. > > Signed-off-by: Thomas Weißschuh > --- Thanks for the patch, LGTM. Acked-by: Srinivas Kandagatla --srini > drivers/nvmem/core.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index 33ffa2aa4c1152398ec66b8dd7b30384c5346a6e..63370c76394ee9b8d514da074779617cef67c311 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -303,11 +303,19 @@ static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj, > struct device *dev = kobj_to_dev(kobj); > struct nvmem_device *nvmem = to_nvmem_device(dev); > > - attr->size = nvmem->size; > - > return nvmem_bin_attr_get_umode(nvmem); > } > > +static size_t nvmem_bin_attr_size(struct kobject *kobj, > + const struct bin_attribute *attr, > + int i) > +{ > + struct device *dev = kobj_to_dev(kobj); > + struct nvmem_device *nvmem = to_nvmem_device(dev); > + > + return nvmem->size; > +} > + > static umode_t nvmem_attr_is_visible(struct kobject *kobj, > struct attribute *attr, int i) > { > @@ -383,6 +391,7 @@ static const struct attribute_group nvmem_bin_group = { > .bin_attrs = nvmem_bin_attributes, > .attrs = nvmem_attrs, > .is_bin_visible = nvmem_bin_attr_is_visible, > + .bin_size = nvmem_bin_attr_size, > .is_visible = nvmem_attr_is_visible, > }; > >