lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 26 Nov 2012 19:41:24 +0100
From:	Benjamin Tissoires <benjamin.tissoires@...il.com>
To:	Christopher Heiny <cheiny@...aptics.com>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Jean Delvare <khali@...ux-fr.org>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Linux Input <linux-input@...r.kernel.org>,
	Allie Xiong <axiong@...aptics.com>,
	Vivian Ly <vly@...aptics.com>,
	Daniel Rosenberg <daniel.rosenberg@...aptics.com>,
	Alexandra Chin <alexandra.chin@...synaptics.com>,
	Joerie de Gram <j.de.gram@...il.com>,
	Wolfram Sang <w.sang@...gutronix.de>,
	Mathieu Poirier <mathieu.poirier@...aro.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Linus Walleij <linus.walleij@...ricsson.com>,
	Naveen Kumar Gaddipati <naveen.gaddipati@...ricsson.com>
Subject: Re: [RFC PATCH 02/06] input/rmi4: Core files

Hi Christopher,

On Sat, Nov 17, 2012 at 4:58 AM, Christopher Heiny <cheiny@...aptics.com> wrote:
> rmi_bus.c implements the basic functionality of the RMI bus.  This file is
> greatly simplified compared to the previous patch - we've switched from
> "do it yourself" device/driver binding to using device_type to distinguish
> between the two kinds of devices on the bus (sensor devices and function
> specific devices) and using the standard bus implementation to manage devices
> and drivers.
>
>
> rmi_driver.c is a driver for the general functionality of the RMI sensor as a
> whole, managing those behaviors (including IRQ handling) that are not specific
> to any RMI4 function.  It has some unavoidable dependencies on F01 behavior,
> though we have worked to minimize those as far as possible.
>
>
> The header file rmi_driver.h provides definitions that are shared among
> the modules of the RMI implementation, but not thought to be necessary
> outside it.
>
>
> Greg KH - Linus Walleij recommended that we seek your input on these core
> files, particularly the bus implementation.
>
>
> Signed-off-by: Christopher Heiny <cheiny@...aptics.com>
>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>
> Cc: Linus Walleij <linus.walleij@...ricsson.com>
> Cc: Naveen Kumar Gaddipati <naveen.gaddipati@...ricsson.com>
> Cc: Joeri de Gram <j.de.gram@...il.com>
>
> ---
>
>  drivers/input/rmi4/rmi_bus.c    |  248 ++++++
>  drivers/input/rmi4/rmi_driver.c | 1663 +++++++++++++++++++++++++++++++++++++++
>  drivers/input/rmi4/rmi_driver.h |  139 ++++
>  include/uapi/linux/input.h      |    1 +
>  4 files changed, 2051 insertions(+), 0 deletions(-)
>
[snipped]
> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> new file mode 100644
> index 0000000..05a73ae
> --- /dev/null
> +++ b/drivers/input/rmi4/rmi_driver.c
[snipped]
> +/* extract product ID */
> +void get_prod_id(struct rmi_device *rmi_dev, struct rmi_driver_data *drvdata)
> +{
> +       struct device *dev = &rmi_dev->dev;
> +       int retval;
> +       int board = 0, rev = 0;
> +       int i;
> +       static const char * const pattern[] = {
> +               "tm%4d-%d", "s%4d-%d", "s%4d-ver%1d"};
> +       u8 product_id[RMI_PRODUCT_ID_LENGTH+1];
> +
> +       retval = rmi_read_block(rmi_dev,
> +               drvdata->f01_container->fd.query_base_addr+
> +               sizeof(struct f01_basic_queries),
> +               product_id, RMI_PRODUCT_ID_LENGTH);
> +       if (retval < 0) {
> +               dev_err(dev, "Failed to read product id, code=%d!", retval);
> +               return;
> +       }
> +       product_id[RMI_PRODUCT_ID_LENGTH] = '\0';
> +
> +       for (i = 0; i < sizeof(product_id); i++)
> +               product_id[i] = tolower(product_id[i]);
> +
> +       for (i = 0; i < sizeof(pattern); i++) {

This should be ARRAY_SIZE(pattern).
It gave me a wonderful kernel oops :)

Cheers,
Benjamin

> +               retval = sscanf(product_id, pattern[i], &board, &rev);
> +               if (retval)
> +                       break;
> +       }
> +       /* save board and rev data in the rmi_driver_data */
> +       drvdata->board = board;
> +       drvdata->rev = rev;
> +       dev_dbg(dev, "Rmi_driver getProdID, set board: %d rev: %d\n",
> +               drvdata->board, drvdata->rev);
> +}
> +
[snipped]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ