Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10660986imu; Mon, 31 Dec 2018 04:18:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN5QLdfeEccQWQh83qIgDTnXl4PKKV0EPtr0cxbTp1CnCa4w2oLBEKmVct5lfkVtx0SPZeNN X-Received: by 2002:a17:902:7791:: with SMTP id o17mr36471548pll.60.1546258708782; Mon, 31 Dec 2018 04:18:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546258708; cv=none; d=google.com; s=arc-20160816; b=z22guzUQ7UA8Y62/KiPvqLENTUdVg27RIfo952QIIyPXbt5h0A/vMlCAjoxlX4tQhI qE8Jw5buzfz9EZewCDPduP0gjNqXoXmUY2DUBHBoVaXtmyS/W4V1VXTrm4W0ypaxSUwf tlQawaqJmoWoz9uXrjfgMmAlux31M5KOqHe9PwGy1rdCIy976VjUIeOB0FVGFuPl+4gn O1AgaLmujtMgC0IMbfH36CM3KKJpKN+mHy4mXcgv4eG5+kD0n1EtT2gp36b6ezOe9OPx Qoqwz3LOBQK/d7dnKxi/+12n8S8gSKZu6DiFR4DA4otHzTum65jL/60C9mLdroA5Q2EZ ztvA== 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=UVT+VfMStcHdKtf7fNwd4LBoX1A0p8UlQm2STswVEBw=; b=rbJzX/nJ1ECPyoRJWrgA2o2gJg8nbYrWjEoMuO1RbNtRNm7nlMe4SydXlRcs774wZD 5A6VtA2tRNvxlEcAIMCNOel7J9AERkpw7RXoOoITeOgL4p3iwYAnCMxIXmaBCmNP0OoA EL9TYnpZTPkU0b6QbmH9wHio2XHCzLvnWgoUyhzpXVL0rVFpq5a0kHHFIYQm7Ux4oyO9 L/JIfSBw8GaAvbO/gWnmvF4EzPfi0e9+ZCVrzLrJR6mUnZoxzFQhsGxP5rBbjqsYxdC0 lJVGDbujPsGA9G6qLfGSs5T5XjBplkpyndJLa+GnK9XDjjNY53d/Bm49ocQZRR7RcQnZ Gjuw== 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 y15si44287192pgf.321.2018.12.31.04.18.00; Mon, 31 Dec 2018 04:18:28 -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 S1727220AbeLaMQh (ORCPT + 99 others); Mon, 31 Dec 2018 07:16:37 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:40959 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbeLaMQh (ORCPT ); Mon, 31 Dec 2018 07:16:37 -0500 Received: by mail-qk1-f196.google.com with SMTP id y16so15609064qki.7 for ; Mon, 31 Dec 2018 04:16:36 -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=UVT+VfMStcHdKtf7fNwd4LBoX1A0p8UlQm2STswVEBw=; b=EkPoKuhzzu+23MW4wGx+Ybr3+wKMFJBKHUStNULD6TuyfRwxNge4TfRcMPb04cMl8c zZs2sf22VHTMhEEoYPuneFTiyCljydFzdv0v03fR/nF+2qCMRKEjI6u6ziF/Vw+I0vK0 +W2OjfE4HpnUH8h3YWIkUk+c/VT1Q71227dAodlc0+GxUvTPVLo2D9wojSEOOCmdaIqi icoCpIsUxIUqvRgwhZS1CligCIeWTObTco0VPorjaSFf9dRn2KA1q0VevAEYZBGnBkGN pkBPJ9SO0Ems+LVvZug7eM0/6c3jrOxf2iL5RVllCAIP4PmvQxFjYUN8RIlSA25NPt2M 23iA== X-Gm-Message-State: AJcUukfackoz+ow6E1DtwlVg7K4jYtfaDJU78imq4ijluc7Z4L/RptCP nYgXvpgNVh///Qsbkwd1j420ltTA/yr7uBzTEjQ= X-Received: by 2002:a37:bdc6:: with SMTP id n189mr33366179qkf.330.1546258596087; Mon, 31 Dec 2018 04:16:36 -0800 (PST) MIME-Version: 1.0 References: <3ba1dd965c1097e00463eafe7c7d5fd93bbed836.1545784679.git.fthain@telegraphics.com.au> In-Reply-To: From: Arnd Bergmann Date: Mon, 31 Dec 2018 13:16:19 +0100 Message-ID: Subject: Re: [PATCH v8 18/25] powerpc: Implement nvram sync ioctl To: Finn Thain Cc: Greg Kroah-Hartman , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , 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 Sun, Dec 30, 2018 at 8:25 AM Finn Thain wrote: > > On Sat, 29 Dec 2018, Arnd Bergmann wrote: > > > > --- a/drivers/char/nvram.c > > > +++ b/drivers/char/nvram.c > > > @@ -48,6 +48,10 @@ > > > #include > > > #include > > > > > > +#ifdef CONFIG_PPC > > > +#include > > > +#include > > > +#endif > > > > > > static DEFINE_MUTEX(nvram_mutex); > > > static DEFINE_SPINLOCK(nvram_state_lock); > > > @@ -331,6 +335,37 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd, > > > long ret = -ENOTTY; > > > > > > switch (cmd) { > > > +#ifdef CONFIG_PPC > > > + case OBSOLETE_PMAC_NVRAM_GET_OFFSET: > > > + pr_warn("nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n"); > > > + /* fall through */ > > > + case IOC_NVRAM_GET_OFFSET: > > > + ret = -EINVAL; > > > +#ifdef CONFIG_PPC_PMAC > > > > I think it would make be nicer here to keep the ppc bits in arch/ppc, > > and instead add a .ioctl() callback to nvram_ops. > > > > The problem with having an nvram_ops.ioctl() method is the code in the > !PPC branch. That code would get duplicated because it's needed by both > X86 and M68K, to implement the checksum ioctls. I was thinking you'd just have a common ioctl function that falls back to the .ioctl callback for any unhandled commands like switch (cmd) { case NVRAM_INIT: ... break; case ...: break; default: if (ops->ioctl) return ops->ioctl(...); return -EINVAL; } Would that work? Arnd