All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Lee Jones <lee.jones@linaro.org>,
	Doug Anderson <dianders@chromium.org>,
	Bill Richardson <wfrichar@chromium.org>,
	Simon Glass <sjg@google.com>,
	Gwendal Grignou <gwendal@google.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Varka Bhadram <varkabhadram@gmail.com>,
	Paul Bolle <pebolle@tiscali.nl>,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/7] platform/chrome: Add Chrome OS EC userspace device interface
Date: Wed, 25 Feb 2015 16:54:25 -0800	[thread overview]
Message-ID: <20150226005425.GA3101@quad.lixom.net> (raw)
In-Reply-To: <1422876388-16540-5-git-send-email-javier.martinez@collabora.co.uk>

On Mon, Feb 02, 2015 at 12:26:25PM +0100, Javier Martinez Canillas wrote:
> From: Bill Richardson <wfrichar@chromium.org>
> 
> This patch adds a device interface to access the
> Chrome OS Embedded Controller from user-space.
> 
> Signed-off-by: Bill Richardson <wfrichar@chromium.org>
> Reviewed-by: Simon Glass <sjg@google.com>
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> ---
> 
> Changes since v4: None.
> 
> Changes since v3: None.
> 
> Changes since v2:
>  - Rename the devname to "cros-ec-ctl". Suggested by Lee Jones.
>  - Added Gwendal Grignou Reviewed-by tag.
> 
> Changes since v1: None, new patch.

Hi,

> ---
>  Documentation/ioctl/ioctl-number.txt  |   1 +
>  drivers/platform/chrome/Kconfig       |  14 +-
>  drivers/platform/chrome/Makefile      |   1 +
>  drivers/platform/chrome/cros_ec_dev.c | 268 ++++++++++++++++++++++++++++++++++
>  drivers/platform/chrome/cros_ec_dev.h |  47 ++++++
>  5 files changed, 328 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/platform/chrome/cros_ec_dev.c
>  create mode 100644 drivers/platform/chrome/cros_ec_dev.h
> 
> diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
> index 8136e1fd30fd..51f4221657bf 100644
> --- a/Documentation/ioctl/ioctl-number.txt
> +++ b/Documentation/ioctl/ioctl-number.txt
> @@ -321,6 +321,7 @@ Code  Seq#(hex)	Include File		Comments
>  0xDB	00-0F	drivers/char/mwave/mwavepub.h
>  0xDD	00-3F	ZFCP device driver	see drivers/s390/scsi/
>  					<mailto:aherrman@de.ibm.com>
> +0xEC	00-01	drivers/platform/chrome/cros_ec_dev.h	ChromeOS EC driver

It seems like a bad idea to reuse the same ioctl numbers as the out-of-tree
driver but changing the arguments. So please allocate a few more and use 2/3
for this calling interface.

[...]

> new file mode 100644
> index 000000000000..15c54c4c5531
> --- /dev/null
> +++ b/drivers/platform/chrome/cros_ec_dev.h
> @@ -0,0 +1,47 @@
> +/*
> + * cros_ec_dev - expose the Chrome OS Embedded Controller to userspace
> + *
> + * Copyright (C) 2014 Google, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef _CROS_EC_DEV_H_
> +#define _CROS_EC_DEV_H_
> +
> +#include <linux/ioctl.h>
> +#include <linux/types.h>
> +#include <linux/mfd/cros_ec.h>
> +
> +#define CROS_EC_DEV_NAME "cros_ec"
> +#define CROS_EC_DEV_VERSION "1.0.0"
> +
> +/*
> + * @offset: within EC_LPC_ADDR_MEMMAP region
> + * @bytes: number of bytes to read. zero means "read a string" (including '\0')
> + *         (at most only EC_MEMMAP_SIZE bytes can be read)
> + * @buffer: where to store the result
> + * ioctl returns the number of bytes read, negative on error
> + */
> +struct cros_ec_readmem {
> +	uint32_t offset;
> +	uint32_t bytes;
> +	uint8_t buffer[EC_MEMMAP_SIZE];
> +};
> +
> +#define CROS_EC_DEV_IOC       0xEC
> +#define CROS_EC_DEV_IOCXCMD   _IOWR(CROS_EC_DEV_IOC, 0, struct cros_ec_command)
> +#define CROS_EC_DEV_IOCRDMEM  _IOWR(CROS_EC_DEV_IOC, 1, struct cros_ec_readmem)

I.e. go with 2/3 here.

(I can just do that change when I apply this patch, let me know if you prefer
that).


-Olof
> 

  reply	other threads:[~2015-02-26  0:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 11:26 [PATCH v5 0/7] platform/chrome: Add user-space dev inferface support Javier Martinez Canillas
2015-02-02 11:26 ` [PATCH v5 1/7] mfd: cros_ec: Use fixed size arrays to transfer data with the EC Javier Martinez Canillas
2015-02-02 11:26 ` [PATCH v5 2/7] mfd: cros_ec: Add char dev and virtual dev pointers Javier Martinez Canillas
2015-02-02 11:26 ` [PATCH v5 3/7] platform/chrome: Add cros_ec_lpc driver for x86 devices Javier Martinez Canillas
2015-02-02 11:26 ` [PATCH v5 4/7] platform/chrome: Add Chrome OS EC userspace device interface Javier Martinez Canillas
2015-02-26  0:54   ` Olof Johansson [this message]
2015-02-26  1:13     ` Gwendal Grignou
2015-02-26  9:08       ` Javier Martinez Canillas
2015-02-26 17:38         ` Olof Johansson
2015-02-02 11:26 ` [PATCH v5 5/7] mfd: cros_ec: Instantiate ChromeOS EC character device Javier Martinez Canillas
2015-02-02 11:26 ` [PATCH v5 6/7] platform/chrome: Create sysfs attributes for the ChromeOS EC Javier Martinez Canillas
2015-02-02 11:26 ` [PATCH v5 7/7] platform/chrome: Expose Chrome OS Lightbar to users Javier Martinez Canillas
2015-02-16  8:19 ` [PATCH v5 0/7] platform/chrome: Add user-space dev inferface support Javier Martinez Canillas
2015-02-18  2:26   ` Simon Glass
2015-02-18  9:27     ` Javier Martinez Canillas
2015-02-26  0:59     ` Olof Johansson
2015-02-26 16:00       ` Simon Glass
2015-02-26  0:57   ` Olof Johansson
2015-02-26 23:35 ` Gwendal Grignou
2015-02-27  0:11   ` Olof Johansson
2015-02-27  5:17     ` Javier Martinez Canillas

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=20150226005425.GA3101@quad.lixom.net \
    --to=olof@lixom.net \
    --cc=corbet@lwn.net \
    --cc=dianders@chromium.org \
    --cc=gwendal@google.com \
    --cc=javier.martinez@collabora.co.uk \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=sjg@google.com \
    --cc=varkabhadram@gmail.com \
    --cc=wfrichar@chromium.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.