From: Greg KH <greg@kroah.com>
To: Mike Murphy <mamurph@cs.clemson.edu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
linux-usb@vger.kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, Oliver Neukum <oliver@neukum.org>
Subject: Re: [PATCH] (revision 1) input: xpad.c - Xbox 360 wireless and sysfs support
Date: Mon, 23 Feb 2009 15:26:21 -0800 [thread overview]
Message-ID: <20090223232621.GC8829@kroah.com> (raw)
In-Reply-To: <5aa163d00902220921s7c42f307xda6df7b071849fe4@mail.gmail.com>
On Sun, Feb 22, 2009 at 12:21:10PM -0500, Mike Murphy wrote:
> On Sun, Feb 22, 2009 at 1:48 AM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> ...
> >> +static ssize_t xpad_store_rumble_enable(struct device *dev,
> >> + struct device_attribute *attr, const char *buf, size_t count)
> >> +{
> >> + struct usb_xpad *xpad = to_xpad(dev);
> >> + int newrumble = xpad->rumble_enable;
> >> + if (1 == sscanf(buf, "%d", &newrumble))
> >
> >
> > Oh, that's not wrong but it looks weird, usually, a code reader would
> > expect to see if (sscanf(...) == 1)
> >
>
> Oops... I changed some stuff around (deleted an unneeded variable) and
> didn't change the test form back.
>
> The "backwards" expression is a trick that some of us teach when
> teaching C, for the specific case of comparing a variable to a
> constant. It allows the compiler to check for an unintentional "="
> where a "==" was desired. (foo = 4) is not an error or a warning
Yes it is, on modern versions of gcc.
thanks,
greg k-h
prev parent reply other threads:[~2009-02-23 23:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-22 5:31 [PATCH] (revision 1) input: xpad.c - Xbox 360 wireless and sysfs support Mike Murphy
2009-02-22 5:31 ` Mike Murphy
2009-02-22 6:48 ` Frederic Weisbecker
2009-02-22 17:21 ` Mike Murphy
2009-02-22 17:21 ` Mike Murphy
2009-02-23 23:26 ` Greg KH [this message]
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=20090223232621.GC8829@kroah.com \
--to=greg@kroah.com \
--cc=fweisbec@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mamurph@cs.clemson.edu \
--cc=oliver@neukum.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.