Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9990487imu; Sun, 30 Dec 2018 09:54:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/UBRuL00EGBQzUirK8xiQ7BISIYMpHVBgiSrv6TymEOGPmMafxsHog0/ApIHeAOf2+kQ8cZ X-Received: by 2002:a62:1a91:: with SMTP id a139mr36637395pfa.64.1546192449110; Sun, 30 Dec 2018 09:54:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546192449; cv=none; d=google.com; s=arc-20160816; b=qmj6r+ZMjJ6RWz4nPAmrGc5wX08Ve/1I4+zcHbUNCGpqHpP5JLtofGRW6vgwmSlLUK CZ9ZIFyMLUVB0SDybSQaaDuRE9JgYULWLP6ZC2QuN66OEjiNeIfkkXZOWtPF26yDNGeI gFUuUcRQp5qfmJu9GsVjqIAkehuYkP710KvGkmPznTq120+qlxallLfz8ULSjCmc66bX VDgjdcAa8q53ICqS8gnCDXRuh2O2HuqQVuJoCV4lLPl8/2++pdd4A156WvxN1b7ZDkGn dU2p69Imn97Qaa28QvHEFB5nOclQn656sZpR/9ythBxGX5+20tfKzzf1igJjJcLMX+nN csyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-disposition:mime-version:user-agent:in-reply-to:references :subject:cc:to:from:message-id:date; bh=LhUTsDy00btnPBtF0IGdDmuMRF0AT/ZbU8rciZDd7ks=; b=XrUQ0I5gkf7gv+yvD9cf6hKRYcT7bq/YYfEclcCpPTQDgLiRbumIbr6VIgY+r+rgcv +GbtLmfYNFWYiSdbgBNx8HM7Rd5LIzEljhj84HI9omO1vzX2uY/UESC9HXUbnjChAyH8 3z+6K0yrk/757PiiH5ZmH5m9P4rNvleap/jYMYkq9QikokmIPieDQpNf9QLGuE+zXv3U BdD7S8hKTx+RNaylqi6npS7rkOBFj0SxOJgh64T7DDq2EgLxoHQAgnjXQHYQJlgGkL/R R6f6Y5tcMdERvsF25jSCT2Hm4t8CiQeZwGcSwex+VXBvT8MltMRqHM5JCfbk6PiRlWgk HisQ== 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 q64si42251338pga.280.2018.12.30.09.53.53; Sun, 30 Dec 2018 09:54:09 -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 S1726553AbeL3RxG convert rfc822-to-8bit (ORCPT + 99 others); Sun, 30 Dec 2018 12:53:06 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:38198 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726300AbeL3RxF (ORCPT ); Sun, 30 Dec 2018 12:53:05 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43SShp5FhDz9tyyP; Sun, 30 Dec 2018 18:52:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 1CxxfnNyyxZB; Sun, 30 Dec 2018 18:52:58 +0100 (CET) Received: from vm-hermes.si.c-s.fr (vm-hermes.si.c-s.fr [192.168.25.253]) by pegase1.c-s.fr (Postfix) with ESMTP id 43SShp4WnZz9tyyH; Sun, 30 Dec 2018 18:52:58 +0100 (CET) Received: by vm-hermes.si.c-s.fr (Postfix, from userid 33) id 39EDA1CB; Sun, 30 Dec 2018 18:53:00 +0100 (CET) Received: from 37-165-14-176.coucou-networks.fr (37-165-14-176.coucou-networks.fr [37.165.14.176]) by messagerie.si.c-s.fr (Horde Framework) with HTTP; Sun, 30 Dec 2018 18:53:00 +0100 Date: Sun, 30 Dec 2018 18:53:00 +0100 Message-ID: <20181230185300.Horde.o5iU5x8n8UeDsyjemaBU_w7@messagerie.si.c-s.fr> From: LEROY Christophe To: Finn Thain Cc: Joshua Thompson , linuxppc-dev , Geert Uytterhoeven , linux-m68k , Linux Kernel Mailing List , Greg Kroah-Hartman , Arnd Bergmann Subject: Re: [PATCH v8 13/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions References: <505240b144f1666acf26a3c1e93c8e6868fe1408.1545784679.git.fthain@telegraphics.com.au> In-Reply-To: User-Agent: Internet Messaging Program (IMP) H5 (6.2.3) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Finn Thain a écrit : > 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 agree it would be cleaner, as it would also avoid this m68k_nvram_get_size() wouldn't it ? I don't see potential code duplication here, do you ? Christophe > >> 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 >>