Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9329023imu; Sat, 29 Dec 2018 16:39:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/W5iGvv1VfSrj8s3Kxea3J5NGd9jPf0SiRXMxdj2k9ShwncTUPNud1TFTlc0WnsGe5LjLDT X-Received: by 2002:a62:9683:: with SMTP id s3mr33166612pfk.60.1546130359000; Sat, 29 Dec 2018 16:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546130358; cv=none; d=google.com; s=arc-20160816; b=KSEqvUQkIbEVx5fBjExsrqFM3AX9mXvYqH008E/bmDQ2DJq58P5ilUR9S/HVNMghYJ MgbWD11vObQtNd6j4iydOMtoIYFYsXrStHZAVIXnGFtGZmQ3AMPhadisM9QJIeaGgOOC jXJ/rkIFaGwFqGrFD3ERWuPJQSVsizsqRrlr741LTvemepqCEwOqGXawk4ykvOTBq+6V UDWcxMxUu4xAbsNt9qalPyNlWPCvul8+9Mo/fz3t//hvOPwTCFQab/UCqUfEJ6zbOY2W UN6YWHVx8peKraU+tm4b8bnDh0fhxkFd4dPQYDcMlG70z0M/ByfxUMTCtDcewsmvmhQ3 jaGA== 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=o0oBUkqD5p4j+xffeWUiyhsv44vkKiTcEHnXCi5uSdo=; b=tso8QVHABmiPr9CK1i17NAtzuqsriZ+eI5u+9l2a5Pt4gJ5m1/JaahJ42SsiFyBHU7 U9VxJleszyE+fiaddZrzp74dcnMwWBA/ybL509i6KtZcLI60ZaMljdQ2gpLaKAYhD2u6 iaF6ydDQllb0MSnaja7u1B2PgOKhMm4jjgiyM9nf3IxiqMWSWuU0uRU24LL+kPuTHOAq idh5BejLWV8f6UOxpM/z+NWjW9HLnAw/tBTXHqIjCruOB+73BwAOrYAG1UWsuS7mrKMt HWcVNgxLeKTidwU/cTaGlH3RUrrDjQgxvIGCmhtGHZ0GOHPKTjmmwFRgrkP5ZHZkONlJ WooQ== 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 x8si40679606plo.259.2018.12.29.16.39.03; Sat, 29 Dec 2018 16:39:18 -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 S1727443AbeL2W1o (ORCPT + 99 others); Sat, 29 Dec 2018 17:27:44 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:33856 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727272AbeL2W1o (ORCPT ); Sat, 29 Dec 2018 17:27:44 -0500 Received: by mail-qk1-f196.google.com with SMTP id q8so14270670qke.1 for ; Sat, 29 Dec 2018 14:27:44 -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=o0oBUkqD5p4j+xffeWUiyhsv44vkKiTcEHnXCi5uSdo=; b=GJjtEWFWZOIKp4HzgPQzB4+ugDQi0Nk3/9MXvgbcb5h1IBzY78Aea360NMRd4dYSMO LE+fKD+45/xSytdaxuhYTu/8F3Th1DX2oIq3NdZj1lMU8ppCFaYcxyrUjAAGamiYaDFn W11J4Bcb/foZvMtLpCkbEavml2s9tSb9D/voGhlSKMfKtxRCl7pdaBc2FGLiMBYDEFYs +xhBF65G9GuS+munDRvNhEmonY1KlQuyHh/Hcv4Iom2nwmM+KmWBayYaeAFs1xYdPLbK dl5XeYQjrqS8boNvfoowQHEGX1nPhujDi39XZNrfEkk8A4eLw02Dn80xp6ozlyvIgiJ1 BJfQ== X-Gm-Message-State: AJcUukdZbg81Qf7h+eM27BpWcnbIpiwjGZ37YX+gwwKttG86rKh7sb2+ jvSf7NKMYIcDeBuAyxBdlng8UFJlL/v3ZdqjxJM= X-Received: by 2002:a37:bdc6:: with SMTP id n189mr29013373qkf.330.1546122463680; Sat, 29 Dec 2018 14:27:43 -0800 (PST) MIME-Version: 1.0 References: <505240b144f1666acf26a3c1e93c8e6868fe1408.1545784679.git.fthain@telegraphics.com.au> In-Reply-To: <505240b144f1666acf26a3c1e93c8e6868fe1408.1545784679.git.fthain@telegraphics.com.au> From: Arnd Bergmann Date: Sat, 29 Dec 2018 23:27:27 +0100 Message-ID: Subject: Re: [PATCH v8 13/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions To: Finn Thain Cc: Greg Kroah-Hartman , Geert Uytterhoeven , Joshua Thompson , Linux Kernel Mailing List , linux-m68k , linuxppc-dev 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 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? 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). Arnd