From patchwork Sat Nov 12 12:04:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 19172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1251576wru; Sat, 12 Nov 2022 04:44:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf4iXbGemITNr7sggYVsjT1JKpgBrglk4NNSXLq+5Yb4q858e/bztzzz4FPrqPwgdIPHz0+9 X-Received: by 2002:a17:902:d409:b0:177:ed70:70ff with SMTP id b9-20020a170902d40900b00177ed7070ffmr6748951ple.28.1668257060360; Sat, 12 Nov 2022 04:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668257060; cv=none; d=google.com; s=arc-20160816; b=lc12nrUVYqW3Neygvf6edA8WBptSx0EzPSDu4X82suDhaTKxNJVN3Vw7cbIIw7OohX HNx88ivcVOQDZeYxy9pZzLUMpOR54Y3lquAdDYxmRJ8jA2cXLReFIM9/3nePnY/jeWLx 14MUnqXee/axS8prw+CobOcSqGxjFigWlvtK8BdlMEYQWib8FBq3fOQ9eQqtkuJQ8Ll7 Jf6grp5FCv4Fckzr5Sqn7WgSh/cQnpe4NSOwBVGJMYzkSxGnzkp8CLZWOWJv/kcI+Kkp nUKSA342ZuLTr28toiA/bYa9RHwRW6qMYjvq44dpFTyUGDDd7Tl4CIWdAGfXnPN5zJGP e3Zw== 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 :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=x9FizG+eL/8/EI7i81TIdmOdCun6VmkRyznqPByhDis=; b=lsKmDZHrudPpXHv3qdXfSeEJvsoyiXCdXGGbp+A72M/fTNmkdxpajy5ChLEttopdd9 dlCVrQwRKgYO00W/4J/tf1qS6/KyQSOBmYVGCtuUiu3WknBPc/jDEQaEcMdXCew7qI9a faTQomqpzrydEB5jzh6PCphHkTIQlo3OQxmHyHMVOfRj57vYzt1HKzP/6QQxb0jtFu6A OYalnd/Lw4wn/dmhK2SQjSYMxovN87rWD0PMPe0Dc+4Coxhx9dEkO4Lr4Hx+Lw60CMHg M4Yj2Wj9f5SbJGXMFWdb6PfTnfKHq2U9gYmA5gWbny7NVY9jPcTMfXHaaAWfF7V3hiV6 aAXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=XoJPG62A; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=C12n0toL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a635f02000000b0046ec2ad4a97si5584189pgb.163.2022.11.12.04.44.07; Sat, 12 Nov 2022 04:44:20 -0800 (PST) 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; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=XoJPG62A; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=C12n0toL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234905AbiKLMEz (ORCPT + 99 others); Sat, 12 Nov 2022 07:04:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233962AbiKLMEx (ORCPT ); Sat, 12 Nov 2022 07:04:53 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23F1A17895 for ; Sat, 12 Nov 2022 04:04:53 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B04E65C00D7; Sat, 12 Nov 2022 07:04:50 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 12 Nov 2022 07:04:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1668254690; x=1668341090; bh=x9FizG+eL/ 8/EI7i81TIdmOdCun6VmkRyznqPByhDis=; b=XoJPG62A97EKGbYvKLrn2BxEfc /e1ug9nk80w5t0KyhMnUyameiIsYSIrwpdLZkuDnQaEZgBDP6njcMR5SYjIh8HzT BcgCvKrgsv82CpZh+1WY5xaAR6VJEljFPIXVnCaiFEpvEe3xrbGEz4uDYNjMXjSF oUtmb/p2IUsaNAoAYSDUsitHMYvKfKiglDrJ2wXW9mptibPaPZt+gRM6E3HM0J8E TviFyiKShLo6eJ08gm6X2GYXtQ6dFqf6JBv+6SDxU3Pa4RPkZ3x1c8WlWxgeXkLX hoNFE5Nb2WwVGzTiUK1z9TA9cOTaOZ5y/3LJiFTfMecCXfQGJVYiZfpTxoaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1668254690; x=1668341090; bh=x9FizG+eL/8/EI7i81TIdmOdCun6VmkRyzn qPByhDis=; b=C12n0toL5UY1BE0ooeeFIycg0oKY8VmiQyhHJ92+E+DZLWWKVB0 YfMPX30G4blpX0nQPB+Nz589wFlVM0ybC4K6DKTUEwcAnX+HxreUQqqN1bMXOfSz nl2Mb+cAgQFno+ySIbrEHsKCRTomb+sMxUPvldwLYJghzgqq0cmcgr3T/Oo/CKW1 D9pbYCMMOEm/ElFK0rBig/qUHg8iWEJ15qkfDNUGLWLjjozLZ9ep9aQBztCp5TBI Vj3H38w+1h2dKZdVcwMcCx8Cv8E/MraD93C8A+8yCQ1Ex9kIgP1hjP8PttTwGA+k ZlFOPjvOnMcLPyNAO1q2EQlUpA6JjgyifbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeekgdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epleduffeiheeuvedtffevtdeuleeljeduudfgtedtvefhfeffvdfghfejhefgleelnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Nov 2022 07:04:49 -0500 (EST) From: Sven Peter To: Srinivas Kandagatla Cc: Sven Peter , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] nvmem: Handle reading cells with bit offset > 8 Date: Sat, 12 Nov 2022 13:04:46 +0100 Message-Id: <20221112120447.36877-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749294315242178080?= X-GMAIL-MSGID: =?utf-8?q?1749294315242178080?= Some nvmem controllers like Apple's eFuses or Nintendo's OTP have a cell size that's larger than one byte. Consumers may however still need access to a subset of bits that start after the first byte. Handle this inside nvmem_shift_read_buffer_in_place(). Signed-off-by: Sven Peter --- drivers/nvmem/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 321d7d63e068..a5b8d6989f8e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1379,15 +1379,23 @@ EXPORT_SYMBOL_GPL(nvmem_cell_put); static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void *buf) { u8 *p, *b; - int i, extra, bit_offset = cell->bit_offset; + int i, padding, extra, bit_offset = cell->bit_offset; + int bytes = cell->bytes; p = b = buf; if (bit_offset) { + padding = bit_offset/8; + if (padding) { + memmove(buf, buf + padding, bytes - padding); + bit_offset -= BITS_PER_BYTE * padding; + bytes -= padding; + } + /* First shift */ *b++ >>= bit_offset; /* setup rest of the bytes if any */ - for (i = 1; i < cell->bytes; i++) { + for (i = 1; i < bytes; i++) { /* Get bits from next byte and shift them towards msb */ *p |= *b << (BITS_PER_BYTE - bit_offset); @@ -1400,7 +1408,7 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void } /* result fits in less bytes */ - extra = cell->bytes - DIV_ROUND_UP(cell->nbits, BITS_PER_BYTE); + extra = bytes - DIV_ROUND_UP(cell->nbits, BITS_PER_BYTE); while (--extra >= 0) *p-- = 0; From patchwork Sat Nov 12 12:04:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 19171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1251231wru; Sat, 12 Nov 2022 04:43:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6pgcWehRIftO6OlR179UQ85hcS11FxI4H/8L1cRD3BWYMP/I2zfZB6gtumhUDvDXPJ9CC+ X-Received: by 2002:a17:90a:2c4a:b0:206:f02a:cb4b with SMTP id p10-20020a17090a2c4a00b00206f02acb4bmr6296475pjm.159.1668256981286; Sat, 12 Nov 2022 04:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668256981; cv=none; d=google.com; s=arc-20160816; b=ho1EtHDy7+2daquiqSNE4sepWx8YkJKKUOYhZD/BnNQCjsdF8IJEW7TFhoG7gGdHk2 F4dKBfHeo7zLxIPJGD627f0OPnizC+KmGIBcGpnDsryUA61BgfmidM1aYUX+aBogQE41 9L5Ev7tkkeMYqt/pi+lrecvkagQAIOYc5ZkQde1RhASPBL4D+050XavsBQXGhxqFe60P /cnLYdRCxTMIt0GBXZbZxdsQOZtPtatFjMcUhht3yDW7LBzeyJl85E2y+24xUD5HXhn4 6QvAc4pkOjWKZ79nAZsSoHCZZoPEqvxn/Y7QFXU5xB9IdDcxeHCDRmXF9nh92yigU5DK T3Rg== 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 :feedback-id:dkim-signature:dkim-signature; bh=igfPzLZ+nsYXDcd0iC5P+vvdO2NXmHjJ5YJY8H2HHmo=; b=SybkjFEr8iAAfywT9/jn9rjK47S9xq6HLVtLrbHbWjMlMRwwkrUff0JMWAcU+EQvEo R0DMoY+Gsi0dv836c0VaQvtPFxJ229kkgXh6Zpj76lZG7gH2B7AeJKca+rH8n8aQm2LE HJuPjgs9npqqGggtbZ4pbEJpuiOO5D16YE+arW6+VRYIDub/Ep8WC6hVPLrgsL/3xBom p2y5h5fhhdCuZ+LE5yEUXmRvAtDSod/gxCxtk/yAFvg/EahTnJr6HUpPq64x2lPqr0X1 Ri97CzmnER+5LWNb+tL+aBqZVS114wGdRvo+CxCdSPFZc8cKnX1g6mWGmS4WQBuSwP2n nIYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=Lp0a244i; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=MlbwPAFY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a635f02000000b0046ec2ad4a97si5584189pgb.163.2022.11.12.04.42.47; Sat, 12 Nov 2022 04:43:01 -0800 (PST) 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; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=Lp0a244i; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=MlbwPAFY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234927AbiKLME5 (ORCPT + 99 others); Sat, 12 Nov 2022 07:04:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbiKLMEx (ORCPT ); Sat, 12 Nov 2022 07:04:53 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23FBF1789F for ; Sat, 12 Nov 2022 04:04:53 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id ADEA55C00D9; Sat, 12 Nov 2022 07:04:51 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 12 Nov 2022 07:04:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1668254691; x= 1668341091; bh=igfPzLZ+nsYXDcd0iC5P+vvdO2NXmHjJ5YJY8H2HHmo=; b=L p0a244iTn5L+2cSWaU3yOB2iYxD9pCB2533PT/bkDh9zySFlEo8jjvwXAYRrJlVb cVgWam8V0IGDw3wtb9JXH4PoxKc+xaD/PRQOVMWAHiy48Tz5ks/r5C+I59WSa4JJ iMKsnY1o3Svjb14Z/tBLqcSYMm0DnuT07rV9p9sejlKHn7zoU6uWXRffYIPSbxNZ zhFqst9U5leIHuYj3ArewuJoUg26uyXwEiGIGXRPXfPl+6Wzp+y0PCoxJL09ZM+w dPUSdnzI/yH0Voc246ZqgMR34nrF938BRr56jlq18/k+cqzDanpEq9XxpvtAojdS X84WljKF7lgWxj8HDhZtg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1668254691; x=1668341091; bh=igfPzLZ+nsYXD cd0iC5P+vvdO2NXmHjJ5YJY8H2HHmo=; b=MlbwPAFYQvSPvUgBkBkrKrZD30aXG yqsg7s59OYRpOIMCVDXgwTP3OzDmBiJCyvKxe9+0CIBzIV1Jq6zCXMcj3wAKL35Q XSAj91FWdufIzDZgZuAKfueaH3dOE+uTQ+iRpOpj8lFPLh9F1E/DIGFYTGgX+3Nd EH+KilAD24iW0hJo+WMmU5auvRvrHPU1S/iTHJwmQnZmTRB0qV6E7r16Cf5vdhq/ rnBk35GJy0QltZ/o7uY/377o1Vl6hqTiU3+x67G95nw8N4abJxE9XZUAjkBCJTiJ n1tGiffuCDLYTSDGqVwO3Bj2hxZvnSaq0aWSDAC/oRdRLI8kWJZnuEgdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeekgdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnhepjeeiheehkeegvdejhfevkeejgfdutdefhfethedtieffleekieeuudefleekjeeg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 12 Nov 2022 07:04:50 -0500 (EST) From: Sven Peter To: Srinivas Kandagatla Cc: Sven Peter , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] nvmem: Handle reading nbits from cells with word_size > 8 correctly Date: Sat, 12 Nov 2022 13:04:47 +0100 Message-Id: <20221112120447.36877-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20221112120447.36877-1-sven@svenpeter.dev> References: <20221112120447.36877-1-sven@svenpeter.dev> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749294232282861252?= X-GMAIL-MSGID: =?utf-8?q?1749294232282861252?= Some nvmem controllers like Apple's eFuses or Nintendo's OTP have a cell word size that's larger than one byte and cannot read anything smaller. Round up cell->bytes correctly when accessing a subset of bits. Signed-off-by: Sven Peter --- drivers/nvmem/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index a5b8d6989f8e..6906de15b9b8 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -470,8 +470,8 @@ static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem, cell->np = info->np; if (cell->nbits) - cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset, - BITS_PER_BYTE); + cell->bytes = round_up(DIV_ROUND_UP(cell->nbits + cell->bit_offset, + BITS_PER_BYTE), nvmem->word_size); if (!IS_ALIGNED(cell->offset, nvmem->stride)) { dev_err(&nvmem->dev, @@ -718,9 +718,9 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) } if (cell->nbits) - cell->bytes = DIV_ROUND_UP( + cell->bytes = round_up(DIV_ROUND_UP( cell->nbits + cell->bit_offset, - BITS_PER_BYTE); + BITS_PER_BYTE), nvmem->word_size); if (!IS_ALIGNED(cell->offset, nvmem->stride)) { dev_err(dev, "cell %s unaligned to nvmem stride %d\n",