Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9562273imu; Sat, 29 Dec 2018 23:28:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN6mxOGnJpVCOfLj68JkNYpiHmFWMJPPOm8QMu2stDag3RANVWAV/tRNUJxDdtBsT5ppGTFT X-Received: by 2002:aa7:8758:: with SMTP id g24mr33483600pfo.250.1546154926241; Sat, 29 Dec 2018 23:28:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546154926; cv=none; d=google.com; s=arc-20160816; b=A+TaMiRVI8oBc7uYpXev0Hr556CLR4yH6+cYg79QApEiAl9NisbumNnQQjVX8EncKM VrgU8MtAhIq3zZdeiqtxjCROCqn9cqPx2uYLPUFXeuSVS7hGQUt5xn+K2ECgEpukvi4Y AXxjoFX0t2sdzCRJ2dW66tAaDg9+PkVnUYy+qd+H+/iVVweCoyBCsYUIotiNOXylKI9L 1MGRLXl5hl6Psdct5A7dKWcnNcAvNtJzGlVOErNJ8hm+B/y64LvPK+ak04bzDYvgJ1GH 30cy2hVd+qyEh9+TWabjyAZNLEj9AgEo4YAehlxsCls1cCd3uTS5PUVVgyX2yOFSw3jc NHOw== 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=KWLkaU442xIP6KHXFcLsJq3bToQ0V2XO+WEV3enkAbk=; b=JGHo4YJMGA0jaPvV4pXZhYsITd6SSN90mm/k5cZGCPZzAnLMoZY2qbjjLG+5lEOaJz ZG/RttX6AQeqWJ7aJ5zHMMNGuIFD2kLfNahbdIisSj0PLujHK3oSqvzLW2m6toxS6ENU 8SI37x1dx0w4P6tpFll5ZaR2D8m6ixV0Zi3wM+WzKzEfXVQzt1zsWPz2I6kyXN+siYlq G3Htfq3jrvQyF4D5OPRKdOU0Nl9XdYLV7cNJYexk2UR6+9WnyNAM078V7+o/fSipFUWf aCoEELSy2MYH9DQJHdP7Rc3+ZBDMsPYZK54BJep3i0QLxckqjV7GMHhnz1qjymMcWFCj iopQ== 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 l4si40595124pgr.346.2018.12.29.23.28.30; Sat, 29 Dec 2018 23:28:46 -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 S1726071AbeL3H0q (ORCPT + 99 others); Sun, 30 Dec 2018 02:26:46 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:52472 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbeL3H0q (ORCPT ); Sun, 30 Dec 2018 02:26:46 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 99A9021FEF; Sun, 30 Dec 2018 02:26:43 -0500 (EST) Date: Sun, 30 Dec 2018 18:26:40 +1100 (AEDT) From: Finn Thain To: Arnd Bergmann cc: Greg Kroah-Hartman , Geert Uytterhoeven , Joshua Thompson , Linux Kernel Mailing List , linux-m68k , linuxppc-dev Subject: Re: [PATCH v8 13/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions In-Reply-To: Message-ID: References: <505240b144f1666acf26a3c1e93c8e6868fe1408.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 Sat, 29 Dec 2018, Arnd Bergmann wrote: > On Wed, Dec 26, 2018 at 1:43 AM Finn Thain wrote: > > > + > > +static ssize_t m68k_nvram_get_size(void) > > +{ > > + if (MACH_IS_ATARI) > > + return atari_nvram_get_size(); > > + else if (MACH_IS_MAC) > > + return mac_pram_get_size(); > > + return -ENODEV; > > +} > > + > > +/* Atari device drivers call .read (to get checksum validation) whereas > > + * Mac and PowerMac device drivers just use .read_byte. > > + */ > > +const struct nvram_ops arch_nvram_ops = { > > +#ifdef CONFIG_MAC > > + .read_byte = m68k_nvram_read_byte, > > + .write_byte = m68k_nvram_write_byte, > > +#endif > > +#ifdef CONFIG_ATARI > > + .read = m68k_nvram_read, > > + .write = m68k_nvram_write, > > + .set_checksum = m68k_nvram_set_checksum, > > + .initialize = m68k_nvram_initialize, > > +#endif > > + .get_size = m68k_nvram_get_size, > > +}; > > +EXPORT_SYMBOL(arch_nvram_ops); > > Since the operations are almost entirely distinct, why not have two > separate 'nvram_ops' instances here that each refer to just > the set they actually need? > The reason for that is that I am alergic to code duplication. But I'll change it if you think it matters. BTW, this patch has already been acked by Geert. > I was actually expecting one more patch here that would make the > arch_nvram_ops a pointer to one of multiple structures, which would > be easier to do with multiple copies, but I suppose there is no need > for that here (there might be on ppc, I have to look again). > Yes, I considered that too. I picked the variation that makes everything const. -- > Arnd >