* Re: [PATCH v2 2/6] input: touchscreen: imx25 tcq driver
From: Russell King - ARM Linux @ 2014-06-29 11:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Fabio Estevam, Lars-Peter Clausen, Samuel Ortiz, Eric Bénard,
linux-iio-u79uwXL29TY76Z2rM5mHXA, Dmitry Torokhov, Denis Carikli,
Sascha Hauer, linux-input-u79uwXL29TY76Z2rM5mHXA, Markus Pargmann,
Shawn Guo, Lee Jones,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <53AFF1C4.1010402-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On Sun, Jun 29, 2014 at 12:00:20PM +0100, Jonathan Cameron wrote:
> On 21/06/14 20:55, Fabio Estevam wrote:
>> On Sat, Jun 21, 2014 at 7:18 AM, Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>>> +
>>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>
>>> Could this not in theory fail?
>>
>> Yes, but devm_ioremap_resource will take care of it, so we don't need
>> to check for error here.
> Nothing like counter intuitive behaviour. Ah well.
>
> Thanks for explaining this!
Maybe it would be better to have:
mem = platform_ioremap_resource(pdev, IORESOURCE_MEM, 0);
which wraps up both the platform_get_resource() call with
devm_ioremap_resource() so driver writers don't have to be concerned
about this aspect?
--
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
^ permalink raw reply
* Re: [PATCH v4 3/6] iio: adc: fsl,imx25-gcq driver
From: Jonathan Cameron @ 2014-06-29 11:32 UTC (permalink / raw)
To: Denis Carikli, Shawn Guo, Samuel Ortiz, Dmitry Torokhov,
Fabio Estevam, Peter Meerwald, Hartmut Knaack
Cc: Eric Bénard, Sascha Hauer,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Lee Jones,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA, Lars-Peter Clausen,
Markus Pargmann, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala
In-Reply-To: <1403621195-9622-3-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
On 24/06/14 15:46, Denis Carikli wrote:
> From: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>
> This is a conversion queue driver for the mx25 SoC. It uses the central
> ADC which is used by two seperate independent queues. This driver
> prepares different conversion configurations for each possible input.
> For a conversion it creates a conversionqueue of one item with the
> correct configuration for the chosen channel. It then executes the queue
> once and disables the conversion queue afterwards.
>
> The reference voltages are configurable through devicetree subnodes,
> depending on the connections of the ADC inputs.
>
> Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Signed-off-by: Denis Carikli <denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
Locking issue in read_raw and trivial other stuff.
> ---
> Changelog v3->v4:
> - Reworked the ADC reference voltage bindings.
> - IIO_CHAN_INFO_SCALE is now handled.
> - Lot of code and style cleanups.
> - Tested by watching WIPER become 0 when the touchscreen is touched.
>
> Changelog v2->v3:
> - Fixed compilation: I forgott to tell that this IIO patch was untested
> in the previous cover letter. Now it is tested at runtime:
> I left the touchscreen connected but I configured the TSC as an ADC
> instead, set the refp to internal reference, and the refn to ngnd_adc(3)
> for the first 4 channels(xp,yp,xn,yn) and observed the values changing
> while touching the resistive 4-wire touchscreen.
> - MX25_IIO_CHAN now became MX25_GCQ_CHAN and its .address is now gone
> and the code using it adapted.
> - The instances of struct iio_dev were renamed from idev to indio_dev.
> - regmap_read return value is now checked in mx25_gcq_read_raw.
> - Comparisons with MX25_NUM_CFGS are now fixed
> - Cosmetics fix in a multiline comment.
> ---
> .../devicetree/bindings/iio/adc/fsl,imx25-gcq.txt | 51 +++
> drivers/iio/adc/Kconfig | 7 +
> drivers/iio/adc/Makefile | 1 +
> drivers/iio/adc/fsl-imx25-gcq.c | 371 ++++++++++++++++++++
> include/dt-bindings/iio/adc/fsl-imx25-gcq.h | 11 +
> 5 files changed, 441 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt
> create mode 100644 drivers/iio/adc/fsl-imx25-gcq.c
> create mode 100644 include/dt-bindings/iio/adc/fsl-imx25-gcq.h
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt
> new file mode 100644
> index 0000000..e4a7170
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/fsl,imx25-gcq.txt
> @@ -0,0 +1,51 @@
> +Freescale i.MX25 ADC GCQ device
> +
> +This is a generic conversion queue device that can convert any of the
> +analog inputs using the ADC unit of the i.MX25.
> +
> +Required properties:
> + - compatible: Should be "fsl,imx25-gcq".
> + - reg: Should be the register range of the module.
> + - interrupts: Should be the interrupt number of the module.
> + Typically this is <1>.
> + - interrupt-parent: phandle to the tsadc module of the i.MX25.
> + - #address-cells: Should be <1> (setting for the subnodes)
> + - #size-cells: Should be <0> (setting for the subnodes)
> +
> +Optional properties:
> + - vref-supply: The regulator supplying the ADC refrence voltage.
> + Required when at least one subnode uses the external reference.
> +
> +Sub-nodes:
> +Optionally you can define subnodes which define the reference voltage
> +for the analog inputs.
> +
> +Required properties for subnodes:
> + - reg: Should be the number of the analog input.
> + 0: xp
> + 1: yp
> + 2: xn
> + 3: yn
> + 4: wiper
> + 5: inaux0
> + 6: inaux1
> + 7: inaux2
> + - fsl,adc-ref: specifies the reference input as defined in
> + <dt-bindings/iio/adc/fsl-imx25-gcq.h>
> + MX25_ADC_REF_INT and MX25_ADC_REF_EXT flags are supported.
> +
> +Example:
> +
> + adc: adc@50030800 {
> + compatible = "fsl,imx25-gcq";
> + reg = <0x50030800 0x60>;
> + interrupt-parent = <&tscadc>;
> + interrupts = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + inaux@5 {
> + reg = <5>;
> + fsl,adc-ref = <MX25_ADC_REF_INT>;
> + };
> + };
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index a80d236..58efb8d 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -125,6 +125,13 @@ config EXYNOS_ADC
> of SoCs for drivers such as the touchscreen and hwmon to use to share
> this resource.
>
> +config FSL_MX25_ADC
> + tristate "Freescale MX25 ADC driver"
> + depends on MFD_MX25_TSADC
> + help
> + Generic Conversion Queue driver used for general purpose ADC in the
> + MX25. This driver supports single measurements using the MX25 ADC.
> +
> config LP8788_ADC
> tristate "LP8788 ADC driver"
> depends on MFD_LP8788
> diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
> index 9d60f2d..2767fd6 100644
> --- a/drivers/iio/adc/Makefile
> +++ b/drivers/iio/adc/Makefile
> @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7887) += ad7887.o
> obj-$(CONFIG_AD799X) += ad799x.o
> obj-$(CONFIG_AT91_ADC) += at91_adc.o
> obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o
> +obj-$(CONFIG_FSL_MX25_ADC) += fsl-imx25-gcq.o
> obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
> obj-$(CONFIG_MAX1363) += max1363.o
> obj-$(CONFIG_MCP320X) += mcp320x.o
> diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c
> new file mode 100644
> index 0000000..1e95553
> --- /dev/null
> +++ b/drivers/iio/adc/fsl-imx25-gcq.c
> @@ -0,0 +1,371 @@
> +/*
> + * Copyright 2014 Markus Pargmann, Pengutronix <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + *
> + * This is the driver for the imx25 GCQ (Generic Conversion Queue)
> + * connected to the imx25 ADC.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/interrupt.h>
> +#include <linux/iio/iio.h>
> +#include <linux/mfd/imx25-tsadc.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> +#include <dt-bindings/iio/adc/fsl-imx25-gcq.h>
> +
> +#define MX25_GCQ_TIMEOUT (msecs_to_jiffies(2000))
> +
> +enum mx25_gcq_cfgs {
> + MX25_CFG_XP = 0,
> + MX25_CFG_YP,
> + MX25_CFG_XN,
> + MX25_CFG_YN,
> + MX25_CFG_WIPER,
> + MX25_CFG_INAUX0,
> + MX25_CFG_INAUX1,
> + MX25_CFG_INAUX2,
> + MX25_NUM_CFGS,
> +};
> +
> +struct mx25_gcq_priv {
> + struct regmap *regs;
> + struct completion completed;
> + unsigned int settling_time;
> + struct clk *clk;
> + int irq;
> + struct regulator *ext_vref;
> + u32 channel_vref_mv[MX25_NUM_CFGS];
> +};
> +
> +#define MX25_CQG_CHAN(chan, id) {\
> + .type = IIO_VOLTAGE,\
> + .indexed = 1,\
> + .channel = chan,\
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),\
> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\
> + .datasheet_name = id,\
> +}
> +
> +static const struct iio_chan_spec mx25_gcq_channels[MX25_NUM_CFGS] = {
> + MX25_CQG_CHAN(0, "xp"),
> + MX25_CQG_CHAN(1, "yp"),
> + MX25_CQG_CHAN(2, "xn"),
> + MX25_CQG_CHAN(3, "yn"),
> + MX25_CQG_CHAN(4, "wiper"),
> + MX25_CQG_CHAN(5, "inaux0"),
> + MX25_CQG_CHAN(6, "inaux1"),
> + MX25_CQG_CHAN(7, "inaux2"),
> +};
> +
> +static void mx25_gcq_disable_eoq(struct mx25_gcq_priv *priv)
> +{
> + regmap_update_bits(priv->regs, MX25_ADCQ_MR, MX25_ADCQ_MR_EOQ_IRQ,
> + MX25_ADCQ_MR_EOQ_IRQ);
> +}
> +
> +static void mx25_gcq_enable_eoq(struct mx25_gcq_priv *priv)
> +{
> + regmap_update_bits(priv->regs, MX25_ADCQ_MR,
> + MX25_ADCQ_MR_EOQ_IRQ, 0);
> +}
> +
> +static irqreturn_t mx25_gcq_irq(int irq, void *data)
> +{
> + struct mx25_gcq_priv *priv = data;
> + u32 stats;
> +
> + regmap_read(priv->regs, MX25_ADCQ_SR, &stats);
> +
> + if (stats & MX25_ADCQ_SR_EOQ) {
> + mx25_gcq_disable_eoq(priv);
> + complete(&priv->completed);
> + }
> +
> + /* Disable conversion queue run */
> + regmap_update_bits(priv->regs, MX25_ADCQ_CR, MX25_ADCQ_CR_FQS, 0);
> +
> + /* Acknowledge all possible irqs */
> + regmap_write(priv->regs, MX25_ADCQ_SR, MX25_ADCQ_SR_FRR |
> + MX25_ADCQ_SR_FUR | MX25_ADCQ_SR_FOR |
> + MX25_ADCQ_SR_EOQ | MX25_ADCQ_SR_PD);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int mx25_gcq_read_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan, int *val, int *val2,
> + long mask)
> +{
> + struct mx25_gcq_priv *priv = iio_priv(indio_dev);
> + long timeout;
> + u32 data;
> + int ret;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_RAW:
> + mutex_lock(&indio_dev->mlock);
> +
> + /* Setup the configuration we want to use */
> + regmap_write(priv->regs, MX25_ADCQ_ITEM_7_0,
> + MX25_ADCQ_ITEM(0, chan->channel));
> +
> + mx25_gcq_enable_eoq(priv);
> +
> + /* Trigger queue for one run */
> + regmap_update_bits(priv->regs, MX25_ADCQ_CR, MX25_ADCQ_CR_FQS,
> + MX25_ADCQ_CR_FQS);
> +
> + timeout = wait_for_completion_interruptible_timeout(
> + &priv->completed, MX25_GCQ_TIMEOUT);
> + if (timeout < 0) {
> + dev_err(&indio_dev->dev,
> + "ADC wait for measurement failed\n");
> + ret = timeout;
> + goto out;
> + } else if (timeout == 0) {
> + dev_err(&indio_dev->dev, "ADC timed out\n");
> + ret = -ETIMEDOUT;
> + goto out;
> + }
> +
> + ret = regmap_read(priv->regs, MX25_ADCQ_FIFO, &data);
> + if (ret)
check your locking here.
> + return ret;
> +
> + *val = MX25_ADCQ_FIFO_DATA(data);
> + ret = IIO_VAL_INT;
> + goto out;
> +
> + case IIO_CHAN_INFO_SCALE:
Uggly to have the flow such that some cases statements take a lock
and do not release it themselves, whilst code layout wise this
one never takes it and returns before it would matter.
> + *val = priv->channel_vref_mv[chan->channel];
> + *val2 = 12;
> + return IIO_VAL_FRACTIONAL_LOG2;
> +
> + default:
> + return -EINVAL;
> + }
> +out:
> + mutex_unlock(&indio_dev->mlock);
> + return ret;
> +}
> +
> +static const struct iio_info mx25_gcq_iio_info = {
> + .read_raw = mx25_gcq_read_raw,
> +};
> +
> +static const struct regmap_config mx25_gcq_regconfig = {
> + .max_register = 0x5c,
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = 4,
> +};
> +
> +static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
> + struct mx25_gcq_priv *priv)
> +{
> + struct device_node *np = pdev->dev.of_node;
> + struct device_node *child;
> + struct device *dev = &pdev->dev;
> + int ret, i;
> +
> + /* Setup all configurations registers with a default conversion
Multiline comment syntax.
> + * configuration for each input
> + */
> + for (i = 0; i < MX25_NUM_CFGS; ++i)
> + regmap_write(priv->regs, MX25_ADCQ_CFG(i),
> + MX25_ADCQ_CFG_YPLL_OFF |
> + MX25_ADCQ_CFG_XNUR_OFF |
> + MX25_ADCQ_CFG_XPUL_OFF |
> + MX25_ADCQ_CFG_REFP_INT |
> + (i << 4) |
> + MX25_ADCQ_CFG_REFN_NGND2);
> +
> + for_each_child_of_node(np, child) {
> + u32 reg;
> + u32 refp;
> + u32 adc_ref;
> +
> + ret = of_property_read_u32(child, "reg", ®);
> + if (ret) {
> + dev_err(dev, "Failed to get reg property\n");
> + return ret;
> + }
> +
> + if (reg >= MX25_NUM_CFGS) {
> + dev_err(dev,
> + "reg value is greater than the number of available configuration registers\n");
> + return -EINVAL;
> + }
> +
> + ret = of_property_read_u32(child, "fsl,adc-ref", &adc_ref);
> + if (ret) {
> + dev_err(dev, "Failed to get fsl,adc-ref property\n");
> + return ret;
> + }
> +
> + if (adc_ref != MX25_ADC_REF_INT &&
> + adc_ref != MX25_ADC_REF_EXT) {
> + dev_err(dev, "Invalid fsl,adc-refp property value %d\n",
> + adc_ref);
> + return -EINVAL;
> + }
> +
> + switch (adc_ref) {
> + case MX25_ADC_REF_EXT:
> + if (IS_ERR_OR_NULL(priv->ext_vref)) {
> + dev_err(dev,
> + "No regulator found for the external vref\n");
> + return -EINVAL;
> + }
> + priv->channel_vref_mv[reg] =
> + regulator_get_voltage(priv->ext_vref);
> + refp = MX25_ADCQ_CFG_REFP_EXT;
> + break;
> + case MX25_ADC_REF_INT:
> + priv->channel_vref_mv[reg] = 2500;
> + refp = MX25_ADCQ_CFG_REFP_INT;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + regmap_update_bits(priv->regs, MX25_ADCQ_CFG(reg),
> + MX25_ADCQ_CFG_REFP_MASK |
> + MX25_ADCQ_CFG_REFN_MASK, (refp << 7) |
> + (MX25_ADCQ_CFG_REFN_NGND << 2));
> + }
> + regmap_update_bits(priv->regs, MX25_ADCQ_CR,
> + MX25_ADCQ_CR_FRST | MX25_ADCQ_CR_QRST,
> + MX25_ADCQ_CR_FRST | MX25_ADCQ_CR_QRST);
> +
> + regmap_write(priv->regs, MX25_ADCQ_CR,
> + MX25_ADCQ_CR_PDMSK |
> + MX25_ADCQ_CR_QSM_FQS);
> +
> + return 0;
> +}
> +
> +static int mx25_gcq_probe(struct platform_device *pdev)
> +{
> + struct iio_dev *indio_dev;
> + struct mx25_gcq_priv *priv;
> + struct mx25_tsadc *tsadc = dev_get_drvdata(pdev->dev.parent);
> + struct device *dev = &pdev->dev;
> + struct resource *res;
> + void __iomem *mem;
> + int ret;
> +
> + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + priv = iio_priv(indio_dev);
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + mem = devm_ioremap_resource(dev, res);
> + if (!mem)
> + return -ENOMEM;
> +
> + priv->regs = devm_regmap_init_mmio(dev, mem, &mx25_gcq_regconfig);
> + if (IS_ERR(priv->regs)) {
> + dev_err(dev, "Failed to initialize regmap\n");
> + return PTR_ERR(priv->regs);
> + }
> +
> + init_completion(&priv->completed);
> +
> + /* Optional external regulator */
> + priv->ext_vref = devm_regulator_get(&pdev->dev, "vref");
> + if (!IS_ERR_OR_NULL(priv->ext_vref)) {
> + ret = regulator_enable(priv->ext_vref);
> + if (ret)
> + return ret;
> + }
> +
> + ret = mx25_gcq_setup_cfgs(pdev, priv);
> + if (ret)
> + return ret;
> +
> + priv->clk = tsadc->clk;
> + ret = clk_prepare_enable(priv->clk);
> + if (ret) {
> + dev_err(dev, "Failed to enable clock\n");
> + return ret;
> + }
> +
> + priv->irq = platform_get_irq(pdev, 0);
> + if (priv->irq <= 0) {
> + dev_err(dev, "Failed to get IRQ\n");
> + ret = priv->irq;
> + goto err_clk_unprepare;
> + }
> +
> + ret = request_irq(priv->irq, mx25_gcq_irq, 0, pdev->name, priv);
> + if (ret) {
> + dev_err(dev, "Failed requesting IRQ\n");
> + goto err_clk_unprepare;
> + }
> +
> + indio_dev->dev.parent = &pdev->dev;
> + indio_dev->channels = mx25_gcq_channels;
> + indio_dev->num_channels = ARRAY_SIZE(mx25_gcq_channels);
> + indio_dev->info = &mx25_gcq_iio_info;
> +
> + ret = iio_device_register(indio_dev);
> + if (ret) {
> + dev_err(dev, "Failed to register iio device\n");
> + goto err_irq_free;
> + }
> +
> + platform_set_drvdata(pdev, priv);
> +
> + return 0;
> +
> +err_irq_free:
> + free_irq(priv->irq, (void *)priv);
> +err_clk_unprepare:
> + clk_disable_unprepare(priv->clk);
> + return ret;
> +}
> +
> +static int mx25_gcq_remove(struct platform_device *pdev)
> +{
> + struct mx25_gcq_priv *priv = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = iio_priv_to_dev(pdev);
> +
> + iio_device_unregister(indio_dev);
> + free_irq(priv->irq, priv);
> + clk_disable_unprepare(priv->clk);
> +
> + return 0;
> +}
> +
> +static struct of_device_id mx25_gcq_ids[] = {
> + { .compatible = "fsl,imx25-gcq", },
> + { /* Sentinel */ }
> +};
> +
> +static struct platform_driver mx25_gcq_driver = {
> + .driver = {
> + .name = "mx25-gcq",
> + .owner = THIS_MODULE,
> + .of_match_table = mx25_gcq_ids,
> + },
> + .probe = mx25_gcq_probe,
> + .remove = mx25_gcq_remove,
> +};
> +module_platform_driver(mx25_gcq_driver);
> +
> +MODULE_DESCRIPTION("ADC driver for Freescale mx25");
> +MODULE_AUTHOR("Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/dt-bindings/iio/adc/fsl-imx25-gcq.h b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h
> new file mode 100644
> index 0000000..486dce7
> --- /dev/null
> +++ b/include/dt-bindings/iio/adc/fsl-imx25-gcq.h
> @@ -0,0 +1,11 @@
> +/*
> + * This header provides constants for configuring the I.MX25 ADC
> + */
> +
> +#ifndef _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H
> +#define _DT_BINDINGS_IIO_ADC_FS_IMX25_GCQ_H
> +
> +#define MX25_ADC_REF_INT 0 /* Internal voltage reference */
> +#define MX25_ADC_REF_EXT 1 /* External voltage reference */
> +
> +#endif
>
^ permalink raw reply
* Re: [PATCH v2 3/6] iio: adc: fsl,imx25-gcq driver
From: Jonathan Cameron @ 2014-06-29 11:01 UTC (permalink / raw)
To: Denis Carikli, Shawn Guo, Samuel Ortiz, Dmitry Torokhov
Cc: Eric Bénard, Sascha Hauer,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Lee Jones,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA, Fabio Estevam,
Lars-Peter Clausen, Markus Pargmann, Devicetree List
In-Reply-To: <53A95533.8090500-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
On 24/06/14 11:38, Denis Carikli wrote:
> On 06/21/2014 12:30 PM, Jonathan Cameron wrote:
>>> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
>> No known info on converting this to real voltages? I'd normally expect
>> a scale parameter at least with any raw channel output, but fair enough
>> if it's not obvous what this should be.
>
> We know the internal reference voltage.
> We can also know the external reference voltage by representing it as a regulator.
>
> Since there are many combinations should a regulator for each reference(external reference, xp, yp, xn and yn) be used?
>
yes.
^ permalink raw reply
* Re: [PATCH v2 2/6] input: touchscreen: imx25 tcq driver
From: Jonathan Cameron @ 2014-06-29 11:00 UTC (permalink / raw)
To: Fabio Estevam
Cc: Denis Carikli, Shawn Guo, Samuel Ortiz, Dmitry Torokhov,
Eric Bénard, Sascha Hauer,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Lee Jones, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA, Lars-Peter Clausen,
Markus Pargmann
In-Reply-To: <CAOMZO5BxZDX5TDZdUCbpTw2LpVC=vr4cnn4eSpzd_023wcy+Fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 21/06/14 20:55, Fabio Estevam wrote:
> On Sat, Jun 21, 2014 at 7:18 AM, Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>> +
>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>
>> Could this not in theory fail?
>
> Yes, but devm_ioremap_resource will take care of it, so we don't need
> to check for error here.
Nothing like counter intuitive behaviour. Ah well.
Thanks for explaining this!
>
>>
>>> + mem = devm_ioremap_resource(dev, res);
>>> + if (!mem)
>>> + return -ENOMEM;
^ permalink raw reply
* [PATCH] HID: cp2112: add I2C mode
From: Antonio Borneo @ 2014-06-29 6:14 UTC (permalink / raw)
To: Jiri Kosina, linux-input, David Barksdale; +Cc: linux-kernel, Antonio Borneo
cp2112 supports single I2C read/write transactions.
It can't combine I2C transactions.
Add master_xfer, using similar code flow as for smbus_xfer.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
---
drivers/hid/hid-cp2112.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 101 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 3952d90..1260a8a 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -429,6 +429,104 @@ static int cp2112_write_req(void *buf, u8 slave_address, u8 command, u8 *data,
return data_length + 4;
}
+static int cp2112_i2c_write_req(void *buf, u8 slave_address, u8 *data,
+ u8 data_length)
+{
+ struct cp2112_write_req_report *report = buf;
+
+ if (data_length > sizeof(report->data))
+ return -EINVAL;
+
+ report->report = CP2112_DATA_WRITE_REQUEST;
+ report->slave_address = slave_address << 1;
+ report->length = data_length;
+ memcpy(report->data, data, data_length);
+ return data_length + 3;
+}
+
+static int cp2112_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
+ int num)
+{
+ struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data;
+ struct hid_device *hdev = dev->hdev;
+ u8 buf[64];
+ ssize_t count;
+ unsigned int retries;
+ int ret;
+
+ hid_dbg(hdev, "I2C %d messages\n", num);
+
+ if (num != 1) {
+ hid_err(hdev,
+ "Multi-message I2C transactions not supported\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (msgs->flags & I2C_M_RD)
+ count = cp2112_read_req(buf, msgs->addr, msgs->len);
+ else
+ count = cp2112_i2c_write_req(buf, msgs->addr, msgs->buf,
+ msgs->len);
+
+ if (count < 0)
+ return count;
+
+ ret = hid_hw_power(hdev, PM_HINT_FULLON);
+ if (ret < 0) {
+ hid_err(hdev, "power management error: %d\n", ret);
+ return ret;
+ }
+
+ ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT);
+ if (ret < 0) {
+ hid_warn(hdev, "Error starting transaction: %d\n", ret);
+ goto power_normal;
+ }
+
+ for (retries = 0; retries < XFER_STATUS_RETRIES; ++retries) {
+ ret = cp2112_xfer_status(dev);
+ if (-EBUSY == ret)
+ continue;
+ if (ret < 0)
+ goto power_normal;
+ break;
+ }
+
+ if (XFER_STATUS_RETRIES <= retries) {
+ hid_warn(hdev, "Transfer timed out, cancelling.\n");
+ buf[0] = CP2112_CANCEL_TRANSFER;
+ buf[1] = 0x01;
+
+ ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT);
+ if (ret < 0)
+ hid_warn(hdev, "Error cancelling transaction: %d\n",
+ ret);
+
+ ret = -ETIMEDOUT;
+ goto power_normal;
+ }
+
+ if (!(msgs->flags & I2C_M_RD)) {
+ ret = 0;
+ goto power_normal;
+ }
+
+ ret = cp2112_read(dev, msgs->buf, msgs->len);
+ if (ret < 0)
+ goto power_normal;
+ if (ret != msgs->len) {
+ hid_warn(hdev, "short read: %d < %d\n", ret, msgs->len);
+ ret = -EIO;
+ goto power_normal;
+ }
+
+ ret = 0;
+power_normal:
+ hid_hw_power(hdev, PM_HINT_NORMAL);
+ hid_dbg(hdev, "I2C transfer finished: %d\n", ret);
+ return (ret) ? ret : 1;
+}
+
static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, u8 command,
int size, union i2c_smbus_data *data)
@@ -595,7 +693,8 @@ power_normal:
static u32 cp2112_functionality(struct i2c_adapter *adap)
{
- return I2C_FUNC_SMBUS_BYTE |
+ return I2C_FUNC_I2C |
+ I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_BLOCK_DATA |
@@ -605,6 +704,7 @@ static u32 cp2112_functionality(struct i2c_adapter *adap)
}
static const struct i2c_algorithm smbus_algorithm = {
+ .master_xfer = cp2112_i2c_xfer,
.smbus_xfer = cp2112_xfer,
.functionality = cp2112_functionality,
};
--
2.0.1
^ permalink raw reply related
* [PATCH] HID: cp2112: fix gpio value in gpio_direction_output
From: Antonio Borneo @ 2014-06-29 6:13 UTC (permalink / raw)
To: Jiri Kosina, linux-input, David Barksdale; +Cc: linux-kernel, Antonio Borneo
CP2112 does not offer an atomic method to set both gpio
direction and value.
Also it does not permit to set gpio value before putting
gpio in output. In fact, accordingly to Silicon Labs
AN495, Rev. 0.2, cpt. 4.4, the HID report to set gpio
values "does not affect any pins that are not configured
as outputs".
This is confirmed on evaluation board CP2112-EK.
With current driver, after execute:
echo in > /sys/class/gpio/gpio248/direction
echo low > /sys/class/gpio/gpio248/direction
gpio output is still high. Only after a following
echo low > /sys/class/gpio/gpio248/direction
gpio output gets low.
Fix driver by changing order of operations; first set
direction then set value.
The drawback of this new sequence is that we can have
a pulse on gpio pin when direction is changed from
input to output-low, but this cannot be avoided on
current CP2112.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
---
drivers/hid/hid-cp2112.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 56be85a..3952d90 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -240,8 +240,6 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip,
u8 buf[5];
int ret;
- cp2112_gpio_set(chip, offset, value);
-
ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,
sizeof(buf), HID_FEATURE_REPORT,
HID_REQ_GET_REPORT);
@@ -260,6 +258,12 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip,
return ret;
}
+ /*
+ * Set gpio value when output direction is already set,
+ * as specified in AN495, Rev. 0.2, cpt. 4.4
+ */
+ cp2112_gpio_set(chip, offset, value);
+
return 0;
}
--
2.0.1
^ permalink raw reply related
* Re: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
From: Alan Stern @ 2014-06-28 21:58 UTC (permalink / raw)
To: Pavel Machek
Cc: Dr. H. Nikolaus Schaller, Lukas M?rdian, Dmitry Torokhov,
linux-input, LKML, Marek Belisko, Rafael J. Wysocki
In-Reply-To: <20140628200410.GA7561@amd.pavel.ucw.cz>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=UTF-8, Size: 2570 bytes --]
On Sat, 28 Jun 2014, Pavel Machek wrote:
> Hi!
>
> > >> This gives the userspace (Replicant) a chance to fully handle the
> > >> pm_wakeup_event, before autosleep suspends the system alltogether
> > >> again.
> > >>
> > >> This fixes suspend/resume on the OpenPhoenux GTA04, in combination with
> > >> the Replicant 4.2.2 userspace, which needs to execute this to stay
> > >> awake: 'echo on > /sys/power/state'
> > >>
> > >> Signed-off-by: Lukas Märdian <lukas@goldelico.com>
> > >> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> > >
> > > I'm sorry, but we should not be doing this.
> > >
> > > You basically put a delay in driver to work around userspace bug.
> >
> > Do you think it is a user-space bug if the kernel goes to sleep again
> > before giving user space any chance to react to an event?
>
> Well, who says 1000msec is enough? Some userspace may need
> more. ... for example on PC when you keyboard-handling deamon is
> swapped out.
>
> > And the msec parameter is described as:
> >
> > @msec: Anticipated event processing time (in milliseconds).
> >
> > Isn't calling pm_wakeup_event() with a non-zero msec the standard
> > method to handle this situation? And it is used in other drivers. E.g. in
> > _mmc_detect_change() or hub_suspend().
>
> * Notify the PM core of a wakeup event whose source is @ws that will
> take
> * approximately @msec milliseconds to be processed by the kernel. If
> @ws is
> * not active, activate it. If @msec is nonzero, set up the @ws'
> timer to
> * execute pm_wakeup_timer_fn() in future.
>
> Will take @msec milliseconds to be processed by the _kernel_. Yes, USB
> probing takes a lot of time in kernel. But you are using this
> parameter to wait for userspace...
>
> > > There must be better
> > > solution....
> >
> > I am not sure how it could look like.
>
> Rafael, do you have any idea how this is supposed to work?
>
> Original patch is at https://lkml.org/lkml/2014/4/10/156 .
One possibility is not to use autosleep at all. The user program,
instead of writing "on" to /sys/power/state to stay awake, would have
to write "mem" to go to sleep when no more work remained to be handled.
Alan Stern
--
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
^ permalink raw reply
* Re: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
From: Pavel Machek @ 2014-06-28 20:04 UTC (permalink / raw)
To: Dr. H. Nikolaus Schaller
Cc: Lukas M?rdian, Dmitry Torokhov, linux-input, LKML, Marek Belisko,
Rafael J. Wysocki, stern
In-Reply-To: <BD5D0538-BD03-4CD8-8E12-2344AD7ED669@goldelico.com>
Hi!
> >> This gives the userspace (Replicant) a chance to fully handle the
> >> pm_wakeup_event, before autosleep suspends the system alltogether
> >> again.
> >>
> >> This fixes suspend/resume on the OpenPhoenux GTA04, in combination with
> >> the Replicant 4.2.2 userspace, which needs to execute this to stay
> >> awake: 'echo on > /sys/power/state'
> >>
> >> Signed-off-by: Lukas Märdian <lukas@goldelico.com>
> >> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> >
> > I'm sorry, but we should not be doing this.
> >
> > You basically put a delay in driver to work around userspace bug.
>
> Do you think it is a user-space bug if the kernel goes to sleep again
> before giving user space any chance to react to an event?
Well, who says 1000msec is enough? Some userspace may need
more. ... for example on PC when you keyboard-handling deamon is
swapped out.
> And the msec parameter is described as:
>
> @msec: Anticipated event processing time (in milliseconds).
>
> Isn't calling pm_wakeup_event() with a non-zero msec the standard
> method to handle this situation? And it is used in other drivers. E.g. in
> _mmc_detect_change() or hub_suspend().
* Notify the PM core of a wakeup event whose source is @ws that will
take
* approximately @msec milliseconds to be processed by the kernel. If
@ws is
* not active, activate it. If @msec is nonzero, set up the @ws'
timer to
* execute pm_wakeup_timer_fn() in future.
Will take @msec milliseconds to be processed by the _kernel_. Yes, USB
probing takes a lot of time in kernel. But you are using this
parameter to wait for userspace...
> > There must be better
> > solution....
>
> I am not sure how it could look like.
Rafael, do you have any idea how this is supposed to work?
Original patch is at https://lkml.org/lkml/2014/4/10/156 .
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply
* Re: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
From: Dr. H. Nikolaus Schaller @ 2014-06-28 17:57 UTC (permalink / raw)
To: Pavel Machek
Cc: Lukas M?rdian, Dmitry Torokhov, linux-input, LKML, Marek Belisko
In-Reply-To: <20140628170820.GF23634@xo-6d-61-c0.localdomain>
Hi,
Am 28.06.2014 um 19:08 schrieb Pavel Machek:
> Hi!
>
>> This gives the userspace (Replicant) a chance to fully handle the
>> pm_wakeup_event, before autosleep suspends the system alltogether
>> again.
>>
>> This fixes suspend/resume on the OpenPhoenux GTA04, in combination with
>> the Replicant 4.2.2 userspace, which needs to execute this to stay
>> awake: 'echo on > /sys/power/state'
>>
>> Signed-off-by: Lukas Märdian <lukas@goldelico.com>
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>
> I'm sorry, but we should not be doing this.
>
> You basically put a delay in driver to work around userspace bug.
Do you think it is a user-space bug if the kernel goes to sleep again
before giving user space any chance to react to an event?
And the msec parameter is described as:
@msec: Anticipated event processing time (in milliseconds).
Isn't calling pm_wakeup_event() with a non-zero msec the standard
method to handle this situation? And it is used in other drivers. E.g. in
_mmc_detect_change() or hub_suspend().
And if I understand the code of __pm_wakeup_event() correctly it does
*not* delay, but just modifies the wakeup_source timer to expire a little
later. I.e. keep the system longer awake. So as long as the system is
not suspended there is no difference to current driver.
> There must be better
> solution....
I am not sure how it could look like.
-- hns--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
From: Pavel Machek @ 2014-06-28 17:08 UTC (permalink / raw)
To: Lukas M?rdian
Cc: Dmitry Torokhov, linux-input, linux-kernel, H. Nikolaus Schaller
In-Reply-To: <1403906118-23517-1-git-send-email-lukas@goldelico.com>
Hi!
> This gives the userspace (Replicant) a chance to fully handle the
> pm_wakeup_event, before autosleep suspends the system alltogether
> again.
>
> This fixes suspend/resume on the OpenPhoenux GTA04, in combination with
> the Replicant 4.2.2 userspace, which needs to execute this to stay
> awake: 'echo on > /sys/power/state'
>
> Signed-off-by: Lukas Märdian <lukas@goldelico.com>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
I'm sorry, but we should not be doing this.
You basically put a delay in driver to work around userspace bug. There must be better
solution....
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply
* [PATCH 1/1] drivers/hid/hid-picolcd_debugfs.c: remove unnecessary NULL test before debugfs_remove
From: Fabian Frederick @ 2014-06-28 13:35 UTC (permalink / raw)
To: linux-kernel; +Cc: bonbons, Fabian Frederick, Jiri Kosina, linux-input
Fix checkpatch warning:
WARNING: debugfs_remove(NULL) is safe this check is probably not required
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
drivers/hid/hid-picolcd_debugfs.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/hid-picolcd_debugfs.c b/drivers/hid/hid-picolcd_debugfs.c
index 024cdf3..3c13af6 100644
--- a/drivers/hid/hid-picolcd_debugfs.c
+++ b/drivers/hid/hid-picolcd_debugfs.c
@@ -883,16 +883,13 @@ void picolcd_exit_devfs(struct picolcd_data *data)
dent = data->debug_reset;
data->debug_reset = NULL;
- if (dent)
- debugfs_remove(dent);
+ debugfs_remove(dent);
dent = data->debug_eeprom;
data->debug_eeprom = NULL;
- if (dent)
- debugfs_remove(dent);
+ debugfs_remove(dent);
dent = data->debug_flash;
data->debug_flash = NULL;
- if (dent)
- debugfs_remove(dent);
+ debugfs_remove(dent);
mutex_destroy(&data->mutex_flash);
}
--
1.8.4.5
^ permalink raw reply related
* Re: [PATCH v2 0/14] input: cyapa: re-architecture driver to support multi-trackpads in one driver
From: Patrik Fimml @ 2014-06-27 23:49 UTC (permalink / raw)
To: Dudley Du
Cc: Dmitry Torokhov, Rafael J. Wysocki, Alan Stern, Benson Leung,
Lily Rui, Daniel Kurtz, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Hi Dudley,
I tried to apply your patchset today, but was not successful: it seems
like tabs have been replaced by spaces, and there's a Cypress
signature and a winmail.dat file added to every email, making it
impossible to apply your patches directly.
I've tried to rule out errors on my end. I checked with
http://marc.info/?l=linux-input&m=140203994303131&q=raw that the
original email indeed has all tabs replaced with spaces.
Can you fix your email setup so that these things don't happen - there
is some documentation in Documentation/SubmittingPatches and
Documentation/email-clients.txt - and send the patches again?
Alternatively, maybe you could at least send the patches as
attachments (as output by git format-patch), so that your email system
doesn't mess with them. That's probably not the preferred solution for
the general lkml audience, but would work as a short-term solution for
me.
If I'm mistaken here and someone else was able to apply the patches
successfully, please point me in the right direction.
Thanks,
Patrik
^ permalink raw reply
* [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume
From: Lukas Märdian @ 2014-06-27 21:55 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-input, linux-kernel, Lukas Märdian,
H. Nikolaus Schaller
This gives the userspace (Replicant) a chance to fully handle the
pm_wakeup_event, before autosleep suspends the system alltogether
again.
This fixes suspend/resume on the OpenPhoenux GTA04, in combination with
the Replicant 4.2.2 userspace, which needs to execute this to stay
awake: 'echo on > /sys/power/state'
Signed-off-by: Lukas Märdian <lukas@goldelico.com>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
drivers/input/keyboard/gpio_keys.c | 7 ++-----
drivers/input/misc/twl4030-pwrbutton.c | 2 +-
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 2db1324..be8c62e 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -345,9 +345,6 @@ static void gpio_keys_gpio_work_func(struct work_struct *work)
container_of(work, struct gpio_button_data, work);
gpio_keys_gpio_report_event(bdata);
-
- if (bdata->button->wakeup)
- pm_relax(bdata->input->dev.parent);
}
static void gpio_keys_gpio_timer(unsigned long _data)
@@ -364,7 +361,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
BUG_ON(irq != bdata->irq);
if (bdata->button->wakeup)
- pm_stay_awake(bdata->input->dev.parent);
+ pm_wakeup_event(bdata->input->dev.parent, 1000);
if (bdata->timer_debounce)
mod_timer(&bdata->timer,
jiffies + msecs_to_jiffies(bdata->timer_debounce));
@@ -402,7 +399,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
if (!bdata->key_pressed) {
if (bdata->button->wakeup)
- pm_wakeup_event(bdata->input->dev.parent, 0);
+ pm_wakeup_event(bdata->input->dev.parent, 1000);
input_event(input, EV_KEY, button->code, 1);
input_sync(input);
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index fb3b63b..8622e43 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -41,7 +41,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
if (!err) {
- pm_wakeup_event(pwr->dev.parent, 0);
+ pm_wakeup_event(pwr->dev.parent, 1000);
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
input_sync(pwr);
} else {
--
1.9.1
--
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
^ permalink raw reply related
* [PATCH 1/1] drivers/input/touchscreen/edt-ft5x06.c: remove unnecessary null test before debugfs_remove_recursive
From: Fabian Frederick @ 2014-06-27 20:38 UTC (permalink / raw)
To: linux-kernel
Cc: Fabian Frederick, Dmitry Torokhov, Henrik Rydberg, linux-input
Fix checkpatch warning:
"WARNING: debugfs_remove_recursive(NULL) is safe this check is probably not required"
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@euromail.se>
Cc: linux-input@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
drivers/input/touchscreen/edt-ft5x06.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index d4f3399..5a6d50c 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -733,8 +733,7 @@ edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
static void
edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
{
- if (tsdata->debug_dir)
- debugfs_remove_recursive(tsdata->debug_dir);
+ debugfs_remove_recursive(tsdata->debug_dir);
kfree(tsdata->raw_buffer);
}
--
1.8.4.5
^ permalink raw reply related
* Re: [PATCH 11/13] input: lm8323: fix attribute-creation race
From: Dmitry Torokhov @ 2014-06-27 18:50 UTC (permalink / raw)
To: Johan Hovold
Cc: Bryan Wu, Richard Purdie, Greg Kroah-Hartman,
linux-input@vger.kernel.org, lkml, linux-leds, Janne Kanniainen,
Jiri Kosina, Bjørn Mork
In-Reply-To: <1403716136-32694-12-git-send-email-johan@kernel.org>
On Wed, Jun 25, 2014 at 10:08 AM, Johan Hovold <johan@kernel.org> wrote:
> Use the attribute groups of the led-class to create the time attribute
> during probe in order to avoid racing with userspace.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/keyboard/lm8323.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
> index 0b42118cbf8f..cb32e2b506b7 100644
> --- a/drivers/input/keyboard/lm8323.c
> +++ b/drivers/input/keyboard/lm8323.c
> @@ -558,6 +558,12 @@ static ssize_t lm8323_pwm_store_time(struct device *dev,
> }
> static DEVICE_ATTR(time, 0644, lm8323_pwm_show_time, lm8323_pwm_store_time);
>
> +static struct attribute *lm8323_pwm_attrs[] = {
> + &dev_attr_time.attr,
> + NULL
> +};
> +ATTRIBUTE_GROUPS(lm8323_pwm);
> +
> static int init_pwm(struct lm8323_chip *lm, int id, struct device *dev,
> const char *name)
> {
> @@ -580,16 +586,11 @@ static int init_pwm(struct lm8323_chip *lm, int id, struct device *dev,
> if (name) {
> pwm->cdev.name = name;
> pwm->cdev.brightness_set = lm8323_pwm_set_brightness;
> + pwm->cdev.groups = lm8323_pwm_groups;
> if (led_classdev_register(dev, &pwm->cdev) < 0) {
> dev_err(dev, "couldn't register PWM %d\n", id);
> return -1;
> }
> - if (device_create_file(pwm->cdev.dev,
> - &dev_attr_time) < 0) {
> - dev_err(dev, "couldn't register time attribute\n");
> - led_classdev_unregister(&pwm->cdev);
> - return -1;
> - }
> pwm->enabled = true;
> }
>
> @@ -753,11 +754,8 @@ fail3:
> device_remove_file(&client->dev, &dev_attr_disable_kp);
> fail2:
> while (--pwm >= 0)
> - if (lm->pwm[pwm].enabled) {
> - device_remove_file(lm->pwm[pwm].cdev.dev,
> - &dev_attr_time);
> + if (lm->pwm[pwm].enabled)
> led_classdev_unregister(&lm->pwm[pwm].cdev);
> - }
> fail1:
> input_free_device(idev);
> kfree(lm);
> @@ -777,10 +775,8 @@ static int lm8323_remove(struct i2c_client *client)
> device_remove_file(&lm->client->dev, &dev_attr_disable_kp);
>
> for (i = 0; i < 3; i++)
> - if (lm->pwm[i].enabled) {
> - device_remove_file(lm->pwm[i].cdev.dev, &dev_attr_time);
> + if (lm->pwm[i].enabled)
> led_classdev_unregister(&lm->pwm[i].cdev);
> - }
>
> kfree(lm);
>
> --
> 1.8.5.5
>
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v2 07/10] mfd: cros_ec: cleanup: Remove EC wrapper functions
From: Dmitry Torokhov @ 2014-06-27 18:47 UTC (permalink / raw)
To: Wolfram Sang
Cc: Doug Anderson, Lee Jones, Andrew Bresticker, Stephen Warren,
Olof Johansson, Sonny Rao, linux-samsung-soc@vger.kernel.org,
Javier Martinez Canillas, Bill Richardson, Simon Glass,
Mark Brown, Samuel Ortiz, Geert Uytterhoeven, linux-i2c, lkml,
linux-input@vger.kernel.org
In-Reply-To: <20140627123109.GA29156@katana>
On Fri, Jun 27, 2014 at 5:31 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> On Wed, Jun 18, 2014 at 11:14:04AM -0700, Doug Anderson wrote:
>> From: Bill Richardson <wfrichar@chromium.org>
>>
>> Remove the three wrapper functions that talk to the EC without passing all
>> the desired arguments and just use the underlying communication function
>> that passes everything in a struct intead.
>>
>> This is internal code refactoring only. Nothing should change.
>>
>> Signed-off-by: Bill Richardson <wfrichar@chromium.org>
>> Signed-off-by: Doug Anderson <dianders@chromium.org>
>> Acked-by: Lee Jones <lee.jones@linaro.org>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> For the I2C part:
>
> Acked-by: Wolfram Sang <wsa@the-dreams.de>
>
I'm good with input bits as well.
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] HID: usbhid: quirk for PM1610 and PM1640 Touchscreen.
From: Jiri Kosina @ 2014-06-27 14:04 UTC (permalink / raw)
To: John Sung; +Cc: Dmitry Torokhov, linux-input, linux-kernel
In-Reply-To: <1403857328-38892-1-git-send-email-penmount.touch@gmail.com>
On Fri, 27 Jun 2014, John Sung wrote:
> These device needs to be added to the quirks list with HID_QUIRK_NOGET,
> otherwise they will reset upon receiving the get input report requests.
>
> Signed-off-by: John Sung <penmount.touch@gmail.com>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v2 07/10] mfd: cros_ec: cleanup: Remove EC wrapper functions
From: Wolfram Sang @ 2014-06-27 12:31 UTC (permalink / raw)
To: Doug Anderson
Cc: Lee Jones, Andrew Bresticker, swarren, olof, Sonny Rao,
linux-samsung-soc, Javier Martinez Canillas, Bill Richardson, sjg,
broonie, dmitry.torokhov, sameo, geert, linux-i2c, linux-kernel,
linux-input
In-Reply-To: <1403115247-8853-8-git-send-email-dianders@chromium.org>
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
On Wed, Jun 18, 2014 at 11:14:04AM -0700, Doug Anderson wrote:
> From: Bill Richardson <wfrichar@chromium.org>
>
> Remove the three wrapper functions that talk to the EC without passing all
> the desired arguments and just use the underlying communication function
> that passes everything in a struct intead.
>
> This is internal code refactoring only. Nothing should change.
>
> Signed-off-by: Bill Richardson <wfrichar@chromium.org>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
For the I2C part:
Acked-by: Wolfram Sang <wsa@the-dreams.de>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 00/13] leds: fix attribute-creation races
From: Jiri Kosina @ 2014-06-27 10:05 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Bryan Wu, Johan Hovold, Richard Purdie, Dmitry Torokhov,
linux-input, lkml, Linux LED Subsystem, Janne Kanniainen,
Bjørn Mork
In-Reply-To: <20140626232506.GA26949@kroah.com>
On Thu, 26 Jun 2014, Greg Kroah-Hartman wrote:
> > Thanks a lot for driving this. I will applied this patchset into my
> > -devel branch. After I got the Ack from Input guys, I will apply it to
> > my for-next branch then.
>
> Series looks good to me, Johan, thanks for doing this work.
Yeah, looks good to me as well, thanks. The lm8323 change should be Acked
by Dmitry though, as it's in his area.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v4 1/6] mfd: fsl imx25 Touchscreen ADC driver
From: Linus Walleij @ 2014-06-27 9:18 UTC (permalink / raw)
To: Denis Carikli, Mark Brown
Cc: Shawn Guo, Samuel Ortiz, Dmitry Torokhov, Jonathan Cameron,
Fabio Estevam, Peter Meerwald, Hartmut Knaack, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Lars-Peter Clausen, Eric Bénard, Pawel Moll, Ian Campbell,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Kumar Gala,
Rob Herring, Sascha Hauer, Linux Input, Markus Pargmann,
Lee Jones,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <1403621185-9581-1-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
On Tue, Jun 24, 2014 at 4:46 PM, Denis Carikli <denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org> wrote:
> From: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>
> This is the core driver for imx25 touchscreen/adc driver. The module
> has one shared ADC and two different conversion queues which use the
> ADC. The two queues are identical. Both can be used for general purpose
> ADC but one is meant to be used for touchscreens.
>
> This driver is the core which manages the central components and
> registers of the TSC/ADC unit. It manages the IRQs and forwards them to
> the correct components.
>
> Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Signed-off-by: Denis Carikli <denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
> Acked-by: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
I think the subject and commit message is misleading. What this
patch does is create a MFD hub to handle spawning devices
and handle chained IRQs for the ADC unit right? It's not a "core driver"
because it's not really driving anything, just proxying things.
> +static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq,
> + irq_hw_number_t hwirq)
> +{
> + struct mx25_tsadc *tsadc = d->host_data;
> +
> + irq_set_chip_data(irq, tsadc);
You also need to set a unique lockdep class or lockdep will
complain.
static struct lock_class_key my_lock_class;
irq_set_lockdep_class(irq, &my_lock_class);
> + irq_set_chip_and_handler(irq, &dummy_irq_chip,
> + handle_level_irq);
> + set_irq_flags(irq, IRQF_VALID);
This function only exists on ARM. Unless Kconfig ensures
this is only available on ARM platforms, use
#ifdef CONFIG_ARM
set_irq_flags(irq, IRQF_VALID);
#else
irq_set_noprobe(irq);
#endif
(Sorry we have no better way of doing it.)
> +static int mx25_tsadc_probe(struct platform_device *pdev)
> +{
(...)
> + of_platform_populate(np, NULL, NULL, dev);
This was news2me. Why aren't MFD cells used now that
you're using MFD as a spawning hub?
MFD also has a way of translating IRQs passed as resources
to children, so they arrive at their children readily translated.
Not using MFD cells means you don't use this nice mechanism
right?
Or is there some new nice design style that I'm not
familiar with, like the OF core handling that translation?
(Seems like that, hence asking...)
Yours,
Linus Walleij
^ permalink raw reply
* [PATCH] HID: usbhid: quirk for PM1610 and PM1640 Touchscreen.
From: John Sung @ 2014-06-27 8:22 UTC (permalink / raw)
To: Dmitry Torokhov, Jiri Kosina, linux-input, linux-kernel; +Cc: penmount.touch
These device needs to be added to the quirks list with HID_QUIRK_NOGET,
otherwise they will reset upon receiving the get input report requests.
Signed-off-by: John Sung <penmount.touch@gmail.com>
---
drivers/hid/hid-ids.h | 2 ++
drivers/hid/usbhid/hid-quirks.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 7370ae3..37af778 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -715,6 +715,8 @@
#define USB_VENDOR_ID_PENMOUNT 0x14e1
#define USB_DEVICE_ID_PENMOUNT_PCI 0x3500
+#define USB_DEVICE_ID_PENMOUNT_1610 0x1610
+#define USB_DEVICE_ID_PENMOUNT_1640 0x1640
#define USB_VENDOR_ID_PETALYNX 0x18b1
#define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 13ca192..587d3aa 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -76,6 +76,8 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
+ { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET },
+ { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS },
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] HID: roccat: Drop cast
From: Julia Lawall @ 2014-06-27 7:59 UTC (permalink / raw)
To: Joe Perches
Cc: Himangi Saraogi, Stefan Achatz, Jiri Kosina, linux-input,
linux-kernel
In-Reply-To: <1403848366.7977.92.camel@joe-AO725>
On Thu, 26 Jun 2014, Joe Perches wrote:
> On Fri, 2014-06-27 at 07:29 +0200, Julia Lawall wrote:
> > On Thu, 26 Jun 2014, Joe Perches wrote:
> > > The cast of a const void * to a void * was odd.
> > >
> > > Maybe a mechanism to verify appropriateness of
> > > loss of constness for any pointer might be useful.
> >
> > I tried the following, but didn't find anything interesting:
> >
> > @disable drop_cast@
> > type T;
> > const T e;
> > @@
> >
> > * (T)e
>
> What code does this match?
> Do you have an example match?
>
> This doesn't find a cast of a void type like:
>
> void func(const void * const p)
> {
> char *p2 = p;
>
> p2[0] = 1;
> }
The results are below. Except in the first case, none are pointer types.
The first case looks very intentional, although if the intention is
needed, perhaps the types should be listed differently.
I was surprised not to get more results. Maybe there is not enough type
information. I did use --all-includes but not --recursive-includes, ie
only explicitly mentioned include files are taken into account.
My rule doesn't consider implicit casts like in your example. I can try
that.
julia
diff -u -p /var/linuxes/linux-next/lib/devres.c /tmp/nothing/lib/devres.c
--- /var/linuxes/linux-next/lib/devres.c
+++ /tmp/nothing/lib/devres.c
@@ -296,7 +296,6 @@ void __iomem *pcim_iomap(struct pci_dev
BUG_ON(bar >= PCIM_IOMAP_MAX);
- tbl = (void __iomem **)pcim_iomap_table(pdev);
if (!tbl || tbl[bar]) /* duplicate mappings not allowed */
return NULL;
@@ -319,7 +318,6 @@ void pcim_iounmap(struct pci_dev *pdev,
pci_iounmap(pdev, addr);
- tbl = (void __iomem **)pcim_iomap_table(pdev);
BUG_ON(!tbl);
for (i = 0; i < PCIM_IOMAP_MAX; i++)
diff -u -p /var/linuxes/linux-next/drivers/video/fbdev/smscufx.c /tmp/nothing/drivers/video/fbdev/smscufx.c
--- /var/linuxes/linux-next/drivers/video/fbdev/smscufx.c
+++ /tmp/nothing/drivers/video/fbdev/smscufx.c
@@ -976,7 +976,6 @@ static void ufx_dpy_deferred_io(struct f
const int width = dev->info->var.xres;
const int y = (cur->index << PAGE_SHIFT) / (width * 2);
int height = (PAGE_SIZE / (width * 2)) + 1;
- height = min(height, (int)(dev->info->var.yres - y));
BUG_ON(y >= dev->info->var.yres);
BUG_ON((y + height) > dev->info->var.yres);
diff -u -p /var/linuxes/linux-next/drivers/mtd/chips/jedec_probe.c /tmp/nothing/drivers/mtd/chips/jedec_probe.c
--- /var/linuxes/linux-next/drivers/mtd/chips/jedec_probe.c
+++ /tmp/nothing/drivers/mtd/chips/jedec_probe.c
@@ -2027,11 +2027,8 @@ static inline int jedec_match( uint32_t
}
break;
case CFI_DEVICETYPE_X16:
- mfr = (uint16_t)finfo->mfr_id;
- id = (uint16_t)finfo->dev_id;
break;
case CFI_DEVICETYPE_X32:
- mfr = (uint16_t)finfo->mfr_id;
id = (uint32_t)finfo->dev_id;
break;
default:
diff -u -p /var/linuxes/linux-next/drivers/net/wireless/libertas/defs.h /tmp/nothing/drivers/net/wireless/libertas/defs.h
--- /var/linuxes/linux-next/drivers/net/wireless/libertas/defs.h
+++ /tmp/nothing/drivers/net/wireless/libertas/defs.h
@@ -105,7 +105,6 @@ static inline void lbs_deb_hex(unsigned
printk("\n");
printk(DRV_NAME " %s: ", prompt);
}
- printk("%02x ", (u8) * buf);
buf++;
}
printk("\n");
diff -u -p /var/linuxes/linux-next/drivers/media/i2c/tvp5150.c /tmp/nothing/drivers/media/i2c/tvp5150.c
--- /var/linuxes/linux-next/drivers/media/i2c/tvp5150.c
+++ /tmp/nothing/drivers/media/i2c/tvp5150.c
@@ -95,7 +95,6 @@ static void dump_reg_range(struct v4l2_s
{
int i = 0;
- while (init != (u8)(end + 1)) {
if ((i % max_line) == 0) {
if (i > 0)
printk("\n");
diff -u -p /var/linuxes/linux-next/net/netfilter/ipvs/ip_vs_sync.c /tmp/nothing/net/netfilter/ipvs/ip_vs_sync.c
--- /var/linuxes/linux-next/net/netfilter/ipvs/ip_vs_sync.c
+++ /tmp/nothing/net/netfilter/ipvs/ip_vs_sync.c
@@ -1543,7 +1543,6 @@ ip_vs_send_async(struct socket *sock, co
iov.iov_base = (void *)buffer;
iov.iov_len = length;
- len = kernel_sendmsg(sock, &msg, &iov, 1, (size_t)(length));
LeaveFunction(7);
return len;
@@ -1575,7 +1574,6 @@ ip_vs_receive(struct socket *sock, char
/* Receive a packet */
iov.iov_base = buffer;
- iov.iov_len = (size_t)buflen;
len = kernel_recvmsg(sock, &msg, &iov, 1, buflen, MSG_DONTWAIT);
diff -u -p /var/linuxes/linux-next/net/ipv4/tcp_output.c /tmp/nothing/net/ipv4/tcp_output.c
--- /var/linuxes/linux-next/net/ipv4/tcp_output.c
+++ /tmp/nothing/net/ipv4/tcp_output.c
@@ -177,7 +177,6 @@ static void tcp_event_data_sent(struct t
/* If it is a reply for ato after last received
* packet, enter pingpong mode.
*/
- if ((u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato &&
(!dst || !dst_metric(dst, RTAX_QUICKACK)))
icsk->icsk_ack.pingpong = 1;
}
^ permalink raw reply
* Re: [PATCH] HID: roccat: Drop cast
From: Joe Perches @ 2014-06-27 5:52 UTC (permalink / raw)
To: Julia Lawall
Cc: Himangi Saraogi, Stefan Achatz, Jiri Kosina, linux-input,
linux-kernel
In-Reply-To: <alpine.DEB.2.02.1406270729110.2016@localhost6.localdomain6>
On Fri, 2014-06-27 at 07:29 +0200, Julia Lawall wrote:
> On Thu, 26 Jun 2014, Joe Perches wrote:
> > The cast of a const void * to a void * was odd.
> >
> > Maybe a mechanism to verify appropriateness of
> > loss of constness for any pointer might be useful.
>
> I tried the following, but didn't find anything interesting:
>
> @disable drop_cast@
> type T;
> const T e;
> @@
>
> * (T)e
What code does this match?
Do you have an example match?
This doesn't find a cast of a void type like:
void func(const void * const p)
{
char *p2 = p;
p2[0] = 1;
}
^ permalink raw reply
* Re: [PATCH] HID: roccat: Drop cast
From: Julia Lawall @ 2014-06-27 5:29 UTC (permalink / raw)
To: Joe Perches
Cc: Himangi Saraogi, Stefan Achatz, Jiri Kosina, linux-input,
linux-kernel
In-Reply-To: <1403804286.7977.58.camel@joe-AO725>
On Thu, 26 Jun 2014, Joe Perches wrote:
> On Thu, 2014-06-26 at 22:58 +0530, Himangi Saraogi wrote:
> > This patch removes the cast on data of type void* as it is not needed.
>
> Hi Himangi
>
> The cast of a const void * to a void * was odd.
>
> Maybe a mechanism to verify appropriateness of
> loss of constness for any pointer might be useful.
I tried the following, but didn't find anything interesting:
@disable drop_cast@
type T;
const T e;
@@
* (T)e
julia
^ permalink raw reply
* Re: [PATCH 00/13] leds: fix attribute-creation races
From: Greg Kroah-Hartman @ 2014-06-26 23:25 UTC (permalink / raw)
To: Bryan Wu
Cc: Johan Hovold, Richard Purdie, Dmitry Torokhov, linux-input, lkml,
Linux LED Subsystem, Janne Kanniainen, Jiri Kosina,
Bjørn Mork
In-Reply-To: <CAK5ve-JVBoeW+a+1PKcfCwNOC+HOdKUD=1iFrTJAZ_tqh10yuQ@mail.gmail.com>
On Wed, Jun 25, 2014 at 03:46:19PM -0700, Bryan Wu wrote:
> On Wed, Jun 25, 2014 at 10:08 AM, Johan Hovold <johan@kernel.org> wrote:
> > LED-class device attributes should be created using the attribute groups
> > of struct device, rather than be added manually after the device has
> > been registered in order to avoid racing with userspace.
> >
> > The first patch adds an attribute groups field to struct led_classdev,
> > which is used during registration to add device attributes in a
> > race-free manner.
> >
> > The remaining patches convert the current racy LED-device attribute
> > creations to use the new facility. Hopefully my grep-patterns have
> > caught most instances. Note that this also tends to simplify probe error
> > paths.
> >
> > The lp55xx-common failed to remove the attribute group it is currently
> > creating, something which is fixed separately.
> >
> > Note that this series include one driver from drivers/input/keyboard.
> >
> > The individual led-driver patches have been compile tested only.
> >
>
> Thanks a lot for driving this. I will applied this patchset into my
> -devel branch. After I got the Ack from Input guys, I will apply it to
> my for-next branch then.
Series looks good to me, Johan, thanks for doing this work.
greg k-h
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox