Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10670495imu; Mon, 31 Dec 2018 04:31:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN7GIVLudteBg2uaeJX3OO/9IAoCR9O/NBXwLwgQ8NlsZ2cC5PH1TBigdMXsQQ3j0HuloNCQ X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr36163006plh.99.1546259474683; Mon, 31 Dec 2018 04:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546259474; cv=none; d=google.com; s=arc-20160816; b=AXn5CsKd7PzovI2neT9mFgps/jzS68BpCceY9Vng0JZQ4K82gZOS4QHMuOIhlnojKx gT8np0jZ9ZmpnWODVjbveZOqdamnwRWa7VWDP71X8X2nBj92gDEpfTwmzFMOZjs6Cfbi 6sSBoe+cgAZIYLeLpblRIEy6NLUArhqWUxki2TU90uc1EPeL0JZ0OoYEGXalgm5cNJCH gvqxavx++IERTtPo2NFqG+jzoP/OugwOLee4mGoLxvhMfmViwrCbebKGucWkapJPULcu zfK+JLcD7Gemr53KoaZonfQm8KOFLPh4hcGraCSy4LAiipd3QNGNnQBjmsEQkFJQM5BM zO1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=wyBGgV7y89Nappfs2uMQN0NgbtoaB2ye+s9iy3PwtU0=; b=SZcV2V8/9AiE2WnEob8fydsanuC9+j6OzRzV3rYD6kKrVJgUTpOCIuAKXuLcoNZ3fw AfzUnf505JWNwdnKnTpVb5vXHpJfta9mmUvRfkykRV08qtBkqBxyjrPS1e7I20fS5haw 7qljHeOJpOIeTntpzBncdM3UOfh6/cTP5H+pzpKRO/xTwsU+LTZ171/Z4RUaaXY9jEAN CgdV+aVwoAo9P5yQuVd4W05wPqfYnVVDlKhTM14GynZO/02cIP60lQsb2ObXAQnJN0D/ dN9hQa/CaPdBQ+z6/hYaKDPb9ygsZRpM17hgQtdDRTEzw9YP08kw5Xi8542tPR2KFUqJ ow2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o2si9832752pfb.166.2018.12.31.04.30.57; Mon, 31 Dec 2018 04:31:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbeLaMaE (ORCPT + 99 others); Mon, 31 Dec 2018 07:30:04 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41248 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbeLaMaE (ORCPT ); Mon, 31 Dec 2018 07:30:04 -0500 Received: by mail-qt1-f195.google.com with SMTP id l12so29127240qtf.8; Mon, 31 Dec 2018 04:30:03 -0800 (PST) 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=wyBGgV7y89Nappfs2uMQN0NgbtoaB2ye+s9iy3PwtU0=; b=KUBewGfXLqjRygbUbvaf2qYTW9hr6ythFGJpADVltwARzL/r78FJ5RvmE93LgZLRFq 6Za5RCAqDrSafSW40y+st7CiHs2NJaOsWcbKS8qusjGY19NUs+QL3K8YtF+8femiR50g g0Dp0VzaVwMR1SQDubG7KdzesqftjVV4DNeFZZJS0s2O83+X3ECi4Y4cYGUrvrcpWfX5 bjaavypjQl+7pz8tBe5Ftc/D16XJ68INYUkw0jkmtux3iCbymliFiXILePnlL+my7SDN C/u9AsgX21W/xqLkzCfaY1bp/MW7bRnCF+frHNhEJbkkAGG2V6Qr7GHdo8PrMM0YAh47 +1kg== X-Gm-Message-State: AJcUukf8SNHpmB6+0nl6xlVMQ74PLlY+B2GdUfDyD7ps6qX0U51l+cTD XCn7rkc9eLJvhpidLtUkRunZQHy/TQgRm/XYUJQ= X-Received: by 2002:ac8:1d12:: with SMTP id d18mr8484244qtl.343.1546259402640; Mon, 31 Dec 2018 04:30:02 -0800 (PST) MIME-Version: 1.0 References: <7e8eb87ea829c03941c895c968df2ebd0f80512f.1545784679.git.fthain@telegraphics.com.au> <20181229180236.Horde.idY3gOIzkSWywjIrqlXJMA1@messagerie.si.c-s.fr> In-Reply-To: From: Arnd Bergmann Date: Mon, 31 Dec 2018 13:29:46 +0100 Message-ID: Subject: Re: [PATCH v8 20/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() To: Finn Thain Cc: LEROY Christophe , Linux Fbdev development list , dri-devel , Linux Kernel Mailing List , linuxppc-dev , linux-m68k , Bartlomiej Zolnierkiewicz , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 30, 2018 at 12:43 AM Finn Thain wrote: > > Is there some benefit, or is that just personal taste? > > Avoiding changes to call sites avoids code review, but I think 1) the > thinkpad_acpi changes have already been reviewed and 2) the fbdev changes > need review anyway. > > Your suggesion would add several new entities and one extra layer of > indirection. > > I think indirection harms readability because now the reader now has to go > and look up the meaning of the new entities. > > It's not the case that we need to choose between definitions of > nvram_read_byte() at compile time, or stub them out: > > #ifdef CONFIG_FOO > static inline unsigned char nvram_read_byte(int addr) > { > return arch_nvram_ops.read_byte(addr); > } > #else > static inline unsigned char nvram_read_byte(int addr) { } > #endif > > And I don't anticipate a need for a macro here either: > > #define nvram_read_byte(a) random_nvram_read_byte_impl(a) > > I think I've used the simplest solution. Having the indirection would help if the inline function can encapsulate the NULL pointer check, like static inline unsigned char nvram_read_byte(loff_t addr) { char data; if (!IS_ENABLED(CONFIG_NVRAM)) return 0xff; if (arch_nvram_ops.read_byte) return arch_nvram_ops.read_byte(addr); if (arch_nvram_ops.read) return arch_nvram_ops.read(char, 1, &addr); return 0xff; } (the above assumes no #ifdef in the structure definition, if you keep the #ifdef there they have to be added here as well). Arnd