From: Mike Murphy <mamurph@cs.clemson.edu>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg KH <greg@kroah.com>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
linux-usb@vger.kernel.org, oliver@neukum.org, fweisbec@gmail.com,
torvalds@linux-foundation.org
Subject: Re: PATCH [1/3] drivers/input/xpad.c: Improve Xbox 360 wireless support and add sysfs interface
Date: Mon, 2 Mar 2009 16:59:48 -0500 [thread overview]
Message-ID: <5aa163d00903021359x3a4693f5tbb7f1e3fec4d88b8@mail.gmail.com> (raw)
In-Reply-To: <20090302133551.1266f725.akpm@linux-foundation.org>
On Mon, Mar 2, 2009 at 4:35 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> OK. I think.
>
> - This approach will require a large number of edits each time an
> attribute is added/removed.
>
> - otoh, removing nasty macros is always nice.
>
> - This approach will generate slower code (which doesn't matter
> here).
>
> - Was it demonstrated that this approach generates less code?
>
It should generate less code, as compared to having two functions
(show and store) per attribute, in which each function has about 4
lines and a local variable for the store functions (which is there for
type validation). For both show and store functions, there still has
to be code to get to the struct usb_xpad instance.
As I was coding this interface, I found myself wishing for a
macro-based system like module parameters have. For example, it would
be nice to be able to do something like the following:
DECLARE_SYSFS_INTERFACE(&xpad->dead_zone, uint, &check_dead_zone);
which would create the needed show/store functions that worked with an
unsigned int. The check_dead_zone function would be a validator
function inside the module that would check the validity on a
user-supplied value on store (in this case, to be sure it was at least
1024 below the stick limit) and return an error code if the value were
out of range. Yes, the validator would be an extra function call, but
this code doesn't run in an interrupt context, so the benefit of being
able to centralize the functionality and simplify drivers might be
worth the extra overhead.
Mike
--
Mike Murphy
Ph.D. Candidate and NSF Graduate Research Fellow
Clemson University School of Computing
120 McAdams Hall
Clemson, SC 29634-0974 USA
Tel: +1 864.656.2838 Fax: +1 864.656.0145
http://cirg.cs.clemson.edu/~mamurph
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-03-02 21:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-01 4:53 PATCH [1/3] drivers/input/xpad.c: Improve Xbox 360 wireless support and add sysfs interface Mike Murphy
[not found] ` <5aa163d00902282053h38b0febbyb37fc30855fdc985-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-02 21:04 ` Andrew Morton
2009-03-02 21:18 ` Greg KH
[not found] ` <20090302211820.GA21489-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2009-03-02 21:35 ` Andrew Morton
[not found] ` <20090302133551.1266f725.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-03-02 21:59 ` Greg KH
2009-03-02 21:59 ` Mike Murphy [this message]
[not found] ` <5aa163d00903021359x3a4693f5tbb7f1e3fec4d88b8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-02 22:39 ` Greg KH
2009-03-02 23:04 ` Mike Murphy
[not found] ` <5aa163d00903021504l1965ecdi3423a43134de10d0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-02 23:13 ` Greg KH
2009-03-02 21:46 ` Mike Murphy
2009-03-02 22:00 ` Andrew Morton
2009-03-02 22:27 ` Mike Murphy
2009-03-03 2:47 ` Mike Murphy
2009-03-03 3:09 ` Mike Murphy
[not found] ` <5aa163d00903021847n525e8704jd332610c45e4675a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-03 3:12 ` Linus Torvalds
[not found] ` <alpine.LFD.2.00.0903021902460.3111-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-03-03 4:16 ` Mike Murphy
[not found] ` <5aa163d00903022016s14b7ad32qfbaf82a07b9e0921-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-03-03 4:20 ` Mike Murphy
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=5aa163d00903021359x3a4693f5tbb7f1e3fec4d88b8@mail.gmail.com \
--to=mamurph@cs.clemson.edu \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=greg@kroah.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=torvalds@linux-foundation.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 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).