All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Jochen Friedrich <jochen@scram.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [RFC/PATCHv3] powerpc: Move CPM command handling into the cpm drivers
Date: Mon, 26 Nov 2007 09:52:50 -0600	[thread overview]
Message-ID: <474AEBD2.3040504@freescale.com> (raw)
In-Reply-To: <474886C2.7030609@scram.de>

Jochen Friedrich wrote:
> diff --git a/arch/powerpc/sysdev/commproc.c 
> b/arch/powerpc/sysdev/commproc.c
> index f6a6378..2426bcb 100644
> --- a/arch/powerpc/sysdev/commproc.c
> +++ b/arch/powerpc/sysdev/commproc.c
> @@ -240,6 +240,34 @@ void __init cpm_reset(void)
> #endif
> }
> 
> +static DEFINE_SPINLOCK(cmd_lock);
> +
> +#define MAX_CR_CMD_LOOPS        10000
> +
> +int cpm_command(u32 command, u8 opcode)
> +{
> +    int i, ret;
> +    unsigned long flags;
> +
> +    if (command & 0xffffff0f)
> +        return -EINVAL;
> +
> +    spin_lock_irqsave(&cmd_lock, flags);

I'm a little uneasy about this -- what's the longest it can take for the 
CPM command to complete (or timeout)?  I'd rather use a mutex, if we can 
make sure that it's never called from atomic context.

> +
> +    ret = 0;
> +    out_be16(&cpmp->cp_cpcr, command | CPM_CR_FLG | (opcode << 8));
> +    for (i = 0; i < MAX_CR_CMD_LOOPS; i++)
> +        if ((in_be16(&cpmp->cp_cpcr) & CPM_CR_FLG) == 0)
> +            goto out;
> +
> +    printk(KERN_ERR "%s(): Not able to issue CPM command\n", 
> __FUNCTION__);
> +    ret = -EIO;
> +out:
> +    spin_unlock_irqrestore(&cmd_lock, flags);
> +    return ret;
> +}
> +EXPORT_SYMBOL_GPL(cpm_command);

Can we please not play the GPL DRM game here?

Besides, Documentation/DocBook/kernel-hacking.tmpl explicitly says that 
"It implies that the function is considered an internal implementation 
issue, and not really an interface."

I don't think this is the case here.

-Scott

  reply	other threads:[~2007-11-26 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-24 20:17 [RFC/PATCHv3] powerpc: Move CPM command handling into the cpm drivers Jochen Friedrich
2007-11-26 15:52 ` Scott Wood [this message]
2007-11-26 16:56   ` Jochen Friedrich

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=474AEBD2.3040504@freescale.com \
    --to=scottwood@freescale.com \
    --cc=jochen@scram.de \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.