mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alan Cox <alan@linux.intel.com>,
	mingo@elte.hu, linux-kernel@vger.kernel.org,
	Sreedhara DS <sreedhara.ds@intel.com>
Subject: Re: [PATCH] IPC driver for Intel Mobile Internet Device (MID) platforms
Date: Thu, 22 Apr 2010 14:16:11 +0100	[thread overview]
Message-ID: <20100422141611.2599ee67@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20100421131615.d8430a50.akpm@linux-foundation.org>

> __packed, please.  (I've requested that this be added to checkpatch,
> but Mr Checkpatch is asleep).

Done


> > +static inline int busy_loop(void) /* Wait till scu status is busy */
> > +{
> > +	u32 status = 0;
> > +	u32 loop_count = 0;
> > +
> > +	status = __raw_readl(IPC_STATUS_REG);
> > +	while (status & 1) {
> > +		udelay(1); /* scu processing time is in few u secods */
> > +		status = __raw_readl(IPC_STATUS_REG);
> > +		loop_count++;
> > +		/* break if scu doesn't reset busy bit after huge retry */
> > +		if (loop_count > 100000)
> > +			return -ETIMEDOUT;

> This function has seven-odd callsites and is waaaaaaaay to fat and slow
> to be inlined.

Looking at the asm I'm not convinced.


> > +	if (id == IPC_CMD_PCNTRL_R) { /* Read rbuf */
> > +		/* Workaround: values are read as 0 without memcpy_fromio */
> > +		memcpy_fromio(cbuf, IPC_READ_BUFFER, 16);
> 
> Should we still be doing this if busy_loop() failed?
> 
> (Lots of dittoes on this question)

Does no harm

> > +}
> 
> I wonder if this function would look better if cbuf had type u16[],

No - we do byte aligned access to it. and cbuf[offset + 1.5] is sadly not
supported by C (although I suspect you can make it work in C++ ;))

> > +	mutex_lock(&ipclock);
> > +	if (ipcdev.pdev == NULL) {
> 
> This check happens a lot.  Can it really happen?

Yes.

> I think mailbox_base could/should have had type `struct
> fw_update_mailbox __iomem *'.  ioremap_nocache() should handle that
> cleanly, and this cast goes away.

Definitely - and the rest them cleans up by magic

Alan

  parent reply	other threads:[~2010-04-22 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 10:29 Alan Cox
2010-04-21 20:16 ` Andrew Morton
2010-04-21 20:26   ` Alan Cox
2010-04-22 13:16   ` Alan Cox [this message]
2010-04-22 13:41     ` Andrew Morton

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=20100422141611.2599ee67@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sreedhara.ds@intel.com \
    /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®