Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5059657imu; Tue, 25 Dec 2018 16:47:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/X4Cml/8qP+nnN324U6d541XcwYJaYHdVtAgVCIwvMdR3qGqLo6CrgaYlMshP8kwdQ/kH/2 X-Received: by 2002:aa7:8286:: with SMTP id s6mr17903522pfm.63.1545785262883; Tue, 25 Dec 2018 16:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545785262; cv=none; d=google.com; s=arc-20160816; b=0Wu3guGbgI1nZ1dctgWDBLT0X8QdV2fVC3G6k96LeUXbcrDv4lu7n273026R370jyy 3XKSU/uXAxAITH+9nM5w4lcktCWaDqtk5xSVlXrRuBMKabSoGJS6X/vo1AQG3HMwV5E0 h041nmPQ9EN1uBR57bZqRXwwEljVSFCSuanJeKHnsQqztS0dSLiKMKoMLH/SwA3eQGC2 tPjhB/tLp019r8XswaP1Dh1wwuroXT1Zo0u9A/gOjlCKuILS9WgEYlelquAXtioy1Mc2 0WOTnTNDM53QWpt8H1U0Gdl43ZWjQcnhfWyKSWCVXsDdnst3Mo9xDeH7XELPzdu66r0F eAkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=xDw7OfAQBX+JcobIPTLM3qmAGQdKXITBsq/1pvUe//Q=; b=VcLniW3/TaE7Mg/2ULjA/BF2WfJHKsWhe8YeLU6aNebX6WnD1MqHqh2/HzkPEXpVf+ /3Q/zFyaZ7/6XIUQNCO3Zgbdgxk+GHhijoiUIEv5HFABLSrYVeogvFYD0hxihqKJ3oSt J+1H2ljRmci9ciCpgoSShMPctyb73FI9EvWBSxLLVlQ5mk/WQ9E+WqfDFlsRIPyi5vzX eYXjkZyUMKBH/5MAHL8VFpp0HEKTz5K6Pmor9y/JQ0iwJeTWBew18cskxnR+G71rKzu/ 2XwVDpjqUfTc8DL/XcZKNTvRohyEgHAAXo63Zor2LDOECDfkcpUHYvCpzrCKz9SA79yR 1MYw== 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 10si4226239pgk.101.2018.12.25.16.47.28; Tue, 25 Dec 2018 16:47:42 -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 S1729785AbeLZApc (ORCPT + 99 others); Tue, 25 Dec 2018 19:45:32 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:57348 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbeLZAoB (ORCPT ); Tue, 25 Dec 2018 19:44:01 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id B984C29526; Tue, 25 Dec 2018 19:43:56 -0500 (EST) To: Arnd Bergmann , Greg Kroah-Hartman , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org Message-Id: <185de04191ba2e0a5cafb12760ff65b1dbfad24e.1545784679.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v8 17/25] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports Date: Wed, 26 Dec 2018 11:37:59 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement arch_nvram_ops for PPC32 and make use of it in the generic_nvram misc device module so that the nvram_* function exports can be removed. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- arch/powerpc/include/asm/nvram.h | 3 --- arch/powerpc/kernel/setup_32.c | 10 +++++++--- drivers/char/generic_nvram.c | 24 ++++++++++++------------ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h index 1443b40f44b9..56a388da9c4f 100644 --- a/arch/powerpc/include/asm/nvram.h +++ b/arch/powerpc/include/asm/nvram.h @@ -98,7 +98,4 @@ extern int nvram_write_os_partition(struct nvram_os_partition *part, unsigned int err_type, unsigned int error_log_cnt); -/* Determine NVRAM size */ -extern ssize_t nvram_get_size(void); - #endif /* _ASM_POWERPC_NVRAM_H */ diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 04c0315cfe46..ee91bba0805d 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -168,13 +168,12 @@ void nvram_write_byte(unsigned char val, int addr) } EXPORT_SYMBOL(nvram_write_byte); -ssize_t nvram_get_size(void) +static ssize_t ppc_nvram_get_size(void) { if (ppc_md.nvram_size) return ppc_md.nvram_size(); - return -1; + return -ENODEV; } -EXPORT_SYMBOL(nvram_get_size); void nvram_sync(void) { @@ -183,6 +182,11 @@ void nvram_sync(void) } EXPORT_SYMBOL(nvram_sync); +const struct nvram_ops arch_nvram_ops = { + .get_size = ppc_nvram_get_size, +}; +EXPORT_SYMBOL(arch_nvram_ops); + #endif /* CONFIG_NVRAM */ static int __init ppc_init(void) diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c index 0381af638fe3..a7dfde734897 100644 --- a/drivers/char/generic_nvram.c +++ b/drivers/char/generic_nvram.c @@ -28,8 +28,6 @@ #include #endif -#define NVRAM_SIZE 8192 - static DEFINE_MUTEX(nvram_mutex); static ssize_t nvram_len; @@ -134,20 +132,22 @@ static struct miscdevice nvram_dev = { int __init nvram_init(void) { - int ret = 0; + int ret; - printk(KERN_INFO "Generic non-volatile memory driver v%s\n", - NVRAM_VERSION); - ret = misc_register(&nvram_dev); - if (ret != 0) - goto out; + if (arch_nvram_ops.get_size == NULL) + return -ENODEV; - nvram_len = nvram_get_size(); + nvram_len = arch_nvram_ops.get_size(); if (nvram_len < 0) - nvram_len = NVRAM_SIZE; + return nvram_len; -out: - return ret; + ret = misc_register(&nvram_dev); + if (ret) + return ret; + + pr_info("Generic non-volatile memory driver v%s\n", NVRAM_VERSION); + + return 0; } void __exit nvram_cleanup(void) -- 2.19.2