From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A6AC433E0 for ; Sat, 6 Mar 2021 00:30:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A46465011 for ; Sat, 6 Mar 2021 00:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbhCFA3b (ORCPT ); Fri, 5 Mar 2021 19:29:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbhCFA3A (ORCPT ); Fri, 5 Mar 2021 19:29:00 -0500 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBE24C06175F for ; Fri, 5 Mar 2021 16:28:52 -0800 (PST) Received: by mail-qk1-x72b.google.com with SMTP id s7so3888648qkg.4 for ; Fri, 05 Mar 2021 16:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/+vEvRXtpwub3MnTBsG9Vue5EQuUlOiedd4Nh9FOPy4=; b=lwV33IQNdLvYQs2JYQ3UyaYYgJJeQ6lmKMRa1FANwYR8pZGgAnGFS6bXwWr+zC+/gv KknByyVP0hQU4qdSLX5tW1mFYSESDMizgYQ0PKfsx0KxILEM74qUDM7ZIowxFTINPvhf thGRuclkqwRuRgo+/Ur0qOz9V73bpJlEDdx+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/+vEvRXtpwub3MnTBsG9Vue5EQuUlOiedd4Nh9FOPy4=; b=NCOFm6BoUxvVHEiuTd1YWUvFDphfOkMvTR0bx8KTt6JiUfUcBXasjpKNYpd0G6Kjm5 qGA7fbdBH/yA5u4xXXnM+xMshn5T/zEWvG7a1CtHIBbq84h9a0UickXY+ydfrUXSr0s5 oz8lIVfS12YWxTy6QUk9HxxG/49FRc7SSkUU9Xfdj0eY6T/Eew9fK76gvNRq+IQVQeii jae4wQSKPYrM+Z6cvA7L8Png83pJQ/RROPAWPWYVGUbyhulHlzneaivqhrbMqGUDigT4 GRTCY/j+mESg36SpEcK3iqGyA7lYRPTYjBaAbnDyBUvQ4iWmLUkwCaAJAP+bl9VoQsRz hiGw== X-Gm-Message-State: AOAM532po6jFZrZSU3Hr2RgHy3/6mFcMh7y5f0SpnFOu5Scp/RHBOtVV apV5On9VlUxVhVaLERNiAa6tDPQYM+SATw== X-Google-Smtp-Source: ABdhPJy7FnM3eq34ovp03Cy4okvN8QEpdP7oJ8uhB0eN/zCL0In5Bdc7VWrIT/k8XOVXk2FZZhkkSQ== X-Received: by 2002:a37:a2c2:: with SMTP id l185mr11432728qke.178.1614990531702; Fri, 05 Mar 2021 16:28:51 -0800 (PST) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com. [209.85.219.175]) by smtp.gmail.com with ESMTPSA id r190sm2990159qke.26.2021.03.05.16.28.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Mar 2021 16:28:51 -0800 (PST) Received: by mail-yb1-f175.google.com with SMTP id 133so3793448ybd.5 for ; Fri, 05 Mar 2021 16:28:50 -0800 (PST) X-Received: by 2002:a25:4e83:: with SMTP id c125mr15856404ybb.343.1614990530048; Fri, 05 Mar 2021 16:28:50 -0800 (PST) MIME-Version: 1.0 References: <20210227002603.3260599-1-dianders@chromium.org> <20210226162521.2.I7c9190630cf9131b42d521aa1c5b97135012a734@changeid> <6537aec4-7f6e-ede9-12ea-e84bab738d7b@linaro.org> <5c53bb42-cce6-12f8-b624-768535c5a094@linaro.org> In-Reply-To: <5c53bb42-cce6-12f8-b624-768535c5a094@linaro.org> From: Doug Anderson Date: Fri, 5 Mar 2021 16:28:38 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] nvmem: core: Allow nvmem_cell_read_u16/32/64 to read smaller cells To: Srinivas Kandagatla Cc: Rob Clark , Jordan Crouse , Niklas Cassel , Ulf Hansson , Bjorn Andersson , Stephen Boyd , linux-arm-msm , Akhil P Oommen , Jorge Ramirez-Ortiz , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Mar 5, 2021 at 8:07 AM Srinivas Kandagatla wrote: > > > If you think it's confusing to change the behavior of the existing > > functions, would you be opposed to me adding a new function like > > nvmem_cell_read_le_u32_or_smaller() (or provide me a better name) that > > would be flexible like this? > > This should be perfectly okay! > may be something like: > > int nvmem_read_variable_cell(struct device *dev, const char *cell_id, > void *buf, size_t sz_min, size_t sz_max); > > It should return number of bytes it read and fail if cell size is less > then sz_min! The above API isn't really what I want, though. Specifically I want the API to acknowledge that it's a number that is being read. The client just wants a number and any conversion / zero-padding / whatever needs to be abstracted out. The client also doesn't really care how big the cell actually was as long as the data fits, so I wouldn't want to return it. OK, I've come up with a new proposal, so maybe we can continue the conversation there. The API for my new function actually matches exactly with the old cpr_read_efuse() which makes me feel like it's the right way to go... https://lore.kernel.org/r/20210305162546.1.I323dad4343256b48af2be160b84b1e87985cc9be@changeid -Doug