mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Joshua Thompson <funaho@jurai.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch: m68k: mac: misc.c: Remove some unused functions
Date: Sun, 4 Jan 2015 18:21:42 +1100 (AEDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.1501041045020.15927@nippy.intranet> (raw)
In-Reply-To: <1420131732-31039-1-git-send-email-rickard_strandqvist@spectrumdigital.se>


On Thu, 1 Jan 2015, Rickard Strandqvist wrote:

> Removes some functions that are not used anywhere:
> mac_pram_write() mac_pram_read()
> 

If you remove those functions, you'd then find that all of the called 
functions become unused:

maciisi_read_pram
maciisi_write_pram
pmu_read_pram
pmu_write_pram
cuda_read_pram
cuda_write_pram
via_read_pram
via_write_pram

I'd rather not remove all of this code. Better to finish the 
implementation.

If we provide access to the PRAM (i.e. NVRAM) from userspace then the 
EMILE bootloader would be able to assign the boot device, for example.

Within the kernel, the CUDA PRAM functions could be used by valkyriefb to 
determine the correct default video mode (see comment in that driver).

Would it be acceptable to utilize drivers/char/generic_nvram.c and 
CONFIG_GENERIC_NVRAM? This is the PowerMac PRAM driver but looks generic 
enough that it may not need any modification for 68k Macs.

-- 

> This was partially found by using a static code analysis program called 
> cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>  arch/m68k/mac/misc.c |   46 ----------------------------------------------
>  1 file changed, 46 deletions(-)
> 
> diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
> index 707b61a..6fe7eb6 100644
> --- a/arch/m68k/mac/misc.c
> +++ b/arch/m68k/mac/misc.c
> @@ -453,52 +453,6 @@ void pmu_shutdown(void)
>   *-------------------------------------------------------------------
>   */
>  
> -void mac_pram_read(int offset, __u8 *buffer, int len)
> -{
> -	__u8 (*func)(int);
> -	int i;
> -
> -	switch(macintosh_config->adb_type) {
> -	case MAC_ADB_IISI:
> -		func = maciisi_read_pram; break;
> -	case MAC_ADB_PB1:
> -	case MAC_ADB_PB2:
> -		func = pmu_read_pram; break;
> -	case MAC_ADB_CUDA:
> -		func = cuda_read_pram; break;
> -	default:
> -		func = via_read_pram;
> -	}
> -	if (!func)
> -		return;
> -	for (i = 0 ; i < len ; i++) {
> -		buffer[i] = (*func)(offset++);
> -	}
> -}
> -
> -void mac_pram_write(int offset, __u8 *buffer, int len)
> -{
> -	void (*func)(int, __u8);
> -	int i;
> -
> -	switch(macintosh_config->adb_type) {
> -	case MAC_ADB_IISI:
> -		func = maciisi_write_pram; break;
> -	case MAC_ADB_PB1:
> -	case MAC_ADB_PB2:
> -		func = pmu_write_pram; break;
> -	case MAC_ADB_CUDA:
> -		func = cuda_write_pram; break;
> -	default:
> -		func = via_write_pram;
> -	}
> -	if (!func)
> -		return;
> -	for (i = 0 ; i < len ; i++) {
> -		(*func)(offset++, buffer[i]);
> -	}
> -}
> -
>  void mac_poweroff(void)
>  {
>  	/*
> 

  reply	other threads:[~2015-01-04  7:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01 17:02 Rickard Strandqvist
2015-01-04  7:21 ` Finn Thain [this message]
2015-01-04 19:36   ` Geert Uytterhoeven
2015-02-01  3:39     ` nvram and generic_nvram modules are problematic, was " Finn Thain
2015-02-01  8:42       ` Russell King - ARM Linux
2015-02-03  6:11         ` Finn Thain
2015-02-01  9:11       ` Geert Uytterhoeven
2015-02-03  3:22         ` Finn Thain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1501041045020.15927@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=funaho@jurai.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=rickard_strandqvist@spectrumdigital.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®