From: Arnd Bergmann <arnd@arndb.de>
To: Nathan Royer <nroyer@invensense.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Greg Kroah-Hartman" <gregkh@suse.de>,
Jonathan Cameron <jic23@cam.ac.uk>, Jiri Kosina <jkosina@suse.cz>,
Alan Cox <alan@linux.intel.com>,
Jean Delvare <khali@linux-fr.org>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH 01/11] misc: inv_mpu primary header file and README file.
Date: Fri, 1 Jul 2011 23:04:18 +0200 [thread overview]
Message-ID: <201107012304.19073.arnd@arndb.de> (raw)
In-Reply-To: <1309486707-1658-1-git-send-email-nroyer@invensense.com>
On Friday 01 July 2011 04:18:17 Nathan Royer wrote:
> +/* Structure for the following IOCTS's
> + * MPU_CONFIG_GYRO
> + * MPU_CONFIG_ACCEL
> + * MPU_CONFIG_COMPASS
> + * MPU_CONFIG_PRESSURE
> + * MPU_GET_CONFIG_GYRO
> + * MPU_GET_CONFIG_ACCEL
> + * MPU_GET_CONFIG_COMPASS
> + * MPU_GET_CONFIG_PRESSURE
> + *
> + * @key one of enum ext_slave_config_key
> + * @len length of data pointed to by data
> + * @apply zero if communication with the chip is not necessary, false otherwise
> + * This flag can be used to select cached data or to refresh cashed data
> + * cache data to be pushed later or push immediately. If true and the
> + * slave is on the secondary bus the MPU will first enger bypass mode
> + * before calling the slaves .config or .get_config funcion
> + * @data pointer to the data to confgure or get
> + */
> +struct ext_slave_config {
> + __u8 key;
> + __u16 len;
> + __u8 apply;
> + void *data;
> +};
I'm a bit worried about the ioctl interface, it seems overloaded and has
problems with 32/64 bit compatibility. In general, having void pointers
in an structure that is used as an ioctl argument is a sign that the
interface is too complex. In fact, there are a number of reasons why you
should try to avoid pointers in there completely.
You should also try to avoid padding in structures. The definition you
have could be any of 64/96/128 bytes long depending on the architecture,
and leak kernel stack data.
Having separate commands on a single device file in order to do the
same operation on distinct pieces of hardware sounds like a wrong
abstraction of your devices. Instead, it would seem more appropriate
to represent each hardware endpoint (gyro/accel/compass/...) as one
character device, and let each of them export the same minimum set of
commands. However, the suggestion to use an existing subsystem (iio,
input, hwmon, ...) for each of the endpoints as appropriate would fit
better into the existing use cases.
I haven't been able to figure out if all those endpoints are just
I2C devices and could be handled by i2c drivers for those subsystems,
or if you have another hardware interface that groups of them. In the
latter case, would an MFD driver work for this? The idea of that is
essentially to prove a new bus_type without having to do all the
abstraction work when you already know all the devices behind it.
Arnd
prev parent reply other threads:[~2011-07-01 21:05 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-01 2:18 [PATCH 01/11] misc: inv_mpu primary header file and README file Nathan Royer
2011-07-01 2:18 ` [PATCH 02/11] misc: mpu3050 Register definition and Private data Nathan Royer
2011-07-01 2:18 ` [PATCH 03/11] misc: mpu3050 /dev/mpu implementation Nathan Royer
2011-07-01 2:18 ` [PATCH 04/11] misc: IRQ handling for MPU3050 and slave devices Nathan Royer
2011-07-01 2:18 ` [PATCH 05/11] misc: MPU3050 and slave device configuration Nathan Royer
2011-07-01 17:55 ` Nathan Royer
2011-07-01 2:18 ` [PATCH 06/11] misc: inv_mpu logging and debugging support Nathan Royer
2011-07-01 2:18 ` [PATCH 07/11] misc: I2C communication with the MPU3050 and slave devices Nathan Royer
2011-07-01 2:18 ` [PATCH 08/11] misc: Kconfig and Makefile changes for inv_mpu driver Nathan Royer
2011-07-01 17:10 ` Randy Dunlap
2011-07-01 2:18 ` [PATCH 09/11] misc: Add slave driver for kxtf9 accelerometer Nathan Royer
2011-07-01 2:18 ` [PATCH 10/11] misc: Add slave driver for ak8975 compass driver Nathan Royer
2011-07-01 2:18 ` [PATCH 11/11] misc: Add slave driver for bma085 pressure sensor Nathan Royer
2011-07-01 7:56 ` Alan Cox
2011-07-01 8:47 ` Jean Delvare
2011-07-01 14:28 ` Chris Wolfe
2011-07-01 14:41 ` Alan Cox
2011-07-01 15:52 ` Chris Wolfe
2011-07-01 17:00 ` Alan Cox
2011-07-01 17:56 ` Nathan Royer
2011-07-01 16:09 ` Jean Delvare
2011-07-01 9:05 ` Jonathan Cameron
2011-07-01 10:35 ` Manuel Stahl
2011-07-01 3:09 ` [PATCH 01/11] misc: inv_mpu primary header file and README file Greg KH
2011-07-01 7:29 ` Alan Cox
2011-07-01 9:00 ` Jonathan Cameron
2011-07-01 3:59 ` Chris Wolfe
2011-07-05 18:08 ` Nathan Royer
2011-07-01 7:53 ` Alan Cox
2011-07-01 9:08 ` Jonathan Cameron
2011-07-01 16:39 ` Nathan Royer
2011-07-03 11:29 ` Jonathan Cameron
2011-07-04 8:16 ` Alan Cox
2011-07-06 1:49 ` Nathan Royer
2011-07-06 9:07 ` Jonathan Cameron
2011-07-06 20:25 ` Nathan Royer
2011-07-06 10:54 ` Alan Cox
2011-07-06 21:27 ` Nathan Royer
2011-07-07 7:40 ` Alan Cox
2011-07-08 1:25 ` Nathan Royer
2011-07-08 11:21 ` Jonathan Cameron
2011-07-08 16:24 ` Nathan Royer
2011-07-04 20:06 ` Eric Andersson
2011-07-01 21:04 ` Arnd Bergmann [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=201107012304.19073.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=alan@linux.intel.com \
--cc=gregkh@suse.de \
--cc=jic23@cam.ac.uk \
--cc=jkosina@suse.cz \
--cc=khali@linux-fr.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nroyer@invensense.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