Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9328769imu; Sat, 29 Dec 2018 16:38:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN61bcSE8ibI7r4mYMnoPTrz+sueHQ1/zb5CLGb39h2v+yhdtzZ8ZyLGzlzGAMKV80G/vuF8 X-Received: by 2002:a62:6385:: with SMTP id x127mr33779052pfb.15.1546130330090; Sat, 29 Dec 2018 16:38:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546130330; cv=none; d=google.com; s=arc-20160816; b=XC1sSNRRGdIcfhC/tR0NnEDvrQXFtVgYukbWeOzl0hqFQxkt+7RIf5DQiOjMLzqvQ2 wkJY0BxJUTSz/mDk3GwV3nze4CQJjAnJVaFO888VaMvdgmvptb4KouTsMN8g8g5uUY9m iVmKk3VL+Z9AzzmPrug6IrwZETPfl718jPEYQg+TD6Z7d0hPBKRi3QfSUAKWmXluWwj0 VbQYasEIcXzRqMgclnmu7N+gKtaFmkwkIt+VFIDovUSzVuaLfXFJJ4ZfReXzmRega+mS udYP4dS5kfRnhF4IhO8wIAe3n/t3cWkwGY7lploef2xM4E0bOFf2PCwb3bZuPHTgvi2j K6ag== 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=gEKNttcn2DuV6IUidckb9z98s4YMQSt0m/gFTL7QWxY=; b=mvJXb9BYd62fRR8QGsO6KUaf1USIf2v2A8cXvesCWJXQ8Vt83un7YJ7hpLaXfFfuYF Tig3KcWA1i9WKgzExJe9CnXI7CzHY4GZn9AbrbYgr/SDhfNzOSBf4KY3gIOK2/1oOr2I IJJTAUSqWns9bk13U8Hhg/gS2+9lFWRstLh5SZ7cwsJICbbrIAgLrz1qCU99D/sg0AzW CKW7F4r+tZDFLzsShI0ZfV4EfM2iB37YqLMpwKT8c/wBJjLwx5I8DpDsSjpZmA/jNzJK lDF4XOdswZP9lprsp08Ps4RvYBomUBnmL7+Vl9Q6YltpCWE7WYrHyECnZURFm0EL9/JS 1Ezw== 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 k69si41939205pga.176.2018.12.29.16.38.34; Sat, 29 Dec 2018 16:38:50 -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 S1727174AbeL2WUP (ORCPT + 99 others); Sat, 29 Dec 2018 17:20:15 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:35809 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726912AbeL2WUP (ORCPT ); Sat, 29 Dec 2018 17:20:15 -0500 Received: by mail-qt1-f196.google.com with SMTP id v11so26569547qtc.2 for ; Sat, 29 Dec 2018 14:20:14 -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=gEKNttcn2DuV6IUidckb9z98s4YMQSt0m/gFTL7QWxY=; b=shwh4ihixViS4Lg9Tm9sbCvuoLdDLfLCsT50s76NHskzs/NW+C1psJ9rwNVoa+pCL+ neuE/Gb6zu6rVtYyabpf6kRVJfxrPBmqwixDqjNNXYh/mxcmy+Qd7ecsyimTn7Sfr5sT 3gDY/rxkRQyrDI4maO0Vec2+jB+/C4n3DePJ0K9piMdE0/i/md1YpqDZtm4D262kPo+l +p8Ff1bjeW4i9AC62f+B2/BAJZkmUkBT8CdAfTbIq8LNd64KTaaYn09cb9aDT1/spQE7 iHu5fI7Vrkd+3vrTU6K4cvpRGFDi4XjMzi+kcdNeofK7bDf1KgsBjPAw6Ug8MWi7tSPX CHuA== X-Gm-Message-State: AA+aEWZDSyIsVL79mqP7K5cHQ2HwdBzjHfpeoCbYdeBdEN+ayLKr9B5i TwaQnFsMT4qGGyKXOaNG7bNO4gx6Tu6L/nMZ8eY= X-Received: by 2002:ac8:7451:: with SMTP id h17mr30221440qtr.319.1546122013947; Sat, 29 Dec 2018 14:20:13 -0800 (PST) MIME-Version: 1.0 References: <3ba1dd965c1097e00463eafe7c7d5fd93bbed836.1545784679.git.fthain@telegraphics.com.au> In-Reply-To: <3ba1dd965c1097e00463eafe7c7d5fd93bbed836.1545784679.git.fthain@telegraphics.com.au> From: Arnd Bergmann Date: Sat, 29 Dec 2018 23:19:57 +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 > --- 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. > @@ -369,12 +405,14 @@ static int nvram_misc_open(struct inode *inode, struct file *file) > return -EBUSY; > } > > +#ifndef CONFIG_PPC > /* Prevent multiple writers if the set_checksum ioctl is implemented. */ > if ((arch_nvram_ops.set_checksum != NULL) && > (file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE)) { > spin_unlock(&nvram_state_lock); > return -EBUSY; > } > +#endif > > diff --git a/include/linux/nvram.h b/include/linux/nvram.h > index b7bfaec60a43..24a57675dba1 100644 > --- a/include/linux/nvram.h > +++ b/include/linux/nvram.h > @@ -18,8 +18,12 @@ struct nvram_ops { > unsigned char (*read_byte)(int); > void (*write_byte)(unsigned char, int); > ssize_t (*get_size)(void); > +#ifdef CONFIG_PPC > + long (*sync)(void); > +#else > long (*set_checksum)(void); > long (*initialize)(void); > +#endif > }; Maybe just leave all entries visible here, and avoid the above #ifdef checks. Arnd