Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4320856imu; Mon, 14 Jan 2019 20:27:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN5vZ/CmgyWSUYLwIgNQeITBDCDRfY3Pdo9XV5XKeBozUmxDzX3ckXdnIAFbK3ae2T0RR7U2 X-Received: by 2002:a63:dc0c:: with SMTP id s12mr2031057pgg.398.1547526426647; Mon, 14 Jan 2019 20:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547526426; cv=none; d=google.com; s=arc-20160816; b=Hn7oX1xyI4ESvzB79iWH8iBnxDOed4aj07KWcWWxX53M0/9JBEdHwZxcOB1tNlELyS BSA82DkRcErbmBtCt3B2FUcFS+gHEylurqITqvE1fOVsDtyUxvvyeymyBHj4+vf2p5oB SOnAN+APrVHEJBZsGbroPMA2rw8KL/oHvTy8qx1UxOlZ4usXEKfhCcOM2Buy+KfLZVyf 2rTMZTe1scU9imdgFUX+Kl+X7ExCvEUJqyk6+AyCTf/MVsGv92//Ni6JP8XhZtREPmDS x9QQfqWEiGQgqx10jRMlJC2miMAsvNwFpsXSJzAlyMXUXRnHYSQS+p8S17bnV842aP6f dJpQ== 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=6syf8nApMHSyBZ/R4oq2G7+asMygmY08lNac0Ajx+co=; b=IISigjmOrtLdeB5zVv/Af8AfW98ZRJT2ld3a8BrDpcYsvAc0VeJOxJaj+aV0X8CRJ+ iod+7+VBIUqr3OTJ/T/x4ckHOv40k7zt4LW/kmeHWDdPgMe8ofi1MMYaK1o/ZGbzeKIl 6HdToLthEavxaczf8tndAYks2IlXtS1pcFG88OTqHAu1j0ej9wFpXOh6GS/b9hKgaoPQ ojclc3EMLkLeEmjWfndwa7zGNsm9H4kx4LNoIeO6xsnee5r2ZLFCU9nPQohD1DSvRju6 rQQhrsfOicW4R3X6o0QE5tscfciPhgZHr2CDzhM3I9g1912/fXwZewMXkMnBErltJK3b 469w== 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 s62si2429087pgc.113.2019.01.14.20.26.51; Mon, 14 Jan 2019 20:27:06 -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 S1728350AbfAOEXV (ORCPT + 99 others); Mon, 14 Jan 2019 23:23:21 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:37548 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728211AbfAOEW3 (ORCPT ); Mon, 14 Jan 2019 23:22:29 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 5F94029E6C; Mon, 14 Jan 2019 23:22:24 -0500 (EST) To: Arnd Bergmann , Greg Kroah-Hartman , Joshua Thompson , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org Message-Id: In-Reply-To: References: From: Finn Thain Subject: [PATCH v9 11/22] m68k/mac: Adopt naming and calling conventions for PRAM routines Date: Tue, 15 Jan 2019 15:18:56 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adopt the existing *_read_byte and *_write_byte naming convention. Rename via_pram_readbyte and via_pram_writebyte to avoid confusion. Adjust calling conventions of mac_pram_* functions to match the struct nvram_ops methods. Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Changed since v7: - Removed some gratuitous function pointers. --- arch/m68k/mac/misc.c | 61 +++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 71c4735a31ee..78c807025436 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -37,7 +37,7 @@ static void (*rom_reset)(void); #ifdef CONFIG_ADB_CUDA -static __u8 cuda_read_pram(int offset) +static unsigned char cuda_pram_read_byte(int offset) { struct adb_request req; @@ -49,7 +49,7 @@ static __u8 cuda_read_pram(int offset) return req.reply[3]; } -static void cuda_write_pram(int offset, __u8 data) +static void cuda_pram_write_byte(unsigned char data, int offset) { struct adb_request req; @@ -62,7 +62,7 @@ static void cuda_write_pram(int offset, __u8 data) #endif /* CONFIG_ADB_CUDA */ #ifdef CONFIG_ADB_PMU -static __u8 pmu_read_pram(int offset) +static unsigned char pmu_pram_read_byte(int offset) { struct adb_request req; @@ -74,7 +74,7 @@ static __u8 pmu_read_pram(int offset) return req.reply[3]; } -static void pmu_write_pram(int offset, __u8 data) +static void pmu_pram_write_byte(unsigned char data, int offset) { struct adb_request req; @@ -93,7 +93,7 @@ static void pmu_write_pram(int offset, __u8 data) * the RTC should be enabled. */ -static __u8 via_pram_readbyte(void) +static __u8 via_rtc_recv(void) { int i, reg; __u8 data; @@ -120,7 +120,7 @@ static __u8 via_pram_readbyte(void) return data; } -static void via_pram_writebyte(__u8 data) +static void via_rtc_send(__u8 data) { int i, reg, bit; @@ -157,17 +157,17 @@ static void via_pram_command(int command, __u8 *data) via1[vBufB] = (via1[vBufB] | VIA1B_vRTCClk) & ~VIA1B_vRTCEnb; if (command & 0xFF00) { /* extended (two-byte) command */ - via_pram_writebyte((command & 0xFF00) >> 8); - via_pram_writebyte(command & 0xFF); + via_rtc_send((command & 0xFF00) >> 8); + via_rtc_send(command & 0xFF); is_read = command & 0x8000; } else { /* one-byte command */ - via_pram_writebyte(command); + via_rtc_send(command); is_read = command & 0x80; } if (is_read) { - *data = via_pram_readbyte(); + *data = via_rtc_recv(); } else { - via_pram_writebyte(*data); + via_rtc_send(*data); } /* All done, disable the RTC */ @@ -177,12 +177,12 @@ static void via_pram_command(int command, __u8 *data) local_irq_restore(flags); } -static __u8 via_read_pram(int offset) +static unsigned char via_pram_read_byte(int offset) { return 0; } -static void via_write_pram(int offset, __u8 data) +static void via_pram_write_byte(unsigned char data, int offset) { } @@ -326,63 +326,48 @@ static void cuda_shutdown(void) *------------------------------------------------------------------- */ -void mac_pram_read(int offset, __u8 *buffer, int len) +unsigned char mac_pram_read_byte(int addr) { - __u8 (*func)(int); - int i; - switch (macintosh_config->adb_type) { case MAC_ADB_IOP: case MAC_ADB_II: case MAC_ADB_PB1: - func = via_read_pram; - break; + return via_pram_read_byte(addr); #ifdef CONFIG_ADB_CUDA case MAC_ADB_EGRET: case MAC_ADB_CUDA: - func = cuda_read_pram; - break; + return cuda_pram_read_byte(addr); #endif #ifdef CONFIG_ADB_PMU case MAC_ADB_PB2: - func = pmu_read_pram; - break; + return pmu_pram_read_byte(addr); #endif default: - return; - } - for (i = 0 ; i < len ; i++) { - buffer[i] = (*func)(offset++); + return 0xFF; } } -void mac_pram_write(int offset, __u8 *buffer, int len) +void mac_pram_write_byte(unsigned char val, int addr) { - void (*func)(int, __u8); - int i; - switch (macintosh_config->adb_type) { case MAC_ADB_IOP: case MAC_ADB_II: case MAC_ADB_PB1: - func = via_write_pram; + via_pram_write_byte(val, addr); break; #ifdef CONFIG_ADB_CUDA case MAC_ADB_EGRET: case MAC_ADB_CUDA: - func = cuda_write_pram; + cuda_pram_write_byte(val, addr); break; #endif #ifdef CONFIG_ADB_PMU case MAC_ADB_PB2: - func = pmu_write_pram; + pmu_pram_write_byte(val, addr); break; #endif default: - return; - } - for (i = 0 ; i < len ; i++) { - (*func)(offset++, buffer[i]); + break; } } -- 2.19.2