linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Milton Miller <miltonm@bga.com>,
	linuxppc-dev@ozlabs.org, Steven Rostedt <srostedt@redhat.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/5] powerpc: ftrace, convert to new dynamic ftrace arch API
Date: Mon, 24 Nov 2008 12:43:23 +1100	[thread overview]
Message-ID: <18730.1723.708467.812600@drongo.ozlabs.ibm.com> (raw)
In-Reply-To: <20081120191149.285359258@goodmis.org>

Steven Rostedt writes:

> Thanks to Paul Mackennas for pointing out the mistakes of my original

Mackerras

> +static int test_24bit_addr(unsigned long ip, unsigned long addr)
> +{
> +	long diff;
> +
> +	/*
> +	 * Can we get to addr from ip in 24 bits?
> +	 *  (26 really, since we mulitply by 4 for 4 byte alignment)
> +	 */
> +	diff = addr - ip;
> +
> +	/*
> +	 * Return true if diff is less than 1 << 25
> +	 *  and greater than -1 << 26.
> +	 */
> +	return (diff < (1 << 25)) && (diff > (-1 << 26));

I think this still isn't right, and the comment is one of those ones
that is only useful to people who can't read C, as it's just a
transliteration of the code.

The comment should say something like "Return true if diff can be
represented as a 26-bit twos-complement binary number" and the second
part of the test should be (diff >= (-1 << 25)).  However, since you
define a test_offset() function in patch 4/5 that does the same test
but using only one comparison instead of two, why don't you just say:

	return !test_offset(diff);

(having first moved test_offset() before test_24bit_addr)?

Paul.

  reply	other threads:[~2008-11-24  1:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 19:09 [PATCH 0/5] powerpc: dynamic ftrace port Steven Rostedt
2008-11-20 19:09 ` [PATCH 1/5] powerpc: ftrace, do not latency trace idle Steven Rostedt
2008-11-20 19:09 ` [PATCH 2/5] powerpc: ftrace, convert to new dynamic ftrace arch API Steven Rostedt
2008-11-24  1:43   ` Paul Mackerras [this message]
2008-11-24  2:49     ` Michael Ellerman
2008-11-24 18:00     ` Steven Rostedt
2008-11-20 19:09 ` [PATCH 3/5] powerpc: ftrace, use probe_kernel API to modify code Steven Rostedt
2008-11-20 19:09 ` [PATCH 4/5] powerpc/ppc64: ftrace, handle module trampolines for dyn ftrace Steven Rostedt
2008-11-24  2:26   ` Paul Mackerras
2008-11-24 17:56     ` Steven Rostedt
2008-11-24 20:59     ` Steven Rostedt
2008-11-20 19:09 ` [PATCH 5/5] powerpc/ppc32: ftrace, dynamic ftrace to handle modules Steven Rostedt
2008-11-24  2:35   ` Paul Mackerras
2008-11-20 19:15 ` [PATCH 0/5] powerpc: dynamic ftrace port Steven Rostedt
2008-11-20 19:20   ` Ingo Molnar
2008-11-20 19:16 ` Ingo Molnar
2008-11-20 19:24   ` Steven Rostedt

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=18730.1723.708467.812600@drongo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=miltonm@bga.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).