Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp507548imu; Fri, 4 Jan 2019 01:52:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN6RWauXFq3ZUUKloAC3rACui2jpMoNbxliqQHIq+jxO9RG5LsDjMqwq8O7PEsbpf8wYwUsX X-Received: by 2002:a63:fe48:: with SMTP id x8mr1075553pgj.261.1546595575149; Fri, 04 Jan 2019 01:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546595575; cv=none; d=google.com; s=arc-20160816; b=xcl4F9+5RGdwZTmqtU+T0msw1MvmgFJOBBX4pIogLtdKpx8LsUDowrFBa5lMFXL+1g PwNsukhiX+xCU7XU7Gy/lvhDLpUSkuA178oirz1SNaOY6EAeylkJblzuBRuMJC58mrVE 9mvNwofAW7ENfkqyT6dIsXRJoMP9B/SVM/rjgre+tHaGr3KpEtJ4XbZtFmI2t/JGKaKX mcmXADKxBVfUeFrHIBoXlB/CnHvPdFiuteGnotMNaV6Xqmm4LvAd1C4WuYY2UaH1vW0T w004s74a4TdQtIPptHikiexZQ84nnEWc8Uyk/F4SnbGFgjTC3HyWisL87/sprEafSPt/ wzKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=PVzzvn4HuWkOT+ZwXdTtaNbGQusRAqEQw5HZ99BYal8=; b=bKAqV6yDhYsd1KmNHrBVSsz0kv8+HUNQw/bdkG7CYv7UlC/s7S6wKDCT//0bUlK+WN VXSIzjfbXLsotb9y4SU/2OF2Jjv/y51FMGusPWT4Qt1aYCdwtghfBd2fp4ZESaEIDEZv X7M8ffOVZnpzxZcUP43wKfEKVKdnkPnSeL/BxIf1oaKL6INAsHoN2ovWCKvCm7FxyX7x ptcZkKY80K3mfaY0ekjqbKQOkMlWFN1ykXA5CAkwa7C2qonOg2l59E8HD7f86dMlxLgI pVehCZKIpRKj0hTKrxIJnxVZYSxALRf+DeAcxz08i5ivuw1t8+GjLEHPBuhcPlDwVA1F NwCw== 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 65si37701322pgf.521.2019.01.04.01.52.40; Fri, 04 Jan 2019 01:52:55 -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 S1726673AbfADIpe (ORCPT + 99 others); Fri, 4 Jan 2019 03:45:34 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:33322 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfADIpd (ORCPT ); Fri, 4 Jan 2019 03:45:33 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id CADF728E5E; Fri, 4 Jan 2019 03:45:27 -0500 (EST) Date: Fri, 4 Jan 2019 19:45:58 +1100 (AEDT) From: Finn Thain To: Arnd Bergmann cc: Greg Kroah-Hartman , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Linux Kernel Mailing List , linux-m68k , linuxppc-dev Subject: Re: [PATCH v8 24/25] powerpc: Adopt nvram module for PPC64 In-Reply-To: Message-ID: References: <2fe2b8e6395aeacfafcbde590a50922d4e632189.1545784679.git.fthain@telegraphics.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 31 Dec 2018, Arnd Bergmann wrote: > On Sun, Dec 30, 2018 at 4:29 AM Finn Thain wrote: > > > > On Sat, 29 Dec 2018, Arnd Bergmann wrote: > > > > > With the current method, it does seem odd to have a single > > > per-architecture instance of the exported structure containing > > > function pointers. This doesn't give us the flexibility of having > > > multiple copies in the kernel the way that ppc_md does, but it adds > > > overhead compared to simply exporting the functions directly. > > > > > > > You're right, there is overhead here. > > > > With a bit of auditing, wrappers like the one you quoted (which merely > > checks whether or not a ppc_md method is implemented) could surely be > > avoided. > > > > The arch_nvram_ops methods are supposed to optional (that is, they are > > allowed to be NULL). > > > > We could call exactly the same function pointers though either ppc_md > > or arch_nvram_ops. That would avoid the double indirection. > > I think you can have a 'const' structure in the __ro_after_init section, > so without changing anything else, powerpc could just copy the function > pointers from ppc_md into the arch_nvram_ops at early init time, which > should ideally simplify your implementation as well. > Does this require removing the 'const' from the powerpc arch_nvram_ops definition? That would mean removing the 'const' from the declaration in nvram.h, which means removing 'const' for every other instance of that struct too. That's what happened when I tried removing the ppc_md.nvram_* methods entirely and assigning the same function pointers to arch_nvram_ops methods instead. Apparently all instances of arch_nvram_ops have to be const or none of them. Otherwise gcc says, "error: conflicting type qualifiers for 'arch_nvram_ops'". -- > Arnd >