Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH] input: remove at32psif
From: Hans-Christian Noren Egtvedt @ 2018-01-19  7:25 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Corentin Labbe, linux-input, linux-kernel
In-Reply-To: <20180118195543.wn6tl57zd2jg3on4@dtor-ws>

Around Thu 18 Jan 2018 11:55:43 -0800 or thereabout, Dmitry Torokhov wrote:
> On Thu, Jan 18, 2018 at 08:48:24PM +0100, Corentin Labbe wrote:
>> On Thu, Jan 18, 2018 at 11:20:17AM -0800, Dmitry Torokhov wrote:
>> > On Thu, Jan 18, 2018 at 07:58:11PM +0100, Corentin Labbe wrote:
>> > > Since AVR32 arch is gone, at32psif driver is useless.
>> > > This patch remove it.
>> > > 
>> > > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
>> > 
>> > Applied, thank you.
>> > 
>> > What about:
>> > 
>> > config TOUCHSCREEN_WM97XX_ATMEL
>> > 	tristate "WM97xx Atmel accelerated touch"
>> > 	depends on TOUCHSCREEN_WM97XX && AVR32 
>> > 
>> > ?
>> > 
>> 
>> It was my second target BUT the code content reference to AT91 (wm97xx continuous touch driver for Atmel AT91 and AVR32) so perhaps it could be keeped.
>> 
>> But someone need to test it.
> 
> "&& AVR32" means that nobody ever ran it on AT91 though...
> Hans-Christian, any ideas?

I never tested accelerating WM97xx codecs on AT91, hence it is AVR32 only. It
can be removed.

Thanks for cleaning (-:

-- 
Best regards,
Hans-Christian Noren Egtvedt

^ permalink raw reply

* Re: [PATCH 1/3] Input: synaptics_rmi4 - do not delete interrupt memory too early
From: thatslyude @ 2018-01-19  1:05 UTC (permalink / raw)
  To: Dmitry Torokhov, Benjamin Tissoires, Damjan Georgievski
  Cc: linux-input, linux-kernel, Andrew Duggan, stable
In-Reply-To: <20180119004955.247190-2-dmitry.torokhov@gmail.com>

Reviewed-by: Lyude Paul <lyude@redhat.com>
(hope you don't mind that I'm using my gmail address for this ;)

On Thu, 2018-01-18 at 16:49 -0800, Dmitry Torokhov wrote:
> We want to free memory reserved for interrupt mask handling only after we
> free functions, as function drivers might want to mask interrupts. This is
> needed for the followup patch to the F03 that would implement unmasking and
> masking interrupts from the serio pass-through port open() and close()
> methods.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/rmi4/rmi_driver.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/rmi4/rmi_driver.c
> b/drivers/input/rmi4/rmi_driver.c
> index 27791d6546c66..ce3ede289ed04 100644
> --- a/drivers/input/rmi4/rmi_driver.c
> +++ b/drivers/input/rmi4/rmi_driver.c
> @@ -41,6 +41,13 @@ void rmi_free_function_list(struct rmi_device *rmi_dev)
>  
>  	rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Freeing function list\n");
>  
> +	/* Doing it in the reverse order so F01 will be removed last */
> +	list_for_each_entry_safe_reverse(fn, tmp,
> +					 &data->function_list, node) {
> +		list_del(&fn->node);
> +		rmi_unregister_function(fn);
> +	}
> +
>  	devm_kfree(&rmi_dev->dev, data->irq_memory);
>  	data->irq_memory = NULL;
>  	data->irq_status = NULL;
> @@ -50,13 +57,6 @@ void rmi_free_function_list(struct rmi_device *rmi_dev)
>  
>  	data->f01_container = NULL;
>  	data->f34_container = NULL;
> -
> -	/* Doing it in the reverse order so F01 will be removed last */
> -	list_for_each_entry_safe_reverse(fn, tmp,
> -					 &data->function_list, node) {
> -		list_del(&fn->node);
> -		rmi_unregister_function(fn);
> -	}
>  }
>  
>  static int reset_one_function(struct rmi_function *fn)

^ permalink raw reply

* [PATCH 1/3] Input: synaptics_rmi4 - do not delete interrupt memory too early
From: Dmitry Torokhov @ 2018-01-19  0:49 UTC (permalink / raw)
  To: Benjamin Tissoires, Lyude Paul, Damjan Georgievski
  Cc: linux-input, linux-kernel, Andrew Duggan, stable
In-Reply-To: <20180119004955.247190-1-dmitry.torokhov@gmail.com>

We want to free memory reserved for interrupt mask handling only after we
free functions, as function drivers might want to mask interrupts. This is
needed for the followup patch to the F03 that would implement unmasking and
masking interrupts from the serio pass-through port open() and close()
methods.

Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/rmi4/rmi_driver.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 27791d6546c66..ce3ede289ed04 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -41,6 +41,13 @@ void rmi_free_function_list(struct rmi_device *rmi_dev)
 
 	rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Freeing function list\n");
 
+	/* Doing it in the reverse order so F01 will be removed last */
+	list_for_each_entry_safe_reverse(fn, tmp,
+					 &data->function_list, node) {
+		list_del(&fn->node);
+		rmi_unregister_function(fn);
+	}
+
 	devm_kfree(&rmi_dev->dev, data->irq_memory);
 	data->irq_memory = NULL;
 	data->irq_status = NULL;
@@ -50,13 +57,6 @@ void rmi_free_function_list(struct rmi_device *rmi_dev)
 
 	data->f01_container = NULL;
 	data->f34_container = NULL;
-
-	/* Doing it in the reverse order so F01 will be removed last */
-	list_for_each_entry_safe_reverse(fn, tmp,
-					 &data->function_list, node) {
-		list_del(&fn->node);
-		rmi_unregister_function(fn);
-	}
 }
 
 static int reset_one_function(struct rmi_function *fn)
-- 
2.16.0.rc1.238.g530d649a79-goog


^ permalink raw reply related

* [PATCH 0/3] RMI4: improve trackpoint detection
From: Dmitry Torokhov @ 2018-01-19  0:49 UTC (permalink / raw)
  To: Benjamin Tissoires, Lyude Paul, Damjan Georgievski
  Cc: linux-input, linux-kernel, Andrew Duggan

Hi,

The following patch series is hopefully improves trackpint detection
on systems using RMI4 and PS/2 guest modules. The issue was that we
were registering port too early, before RMI driver was ready to service
interrupts properly, so psmouse would try to get ID from the device and RMI
driver would still be initializing other functions and interrupts would still be
masked, so GetID would simply time out. Then we may or may not get interrupt
from trackpoint and run through the detection again, but probably much later.

Please take a look and hpefully give it a try. Damjan, I hope it might fix your
issue with trackpoint appearing much much later.

Thanks!

-- 
Dmitry


^ permalink raw reply

* [PATCH 3/3] Input: synaptics-rmi4 - log when we create a guest serio port
From: Dmitry Torokhov @ 2018-01-19  0:49 UTC (permalink / raw)
  To: Benjamin Tissoires, Lyude Paul, Damjan Georgievski
  Cc: linux-input, linux-kernel, Andrew Duggan
In-Reply-To: <20180119004955.247190-1-dmitry.torokhov@gmail.com>

To ease analyzing boot behavior from logs, let's log when we are about to
register the pass-through serio port.

Also, let's drop "Synaptics" prefix from the port name, as RMI4 is good
enough indicator already, and having the prefix means that the name does
not fit into serio->name field. While at it move from hard-coded seio->phys
to one mentioning the sensor ID (such as "rmi4-00.fn03/serio0").

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/rmi4/rmi_f03.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
index 7ccbb370a9a81..88822196d6b72 100644
--- a/drivers/input/rmi4/rmi_f03.c
+++ b/drivers/input/rmi4/rmi_f03.c
@@ -184,14 +184,15 @@ static int rmi_f03_register_pt(struct f03_data *f03)
 	serio->close = rmi_f03_pt_close;
 	serio->port_data = f03;
 
-	strlcpy(serio->name, "Synaptics RMI4 PS/2 pass-through",
-		sizeof(serio->name));
-	strlcpy(serio->phys, "synaptics-rmi4-pt/serio1",
-		sizeof(serio->phys));
+	strlcpy(serio->name, "RMI4 PS/2 pass-through", sizeof(serio->name));
+	snprintf(serio->phys, sizeof(serio->phys), "%s/serio0",
+		 dev_name(&f03->fn->dev));
 	serio->dev.parent = &f03->fn->dev;
 
 	f03->serio = serio;
 
+	printk(KERN_INFO "serio: %s port at %s\n",
+		serio->name, dev_name(&f03->fn->dev));
 	serio_register_port(serio);
 
 	return 0;
-- 
2.16.0.rc1.238.g530d649a79-goog

^ permalink raw reply related

* [PATCH 2/3] Input: synaptics_rmi4 - unmask F03 interrupts when port is opened
From: Dmitry Torokhov @ 2018-01-19  0:49 UTC (permalink / raw)
  To: Benjamin Tissoires, Lyude Paul, Damjan Georgievski
  Cc: linux-input, linux-kernel, Andrew Duggan, stable
In-Reply-To: <20180119004955.247190-1-dmitry.torokhov@gmail.com>

Currently we register the pass-through serio port when we probe the F03 RMI
function, and then, in sensor configure phase, we unmask interrupts.
Unfortunately this is too late, as other drivers are free probe devices
attached to the serio port as soon as it is probed. Because interrupts are
masked, the IO times out, which may result in not being able to detect
trackpoints on the pass-through port.

To fix the issue we implement open() and close() methods for the
pass-through serio port and unmask interrupts from there. We also move
creation of the pass-through port form probe to configure stage, as RMI
driver does not enable transport interrupt until all functions are probed
(we should change this, but this is a separate topic).

We also try to clear the pending data before unmasking interrupts, because
some devices like to spam the system with multiple 0xaa 0x00 announcements,
which may interfere with us trying to query ID of the device.

Fixes: c5e8848fc98e ("Input: synaptics-rmi4 - add support for F03")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/rmi4/rmi_f03.c | 64 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
index ad71a5e768dc4..7ccbb370a9a81 100644
--- a/drivers/input/rmi4/rmi_f03.c
+++ b/drivers/input/rmi4/rmi_f03.c
@@ -32,6 +32,7 @@ struct f03_data {
 	struct rmi_function *fn;
 
 	struct serio *serio;
+	bool serio_registered;
 
 	unsigned int overwrite_buttons;
 
@@ -138,6 +139,37 @@ static int rmi_f03_initialize(struct f03_data *f03)
 	return 0;
 }
 
+static int rmi_f03_pt_open(struct serio *serio)
+{
+	struct f03_data *f03 = serio->port_data;
+	struct rmi_function *fn = f03->fn;
+	const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE;
+	const u16 data_addr = fn->fd.data_base_addr + RMI_F03_OB_OFFSET;
+	u8 obs[RMI_F03_QUEUE_LENGTH * RMI_F03_OB_SIZE];
+	int error;
+
+	/*
+	 * Consume any pending data. Some devices like to spam with
+	 * 0xaa 0x00 announcements which may confuse us as we try to
+	 * probe the device.
+	 */
+	error = rmi_read_block(fn->rmi_dev, data_addr, &obs, ob_len);
+	if (!error)
+		rmi_dbg(RMI_DEBUG_FN, &fn->dev,
+			"%s: Consumed %*ph (%d) from PS2 guest\n",
+			__func__, ob_len, obs, ob_len);
+
+	return fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask);
+}
+
+static void rmi_f03_pt_close(struct serio *serio)
+{
+	struct f03_data *f03 = serio->port_data;
+	struct rmi_function *fn = f03->fn;
+
+	fn->rmi_dev->driver->clear_irq_bits(fn->rmi_dev, fn->irq_mask);
+}
+
 static int rmi_f03_register_pt(struct f03_data *f03)
 {
 	struct serio *serio;
@@ -148,6 +180,8 @@ static int rmi_f03_register_pt(struct f03_data *f03)
 
 	serio->id.type = SERIO_PS_PSTHRU;
 	serio->write = rmi_f03_pt_write;
+	serio->open = rmi_f03_pt_open;
+	serio->close = rmi_f03_pt_close;
 	serio->port_data = f03;
 
 	strlcpy(serio->name, "Synaptics RMI4 PS/2 pass-through",
@@ -184,17 +218,27 @@ static int rmi_f03_probe(struct rmi_function *fn)
 			 f03->device_count);
 
 	dev_set_drvdata(dev, f03);
-
-	error = rmi_f03_register_pt(f03);
-	if (error)
-		return error;
-
 	return 0;
 }
 
 static int rmi_f03_config(struct rmi_function *fn)
 {
-	fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask);
+	struct f03_data *f03 = dev_get_drvdata(&fn->dev);
+	int error;
+
+	if (!f03->serio_registered) {
+		error = rmi_f03_register_pt(f03);
+		if (error)
+			return error;
+
+		f03->serio_registered = true;
+	} else {
+		/*
+		 * We must be re-configuring the sensor, just enable
+		 * interrupts for this function.
+		 */
+		fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask);
+	}
 
 	return 0;
 }
@@ -204,7 +248,7 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
 	struct rmi_device *rmi_dev = fn->rmi_dev;
 	struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
 	struct f03_data *f03 = dev_get_drvdata(&fn->dev);
-	u16 data_addr = fn->fd.data_base_addr;
+	const u16 data_addr = fn->fd.data_base_addr + RMI_F03_OB_OFFSET;
 	const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE;
 	u8 obs[RMI_F03_QUEUE_LENGTH * RMI_F03_OB_SIZE];
 	u8 ob_status;
@@ -226,8 +270,7 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
 		drvdata->attn_data.size -= ob_len;
 	} else {
 		/* Grab all of the data registers, and check them for data */
-		error = rmi_read_block(fn->rmi_dev, data_addr + RMI_F03_OB_OFFSET,
-				       &obs, ob_len);
+		error = rmi_read_block(fn->rmi_dev, data_addr, &obs, ob_len);
 		if (error) {
 			dev_err(&fn->dev,
 				"%s: Failed to read F03 output buffers: %d\n",
@@ -266,7 +309,8 @@ static void rmi_f03_remove(struct rmi_function *fn)
 {
 	struct f03_data *f03 = dev_get_drvdata(&fn->dev);
 
-	serio_unregister_port(f03->serio);
+	if (f03->serio_registered)
+		serio_unregister_port(f03->serio);
 }
 
 struct rmi_function_handler rmi_f03_handler = {
-- 
2.16.0.rc1.238.g530d649a79-goog

^ permalink raw reply related

* [RESEND PATCH] Documentation: input: ff: fix small typos
From: Jean-François Têtu @ 2018-01-18 21:49 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jonathan Corbet, linux-input, linux-doc, linux-kernel,
	Jean-François Têtu

Fix small typos in the Instructions and Uploading sections. Fix a typo in
the start/stop effect example usage code.

Signed-off-by: Jean-François Têtu <jean-francois.tetu@savoirfairelinux.com>
---
 Documentation/input/ff.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/input/ff.rst b/Documentation/input/ff.rst
index 26d461998e08..0c02e87ee86d 100644
--- a/Documentation/input/ff.rst
+++ b/Documentation/input/ff.rst
@@ -31,7 +31,7 @@ To enable force feedback, you have to:
 
 Before you start, let me WARN you that some devices shake violently during the
 initialisation phase. This happens for example with my "AVB Top Shot Pegasus".
-To stop this annoying behaviour, move you joystick to its limits. Anyway, you
+To stop this annoying behaviour, move your joystick to its limits. Anyway, you
 should keep a hand on your device, in order to avoid it to break down if
 something goes wrong.
 
@@ -121,7 +121,7 @@ uploaded, but not played.
 The content of effect may be modified. In particular, its field "id" is set
 to the unique id assigned by the driver. This data is required for performing
 some operations (removing an effect, controlling the playback).
-This if field must be set to -1 by the user in order to tell the driver to
+The "id" field must be set to -1 by the user in order to tell the driver to
 allocate a new effect.
 
 Effects are file descriptor specific.
@@ -178,7 +178,7 @@ Control of playing is done with write(). Below is an example:
 	stop.code = effect.id;
 	stop.value = 0;
 
-	write(fd, (const void*) &play, sizeof(stop));
+	write(fd, (const void*) &stop, sizeof(stop));
 
 Setting the gain
 ----------------
-- 
2.15.1


^ permalink raw reply related

* Re: [PATCH] input: remove at32psif
From: Dmitry Torokhov @ 2018-01-18 19:55 UTC (permalink / raw)
  To: Corentin Labbe, egtvedt; +Cc: linux-input, linux-kernel
In-Reply-To: <20180118194824.GA1276@Red>

On Thu, Jan 18, 2018 at 08:48:24PM +0100, Corentin Labbe wrote:
> On Thu, Jan 18, 2018 at 11:20:17AM -0800, Dmitry Torokhov wrote:
> > On Thu, Jan 18, 2018 at 07:58:11PM +0100, Corentin Labbe wrote:
> > > Since AVR32 arch is gone, at32psif driver is useless.
> > > This patch remove it.
> > > 
> > > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > 
> > Applied, thank you.
> > 
> > What about:
> > 
> > config TOUCHSCREEN_WM97XX_ATMEL
> > 	tristate "WM97xx Atmel accelerated touch"
> > 	depends on TOUCHSCREEN_WM97XX && AVR32 
> > 
> > ?
> > 
> 
> It was my second target BUT the code content reference to AT91 (wm97xx continuous touch driver for Atmel AT91 and AVR32) so perhaps it could be keeped.
> 
> But someone need to test it.

"&& AVR32" means that nobody ever ran it on AT91 though...
Hans-Christian, any ideas?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: remove at32psif
From: Corentin Labbe @ 2018-01-18 19:48 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: egtvedt, linux-input, linux-kernel
In-Reply-To: <20180118192017.k3gqrbqcwp53cc7z@dtor-ws>

On Thu, Jan 18, 2018 at 11:20:17AM -0800, Dmitry Torokhov wrote:
> On Thu, Jan 18, 2018 at 07:58:11PM +0100, Corentin Labbe wrote:
> > Since AVR32 arch is gone, at32psif driver is useless.
> > This patch remove it.
> > 
> > Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> 
> Applied, thank you.
> 
> What about:
> 
> config TOUCHSCREEN_WM97XX_ATMEL
> 	tristate "WM97xx Atmel accelerated touch"
> 	depends on TOUCHSCREEN_WM97XX && AVR32 
> 
> ?
> 

It was my second target BUT the code content reference to AT91 (wm97xx continuous touch driver for Atmel AT91 and AVR32) so perhaps it could be keeped.

But someone need to test it.

Regards

^ permalink raw reply

* Re: [PATCH] Input: synaptics-rmi4 - prevent UAF reported by KASAN
From: Dmitry Torokhov @ 2018-01-18 19:38 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov, kasan-dev,
	usacrc, stable, Benjamin Tissoires, Nick Dyer, Andrew Duggan,
	Christophe JAILLET, Guenter Roeck, linux-input, linux-kernel
In-Reply-To: <1516170303-3963-1-git-send-email-nick.desaulniers@gmail.com>

On Tue, Jan 16, 2018 at 10:25:01PM -0800, Nick Desaulniers wrote:
> KASAN found a UAF due to dangling pointer. As the report below says,
> rmi_f11_attention() accesses drvdata->attn_data.data, which was freed in
> rmi_irq_fn.
> 
> [  311.424062] BUG: KASAN: use-after-free in
> rmi_f11_attention+0x526/0x5e0 [rmi_core]
> [  311.424067] Read of size 27 at addr ffff88041fd610db by task
> irq/131-i2c_hid/1162
> 
> [  311.424075] CPU: 0 PID: 1162 Comm: irq/131-i2c_hid Not tainted
> 4.15.0-rc8+ #2
> [  311.424076] Hardware name: Razer Blade Stealth/Razer, BIOS 6.05
> 01/26/2017
> [  311.424078] Call Trace:
> [  311.424086]  dump_stack+0xae/0x12d
> [  311.424090]  ? _atomic_dec_and_lock+0x103/0x103
> [  311.424094]  ? show_regs_print_info+0xa/0xa
> [  311.424099]  ? input_handle_event+0x10b/0x810
> [  311.424104]  print_address_description+0x65/0x229
> [  311.424108]  kasan_report.cold.5+0xa7/0x281
> [  311.424117]  rmi_f11_attention+0x526/0x5e0 [rmi_core]
> [  311.424123]  ? memcpy+0x1f/0x50
> [  311.424132]  ? rmi_f11_attention+0x526/0x5e0 [rmi_core]
> [  311.424143]  ? rmi_f11_probe+0x1e20/0x1e20 [rmi_core]
> [  311.424153]  ? rmi_process_interrupt_requests+0x220/0x2a0 [rmi_core]
> [  311.424163]  ? rmi_irq_fn+0x22c/0x270 [rmi_core]
> [  311.424173]  ? rmi_process_interrupt_requests+0x2a0/0x2a0 [rmi_core]
> [  311.424177]  ? free_irq+0xa0/0xa0
> [  311.424180]  ? irq_finalize_oneshot.part.39+0xeb/0x180
> [  311.424190]  ? rmi_process_interrupt_requests+0x2a0/0x2a0 [rmi_core]
> [  311.424193]  ? irq_thread_fn+0x3d/0x80
> [  311.424197]  ? irq_finalize_oneshot.part.39+0x180/0x180
> [  311.424200]  ? irq_thread+0x21d/0x290
> [  311.424203]  ? irq_thread_check_affinity+0x170/0x170
> [  311.424207]  ? remove_wait_queue+0x150/0x150
> [  311.424212]  ? kasan_unpoison_shadow+0x30/0x40
> [  311.424214]  ? __init_waitqueue_head+0xa0/0xd0
> [  311.424218]  ? task_non_contending.cold.55+0x18/0x18
> [  311.424221]  ? irq_forced_thread_fn+0xa0/0xa0
> [  311.424226]  ? irq_thread_check_affinity+0x170/0x170
> [  311.424230]  ? kthread+0x19e/0x1c0
> [  311.424233]  ? kthread_create_worker_on_cpu+0xc0/0xc0
> [  311.424237]  ? ret_from_fork+0x32/0x40
> 
> [  311.424244] Allocated by task 899:
> [  311.424249]  kasan_kmalloc+0xbf/0xe0
> [  311.424252]  __kmalloc_track_caller+0xd9/0x1f0
> [  311.424255]  kmemdup+0x17/0x40
> [  311.424264]  rmi_set_attn_data+0xa4/0x1b0 [rmi_core]
> [  311.424269]  rmi_raw_event+0x10b/0x1f0 [hid_rmi]
> [  311.424278]  hid_input_report+0x1a8/0x2c0 [hid]
> [  311.424283]  i2c_hid_irq+0x146/0x1d0 [i2c_hid]
> [  311.424286]  irq_thread_fn+0x3d/0x80
> [  311.424288]  irq_thread+0x21d/0x290
> [  311.424291]  kthread+0x19e/0x1c0
> [  311.424293]  ret_from_fork+0x32/0x40
> 
> [  311.424296] Freed by task 1162:
> [  311.424300]  kasan_slab_free+0x71/0xc0
> [  311.424303]  kfree+0x90/0x190
> [  311.424311]  rmi_irq_fn+0x1b2/0x270 [rmi_core]
> [  311.424319]  rmi_irq_fn+0x257/0x270 [rmi_core]
> [  311.424322]  irq_thread_fn+0x3d/0x80
> [  311.424324]  irq_thread+0x21d/0x290
> [  311.424327]  kthread+0x19e/0x1c0
> [  311.424330]  ret_from_fork+0x32/0x40
> 
> [  311.424334] The buggy address belongs to the object at
> ffff88041fd610c0
>                 which belongs to the cache kmalloc-64 of size 64
> [  311.424340] The buggy address is located 27 bytes inside of
>                 64-byte region [ffff88041fd610c0, ffff88041fd61100)
> [  311.424344] The buggy address belongs to the page:
> [  311.424348] page:ffffea00107f5840 count:1 mapcount:0 mapping:
>    (null) index:0x0
> [  311.424353] flags: 0x17ffffc0000100(slab)
> [  311.424358] raw: 0017ffffc0000100 0000000000000000 0000000000000000
> 00000001802a002a
> [  311.424363] raw: dead000000000100 dead000000000200 ffff8804228036c0
> 0000000000000000
> [  311.424366] page dumped because: kasan: bad access detected
> 
> [  311.424369] Memory state around the buggy address:
> [  311.424373]  ffff88041fd60f80: 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00
> [  311.424377]  ffff88041fd61000: fb fb fb fb fb fb fb fb fc fc fc fc
> fb fb fb fb
> [  311.424381] >ffff88041fd61080: fb fb fb fb fc fc fc fc fb fb fb fb
> fb fb fb fb
> [  311.424384]                                                     ^
> [  311.424387]  ffff88041fd61100: fc fc fc fc fb fb fb fb fb fb fb fb
> fc fc fc fc
> [  311.424391]  ffff88041fd61180: fb fb fb fb fb fb fb fb fc fc fc fc
> fb fb fb fb
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> ---
>  drivers/input/rmi4/rmi_driver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> index 4f2bb59..141ea22 100644
> --- a/drivers/input/rmi4/rmi_driver.c
> +++ b/drivers/input/rmi4/rmi_driver.c
> @@ -230,8 +230,10 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
>  		rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
>  			"Failed to process interrupt request: %d\n", ret);
>  
> -	if (count)
> +	if (count) {
>  		kfree(attn_data.data);
> +		attn_data.data = NULL;
> +	}
>  
>  	if (!kfifo_is_empty(&drvdata->attn_fifo))
>  		return rmi_irq_fn(irq, dev_id);

Ugh, this code needs reworking as we really do not want recursion in an
interrupt handler. Anyway, this will suffice for stable; applied, thank
you.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: cyapa: remove redundant assignment to 'pwr_cmd'
From: Dmitry Torokhov @ 2018-01-18 19:22 UTC (permalink / raw)
  To: Colin King; +Cc: Guenter Roeck, linux-input, kernel-janitors, linux-kernel
In-Reply-To: <20180117104519.19422-1-colin.king@canonical.com>

On Wed, Jan 17, 2018 at 10:45:19AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable pwr_cmd is being assigned to cyapa->suspend_power_mode
> twice, once during the declaration and once after taking an
> interruptible mutex lock.  Remove the redundant first assignment
> since the value is never read and it is outside the mutex lock.
> 
> Cleans up clang warning:
> drivers/input/mouse/cyapa.c:743:5: warning: Value stored to 'pwr_cmd'
> during its initialization is never read
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thank you.

> ---
>  drivers/input/mouse/cyapa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> index fd8865c65caf..dfd3873513e4 100644
> --- a/drivers/input/mouse/cyapa.c
> +++ b/drivers/input/mouse/cyapa.c
> @@ -740,7 +740,7 @@ static ssize_t cyapa_show_suspend_scanrate(struct device *dev,
>  					   char *buf)
>  {
>  	struct cyapa *cyapa = dev_get_drvdata(dev);
> -	u8 pwr_cmd = cyapa->suspend_power_mode;
> +	u8 pwr_cmd;
>  	u16 sleep_time;
>  	int len;
>  	int error;
> -- 
> 2.15.1
> 

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: remove at32psif
From: Dmitry Torokhov @ 2018-01-18 19:20 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: egtvedt, linux-input, linux-kernel
In-Reply-To: <20180118185811.12856-1-clabbe.montjoie@gmail.com>

On Thu, Jan 18, 2018 at 07:58:11PM +0100, Corentin Labbe wrote:
> Since AVR32 arch is gone, at32psif driver is useless.
> This patch remove it.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Applied, thank you.

What about:

config TOUCHSCREEN_WM97XX_ATMEL
	tristate "WM97xx Atmel accelerated touch"
	depends on TOUCHSCREEN_WM97XX && AVR32 

?

> ---
>  drivers/input/serio/Kconfig    |  10 --
>  drivers/input/serio/Makefile   |   1 -
>  drivers/input/serio/at32psif.c | 357 -----------------------------------------
>  3 files changed, 368 deletions(-)
>  delete mode 100644 drivers/input/serio/at32psif.c
> 
> diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
> index 21488c048fa3..ca4530eb3378 100644
> --- a/drivers/input/serio/Kconfig
> +++ b/drivers/input/serio/Kconfig
> @@ -96,16 +96,6 @@ config SERIO_RPCKBD
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called rpckbd.
>  
> -config SERIO_AT32PSIF
> -	tristate "AVR32 PSIF PS/2 keyboard and mouse controller"
> -	depends on AVR32
> -	help
> -	  Say Y here if you want to use the PSIF peripheral on AVR32 devices
> -	  and connect a PS/2 keyboard and/or mouse to it.
> -
> -	  To compile this driver as a module, choose M here: the module will
> -	  be called at32psif.
> -
>  config SERIO_AMBAKMI
>  	tristate "AMBA KMI keyboard controller"
>  	depends on ARM_AMBA
> diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
> index a3ca07621542..67950a5ccb3f 100644
> --- a/drivers/input/serio/Makefile
> +++ b/drivers/input/serio/Makefile
> @@ -13,7 +13,6 @@ obj-$(CONFIG_SERIO_CT82C710)	+= ct82c710.o
>  obj-$(CONFIG_SERIO_RPCKBD)	+= rpckbd.o
>  obj-$(CONFIG_SERIO_SA1111)	+= sa1111ps2.o
>  obj-$(CONFIG_SERIO_AMBAKMI)	+= ambakmi.o
> -obj-$(CONFIG_SERIO_AT32PSIF)	+= at32psif.o
>  obj-$(CONFIG_SERIO_Q40KBD)	+= q40kbd.o
>  obj-$(CONFIG_SERIO_GSCPS2)	+= gscps2.o
>  obj-$(CONFIG_HP_SDC)		+= hp_sdc.o
> diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
> deleted file mode 100644
> index e420fd781d44..000000000000
> --- a/drivers/input/serio/at32psif.c
> +++ /dev/null
> @@ -1,357 +0,0 @@
> -/*
> - * Copyright (C) 2007 Atmel Corporation
> - *
> - * Driver for the AT32AP700X PS/2 controller (PSIF).
> - *
> - * This program is free software; you can redistribute it and/or modify it
> - * under the terms of the GNU General Public License version 2 as published
> - * by the Free Software Foundation.
> - */
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/device.h>
> -#include <linux/init.h>
> -#include <linux/serio.h>
> -#include <linux/interrupt.h>
> -#include <linux/delay.h>
> -#include <linux/err.h>
> -#include <linux/io.h>
> -#include <linux/clk.h>
> -#include <linux/platform_device.h>
> -#include <linux/slab.h>
> -
> -/* PSIF register offsets */
> -#define PSIF_CR				0x00
> -#define PSIF_RHR			0x04
> -#define PSIF_THR			0x08
> -#define PSIF_SR				0x10
> -#define PSIF_IER			0x14
> -#define PSIF_IDR			0x18
> -#define PSIF_IMR			0x1c
> -#define PSIF_PSR			0x24
> -
> -/* Bitfields in control register. */
> -#define PSIF_CR_RXDIS_OFFSET		1
> -#define PSIF_CR_RXDIS_SIZE		1
> -#define PSIF_CR_RXEN_OFFSET		0
> -#define PSIF_CR_RXEN_SIZE		1
> -#define PSIF_CR_SWRST_OFFSET		15
> -#define PSIF_CR_SWRST_SIZE		1
> -#define PSIF_CR_TXDIS_OFFSET		9
> -#define PSIF_CR_TXDIS_SIZE		1
> -#define PSIF_CR_TXEN_OFFSET		8
> -#define PSIF_CR_TXEN_SIZE		1
> -
> -/* Bitfields in interrupt disable, enable, mask and status register. */
> -#define PSIF_NACK_OFFSET		8
> -#define PSIF_NACK_SIZE			1
> -#define PSIF_OVRUN_OFFSET		5
> -#define PSIF_OVRUN_SIZE			1
> -#define PSIF_PARITY_OFFSET		9
> -#define PSIF_PARITY_SIZE		1
> -#define PSIF_RXRDY_OFFSET		4
> -#define PSIF_RXRDY_SIZE			1
> -#define PSIF_TXEMPTY_OFFSET		1
> -#define PSIF_TXEMPTY_SIZE		1
> -#define PSIF_TXRDY_OFFSET		0
> -#define PSIF_TXRDY_SIZE			1
> -
> -/* Bitfields in prescale register. */
> -#define PSIF_PSR_PRSCV_OFFSET		0
> -#define PSIF_PSR_PRSCV_SIZE		12
> -
> -/* Bitfields in receive hold register. */
> -#define PSIF_RHR_RXDATA_OFFSET		0
> -#define PSIF_RHR_RXDATA_SIZE		8
> -
> -/* Bitfields in transmit hold register. */
> -#define PSIF_THR_TXDATA_OFFSET		0
> -#define PSIF_THR_TXDATA_SIZE		8
> -
> -/* Bit manipulation macros */
> -#define PSIF_BIT(name)					\
> -	(1 << PSIF_##name##_OFFSET)
> -
> -#define PSIF_BF(name, value)				\
> -	(((value) & ((1 << PSIF_##name##_SIZE) - 1))	\
> -	 << PSIF_##name##_OFFSET)
> -
> -#define PSIF_BFEXT(name, value)				\
> -	(((value) >> PSIF_##name##_OFFSET)		\
> -	 & ((1 << PSIF_##name##_SIZE) - 1))
> -
> -#define PSIF_BFINS(name, value, old)			\
> -	(((old) & ~(((1 << PSIF_##name##_SIZE) - 1)	\
> -		    << PSIF_##name##_OFFSET))		\
> -	 | PSIF_BF(name, value))
> -
> -/* Register access macros */
> -#define psif_readl(port, reg)				\
> -	__raw_readl((port)->regs + PSIF_##reg)
> -
> -#define psif_writel(port, reg, value)			\
> -	__raw_writel((value), (port)->regs + PSIF_##reg)
> -
> -struct psif {
> -	struct platform_device	*pdev;
> -	struct clk		*pclk;
> -	struct serio		*io;
> -	void __iomem		*regs;
> -	unsigned int		irq;
> -	/* Prevent concurrent writes to PSIF THR. */
> -	spinlock_t		lock;
> -	bool			open;
> -};
> -
> -static irqreturn_t psif_interrupt(int irq, void *_ptr)
> -{
> -	struct psif *psif = _ptr;
> -	int retval = IRQ_NONE;
> -	unsigned int io_flags = 0;
> -	unsigned long status;
> -
> -	status = psif_readl(psif, SR);
> -
> -	if (status & PSIF_BIT(RXRDY)) {
> -		unsigned char val = (unsigned char) psif_readl(psif, RHR);
> -
> -		if (status & PSIF_BIT(PARITY))
> -			io_flags |= SERIO_PARITY;
> -		if (status & PSIF_BIT(OVRUN))
> -			dev_err(&psif->pdev->dev, "overrun read error\n");
> -
> -		serio_interrupt(psif->io, val, io_flags);
> -
> -		retval = IRQ_HANDLED;
> -	}
> -
> -	return retval;
> -}
> -
> -static int psif_write(struct serio *io, unsigned char val)
> -{
> -	struct psif *psif = io->port_data;
> -	unsigned long flags;
> -	int timeout = 10;
> -	int retval = 0;
> -
> -	spin_lock_irqsave(&psif->lock, flags);
> -
> -	while (!(psif_readl(psif, SR) & PSIF_BIT(TXEMPTY)) && timeout--)
> -		udelay(50);
> -
> -	if (timeout >= 0) {
> -		psif_writel(psif, THR, val);
> -	} else {
> -		dev_dbg(&psif->pdev->dev, "timeout writing to THR\n");
> -		retval = -EBUSY;
> -	}
> -
> -	spin_unlock_irqrestore(&psif->lock, flags);
> -
> -	return retval;
> -}
> -
> -static int psif_open(struct serio *io)
> -{
> -	struct psif *psif = io->port_data;
> -	int retval;
> -
> -	retval = clk_enable(psif->pclk);
> -	if (retval)
> -		return retval;
> -
> -	psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN));
> -	psif_writel(psif, IER, PSIF_BIT(RXRDY));
> -
> -	psif->open = true;
> -	return retval;
> -}
> -
> -static void psif_close(struct serio *io)
> -{
> -	struct psif *psif = io->port_data;
> -
> -	psif->open = false;
> -
> -	psif_writel(psif, IDR, ~0UL);
> -	psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
> -
> -	clk_disable(psif->pclk);
> -}
> -
> -static void psif_set_prescaler(struct psif *psif)
> -{
> -	unsigned long prscv;
> -	unsigned long rate = clk_get_rate(psif->pclk);
> -
> -	/* PRSCV = Pulse length (100 us) * PSIF module frequency. */
> -	prscv = 100 * (rate / 1000000UL);
> -
> -	if (prscv > ((1<<PSIF_PSR_PRSCV_SIZE) - 1)) {
> -		prscv = (1<<PSIF_PSR_PRSCV_SIZE) - 1;
> -		dev_dbg(&psif->pdev->dev, "pclk too fast, "
> -				"prescaler set to max\n");
> -	}
> -
> -	clk_enable(psif->pclk);
> -	psif_writel(psif, PSR, prscv);
> -	clk_disable(psif->pclk);
> -}
> -
> -static int __init psif_probe(struct platform_device *pdev)
> -{
> -	struct resource *regs;
> -	struct psif *psif;
> -	struct serio *io;
> -	struct clk *pclk;
> -	int irq;
> -	int ret;
> -
> -	psif = kzalloc(sizeof(struct psif), GFP_KERNEL);
> -	if (!psif)
> -		return -ENOMEM;
> -	psif->pdev = pdev;
> -
> -	io = kzalloc(sizeof(struct serio), GFP_KERNEL);
> -	if (!io) {
> -		ret = -ENOMEM;
> -		goto out_free_psif;
> -	}
> -	psif->io = io;
> -
> -	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!regs) {
> -		dev_dbg(&pdev->dev, "no mmio resources defined\n");
> -		ret = -ENOMEM;
> -		goto out_free_io;
> -	}
> -
> -	psif->regs = ioremap(regs->start, resource_size(regs));
> -	if (!psif->regs) {
> -		ret = -ENOMEM;
> -		dev_dbg(&pdev->dev, "could not map I/O memory\n");
> -		goto out_free_io;
> -	}
> -
> -	pclk = clk_get(&pdev->dev, "pclk");
> -	if (IS_ERR(pclk)) {
> -		dev_dbg(&pdev->dev, "could not get peripheral clock\n");
> -		ret = PTR_ERR(pclk);
> -		goto out_iounmap;
> -	}
> -	psif->pclk = pclk;
> -
> -	/* Reset the PSIF to enter at a known state. */
> -	ret = clk_enable(pclk);
> -	if (ret) {
> -		dev_dbg(&pdev->dev, "could not enable pclk\n");
> -		goto out_put_clk;
> -	}
> -	psif_writel(psif, CR, PSIF_BIT(CR_SWRST));
> -	clk_disable(pclk);
> -
> -	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0) {
> -		dev_dbg(&pdev->dev, "could not get irq\n");
> -		ret = -ENXIO;
> -		goto out_put_clk;
> -	}
> -	ret = request_irq(irq, psif_interrupt, IRQF_SHARED, "at32psif", psif);
> -	if (ret) {
> -		dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
> -		goto out_put_clk;
> -	}
> -	psif->irq = irq;
> -
> -	io->id.type	= SERIO_8042;
> -	io->write	= psif_write;
> -	io->open	= psif_open;
> -	io->close	= psif_close;
> -	snprintf(io->name, sizeof(io->name), "AVR32 PS/2 port%d", pdev->id);
> -	snprintf(io->phys, sizeof(io->phys), "at32psif/serio%d", pdev->id);
> -	io->port_data	= psif;
> -	io->dev.parent	= &pdev->dev;
> -
> -	psif_set_prescaler(psif);
> -
> -	spin_lock_init(&psif->lock);
> -	serio_register_port(psif->io);
> -	platform_set_drvdata(pdev, psif);
> -
> -	dev_info(&pdev->dev, "Atmel AVR32 PSIF PS/2 driver on 0x%08x irq %d\n",
> -			(int)psif->regs, psif->irq);
> -
> -	return 0;
> -
> -out_put_clk:
> -	clk_put(psif->pclk);
> -out_iounmap:
> -	iounmap(psif->regs);
> -out_free_io:
> -	kfree(io);
> -out_free_psif:
> -	kfree(psif);
> -	return ret;
> -}
> -
> -static int __exit psif_remove(struct platform_device *pdev)
> -{
> -	struct psif *psif = platform_get_drvdata(pdev);
> -
> -	psif_writel(psif, IDR, ~0UL);
> -	psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
> -
> -	serio_unregister_port(psif->io);
> -	iounmap(psif->regs);
> -	free_irq(psif->irq, psif);
> -	clk_put(psif->pclk);
> -	kfree(psif);
> -
> -	return 0;
> -}
> -
> -#ifdef CONFIG_PM_SLEEP
> -static int psif_suspend(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct psif *psif = platform_get_drvdata(pdev);
> -
> -	if (psif->open) {
> -		psif_writel(psif, CR, PSIF_BIT(CR_RXDIS) | PSIF_BIT(CR_TXDIS));
> -		clk_disable(psif->pclk);
> -	}
> -
> -	return 0;
> -}
> -
> -static int psif_resume(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct psif *psif = platform_get_drvdata(pdev);
> -
> -	if (psif->open) {
> -		clk_enable(psif->pclk);
> -		psif_set_prescaler(psif);
> -		psif_writel(psif, CR, PSIF_BIT(CR_RXEN) | PSIF_BIT(CR_TXEN));
> -	}
> -
> -	return 0;
> -}
> -#endif
> -
> -static SIMPLE_DEV_PM_OPS(psif_pm_ops, psif_suspend, psif_resume);
> -
> -static struct platform_driver psif_driver = {
> -	.remove		= __exit_p(psif_remove),
> -	.driver		= {
> -		.name	= "atmel_psif",
> -		.pm	= &psif_pm_ops,
> -	},
> -};
> -
> -module_platform_driver_probe(psif_driver, psif_probe);
> -
> -MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>");
> -MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver");
> -MODULE_LICENSE("GPL");
> -- 
> 2.13.6
> 

-- 
Dmitry

^ permalink raw reply

* [PATCH] input: remove at32psif
From: Corentin Labbe @ 2018-01-18 18:58 UTC (permalink / raw)
  To: dmitry.torokhov, egtvedt; +Cc: linux-input, linux-kernel, Corentin Labbe

Since AVR32 arch is gone, at32psif driver is useless.
This patch remove it.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/input/serio/Kconfig    |  10 --
 drivers/input/serio/Makefile   |   1 -
 drivers/input/serio/at32psif.c | 357 -----------------------------------------
 3 files changed, 368 deletions(-)
 delete mode 100644 drivers/input/serio/at32psif.c

diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 21488c048fa3..ca4530eb3378 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -96,16 +96,6 @@ config SERIO_RPCKBD
 	  To compile this driver as a module, choose M here: the
 	  module will be called rpckbd.
 
-config SERIO_AT32PSIF
-	tristate "AVR32 PSIF PS/2 keyboard and mouse controller"
-	depends on AVR32
-	help
-	  Say Y here if you want to use the PSIF peripheral on AVR32 devices
-	  and connect a PS/2 keyboard and/or mouse to it.
-
-	  To compile this driver as a module, choose M here: the module will
-	  be called at32psif.
-
 config SERIO_AMBAKMI
 	tristate "AMBA KMI keyboard controller"
 	depends on ARM_AMBA
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
index a3ca07621542..67950a5ccb3f 100644
--- a/drivers/input/serio/Makefile
+++ b/drivers/input/serio/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_SERIO_CT82C710)	+= ct82c710.o
 obj-$(CONFIG_SERIO_RPCKBD)	+= rpckbd.o
 obj-$(CONFIG_SERIO_SA1111)	+= sa1111ps2.o
 obj-$(CONFIG_SERIO_AMBAKMI)	+= ambakmi.o
-obj-$(CONFIG_SERIO_AT32PSIF)	+= at32psif.o
 obj-$(CONFIG_SERIO_Q40KBD)	+= q40kbd.o
 obj-$(CONFIG_SERIO_GSCPS2)	+= gscps2.o
 obj-$(CONFIG_HP_SDC)		+= hp_sdc.o
diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c
deleted file mode 100644
index e420fd781d44..000000000000
--- a/drivers/input/serio/at32psif.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (C) 2007 Atmel Corporation
- *
- * Driver for the AT32AP700X PS/2 controller (PSIF).
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- */
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/device.h>
-#include <linux/init.h>
-#include <linux/serio.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-
-/* PSIF register offsets */
-#define PSIF_CR				0x00
-#define PSIF_RHR			0x04
-#define PSIF_THR			0x08
-#define PSIF_SR				0x10
-#define PSIF_IER			0x14
-#define PSIF_IDR			0x18
-#define PSIF_IMR			0x1c
-#define PSIF_PSR			0x24
-
-/* Bitfields in control register. */
-#define PSIF_CR_RXDIS_OFFSET		1
-#define PSIF_CR_RXDIS_SIZE		1
-#define PSIF_CR_RXEN_OFFSET		0
-#define PSIF_CR_RXEN_SIZE		1
-#define PSIF_CR_SWRST_OFFSET		15
-#define PSIF_CR_SWRST_SIZE		1
-#define PSIF_CR_TXDIS_OFFSET		9
-#define PSIF_CR_TXDIS_SIZE		1
-#define PSIF_CR_TXEN_OFFSET		8
-#define PSIF_CR_TXEN_SIZE		1
-
-/* Bitfields in interrupt disable, enable, mask and status register. */
-#define PSIF_NACK_OFFSET		8
-#define PSIF_NACK_SIZE			1
-#define PSIF_OVRUN_OFFSET		5
-#define PSIF_OVRUN_SIZE			1
-#define PSIF_PARITY_OFFSET		9
-#define PSIF_PARITY_SIZE		1
-#define PSIF_RXRDY_OFFSET		4
-#define PSIF_RXRDY_SIZE			1
-#define PSIF_TXEMPTY_OFFSET		1
-#define PSIF_TXEMPTY_SIZE		1
-#define PSIF_TXRDY_OFFSET		0
-#define PSIF_TXRDY_SIZE			1
-
-/* Bitfields in prescale register. */
-#define PSIF_PSR_PRSCV_OFFSET		0
-#define PSIF_PSR_PRSCV_SIZE		12
-
-/* Bitfields in receive hold register. */
-#define PSIF_RHR_RXDATA_OFFSET		0
-#define PSIF_RHR_RXDATA_SIZE		8
-
-/* Bitfields in transmit hold register. */
-#define PSIF_THR_TXDATA_OFFSET		0
-#define PSIF_THR_TXDATA_SIZE		8
-
-/* Bit manipulation macros */
-#define PSIF_BIT(name)					\
-	(1 << PSIF_##name##_OFFSET)
-
-#define PSIF_BF(name, value)				\
-	(((value) & ((1 << PSIF_##name##_SIZE) - 1))	\
-	 << PSIF_##name##_OFFSET)
-
-#define PSIF_BFEXT(name, value)				\
-	(((value) >> PSIF_##name##_OFFSET)		\
-	 & ((1 << PSIF_##name##_SIZE) - 1))
-
-#define PSIF_BFINS(name, value, old)			\
-	(((old) & ~(((1 << PSIF_##name##_SIZE) - 1)	\
-		    << PSIF_##name##_OFFSET))		\
-	 | PSIF_BF(name, value))
-
-/* Register access macros */
-#define psif_readl(port, reg)				\
-	__raw_readl((port)->regs + PSIF_##reg)
-
-#define psif_writel(port, reg, value)			\
-	__raw_writel((value), (port)->regs + PSIF_##reg)
-
-struct psif {
-	struct platform_device	*pdev;
-	struct clk		*pclk;
-	struct serio		*io;
-	void __iomem		*regs;
-	unsigned int		irq;
-	/* Prevent concurrent writes to PSIF THR. */
-	spinlock_t		lock;
-	bool			open;
-};
-
-static irqreturn_t psif_interrupt(int irq, void *_ptr)
-{
-	struct psif *psif = _ptr;
-	int retval = IRQ_NONE;
-	unsigned int io_flags = 0;
-	unsigned long status;
-
-	status = psif_readl(psif, SR);
-
-	if (status & PSIF_BIT(RXRDY)) {
-		unsigned char val = (unsigned char) psif_readl(psif, RHR);
-
-		if (status & PSIF_BIT(PARITY))
-			io_flags |= SERIO_PARITY;
-		if (status & PSIF_BIT(OVRUN))
-			dev_err(&psif->pdev->dev, "overrun read error\n");
-
-		serio_interrupt(psif->io, val, io_flags);
-
-		retval = IRQ_HANDLED;
-	}
-
-	return retval;
-}
-
-static int psif_write(struct serio *io, unsigned char val)
-{
-	struct psif *psif = io->port_data;
-	unsigned long flags;
-	int timeout = 10;
-	int retval = 0;
-
-	spin_lock_irqsave(&psif->lock, flags);
-
-	while (!(psif_readl(psif, SR) & PSIF_BIT(TXEMPTY)) && timeout--)
-		udelay(50);
-
-	if (timeout >= 0) {
-		psif_writel(psif, THR, val);
-	} else {
-		dev_dbg(&psif->pdev->dev, "timeout writing to THR\n");
-		retval = -EBUSY;
-	}
-
-	spin_unlock_irqrestore(&psif->lock, flags);
-
-	return retval;
-}
-
-static int psif_open(struct serio *io)
-{
-	struct psif *psif = io->port_data;
-	int retval;
-
-	retval = clk_enable(psif->pclk);
-	if (retval)
-		return retval;
-
-	psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN));
-	psif_writel(psif, IER, PSIF_BIT(RXRDY));
-
-	psif->open = true;
-	return retval;
-}
-
-static void psif_close(struct serio *io)
-{
-	struct psif *psif = io->port_data;
-
-	psif->open = false;
-
-	psif_writel(psif, IDR, ~0UL);
-	psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
-
-	clk_disable(psif->pclk);
-}
-
-static void psif_set_prescaler(struct psif *psif)
-{
-	unsigned long prscv;
-	unsigned long rate = clk_get_rate(psif->pclk);
-
-	/* PRSCV = Pulse length (100 us) * PSIF module frequency. */
-	prscv = 100 * (rate / 1000000UL);
-
-	if (prscv > ((1<<PSIF_PSR_PRSCV_SIZE) - 1)) {
-		prscv = (1<<PSIF_PSR_PRSCV_SIZE) - 1;
-		dev_dbg(&psif->pdev->dev, "pclk too fast, "
-				"prescaler set to max\n");
-	}
-
-	clk_enable(psif->pclk);
-	psif_writel(psif, PSR, prscv);
-	clk_disable(psif->pclk);
-}
-
-static int __init psif_probe(struct platform_device *pdev)
-{
-	struct resource *regs;
-	struct psif *psif;
-	struct serio *io;
-	struct clk *pclk;
-	int irq;
-	int ret;
-
-	psif = kzalloc(sizeof(struct psif), GFP_KERNEL);
-	if (!psif)
-		return -ENOMEM;
-	psif->pdev = pdev;
-
-	io = kzalloc(sizeof(struct serio), GFP_KERNEL);
-	if (!io) {
-		ret = -ENOMEM;
-		goto out_free_psif;
-	}
-	psif->io = io;
-
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!regs) {
-		dev_dbg(&pdev->dev, "no mmio resources defined\n");
-		ret = -ENOMEM;
-		goto out_free_io;
-	}
-
-	psif->regs = ioremap(regs->start, resource_size(regs));
-	if (!psif->regs) {
-		ret = -ENOMEM;
-		dev_dbg(&pdev->dev, "could not map I/O memory\n");
-		goto out_free_io;
-	}
-
-	pclk = clk_get(&pdev->dev, "pclk");
-	if (IS_ERR(pclk)) {
-		dev_dbg(&pdev->dev, "could not get peripheral clock\n");
-		ret = PTR_ERR(pclk);
-		goto out_iounmap;
-	}
-	psif->pclk = pclk;
-
-	/* Reset the PSIF to enter at a known state. */
-	ret = clk_enable(pclk);
-	if (ret) {
-		dev_dbg(&pdev->dev, "could not enable pclk\n");
-		goto out_put_clk;
-	}
-	psif_writel(psif, CR, PSIF_BIT(CR_SWRST));
-	clk_disable(pclk);
-
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0) {
-		dev_dbg(&pdev->dev, "could not get irq\n");
-		ret = -ENXIO;
-		goto out_put_clk;
-	}
-	ret = request_irq(irq, psif_interrupt, IRQF_SHARED, "at32psif", psif);
-	if (ret) {
-		dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
-		goto out_put_clk;
-	}
-	psif->irq = irq;
-
-	io->id.type	= SERIO_8042;
-	io->write	= psif_write;
-	io->open	= psif_open;
-	io->close	= psif_close;
-	snprintf(io->name, sizeof(io->name), "AVR32 PS/2 port%d", pdev->id);
-	snprintf(io->phys, sizeof(io->phys), "at32psif/serio%d", pdev->id);
-	io->port_data	= psif;
-	io->dev.parent	= &pdev->dev;
-
-	psif_set_prescaler(psif);
-
-	spin_lock_init(&psif->lock);
-	serio_register_port(psif->io);
-	platform_set_drvdata(pdev, psif);
-
-	dev_info(&pdev->dev, "Atmel AVR32 PSIF PS/2 driver on 0x%08x irq %d\n",
-			(int)psif->regs, psif->irq);
-
-	return 0;
-
-out_put_clk:
-	clk_put(psif->pclk);
-out_iounmap:
-	iounmap(psif->regs);
-out_free_io:
-	kfree(io);
-out_free_psif:
-	kfree(psif);
-	return ret;
-}
-
-static int __exit psif_remove(struct platform_device *pdev)
-{
-	struct psif *psif = platform_get_drvdata(pdev);
-
-	psif_writel(psif, IDR, ~0UL);
-	psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
-
-	serio_unregister_port(psif->io);
-	iounmap(psif->regs);
-	free_irq(psif->irq, psif);
-	clk_put(psif->pclk);
-	kfree(psif);
-
-	return 0;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int psif_suspend(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct psif *psif = platform_get_drvdata(pdev);
-
-	if (psif->open) {
-		psif_writel(psif, CR, PSIF_BIT(CR_RXDIS) | PSIF_BIT(CR_TXDIS));
-		clk_disable(psif->pclk);
-	}
-
-	return 0;
-}
-
-static int psif_resume(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct psif *psif = platform_get_drvdata(pdev);
-
-	if (psif->open) {
-		clk_enable(psif->pclk);
-		psif_set_prescaler(psif);
-		psif_writel(psif, CR, PSIF_BIT(CR_RXEN) | PSIF_BIT(CR_TXEN));
-	}
-
-	return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(psif_pm_ops, psif_suspend, psif_resume);
-
-static struct platform_driver psif_driver = {
-	.remove		= __exit_p(psif_remove),
-	.driver		= {
-		.name	= "atmel_psif",
-		.pm	= &psif_pm_ops,
-	},
-};
-
-module_platform_driver_probe(psif_driver, psif_probe);
-
-MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>");
-MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver");
-MODULE_LICENSE("GPL");
-- 
2.13.6


^ permalink raw reply related

* Re: [PATCH] input: joystick: make USB drivers depend on USB
From: Dmitry Torokhov @ 2018-01-18 18:54 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Marcus Folkesson, Tomohiro Yoshidomi, David Herrmann, linux-input,
	linux-kernel
In-Reply-To: <bbdfcd99-8a2b-d04a-ae3f-a0cac50d312a@infradead.org>

On Thu, Jan 18, 2018 at 10:25:21AM -0800, Randy Dunlap wrote:
> On 01/17/2018 01:53 PM, Dmitry Torokhov wrote:
> > On Wed, Jan 17, 2018 at 10:30:10PM +0100, Marcus Folkesson wrote:
> >> A driver should not enable an entire subsystem.
> > 
> > I disagree. As you go through menuconfig and you encounter this option
> > and you have the hardware and you want to enable it, you should be able
> > to do so. Otherwise you enable bunch of functionality, then go back,
> > see what new options appeared, enable them, go back, see if any more new
> > options appeared, and so on.
> 
> I've been thinking about this.  If a user is using a distro .config file,
> it most likely has USB support already enabled, so the description above will
> not apply to them.  If they are using some kernel-supplied defconfig file,
> I still think that the description above will not apply to them since those
> defconfig file will most likely have USB enabled if the target platform supports
> USB.  And if they are using some .config file that does not have USB support
> enabled, it could be that way for a very good reason.  If the target platform
> does not support USB but the user enables (sets) JOYSTICK_XPAD (which selects
> USB) but then their device does not work, they will be both disappointed and
> confused.

You mean their system has USB ports to plug in the XPAD but the target
platform does not support USB? I doubt that happens, but it is supposed
to be handled by "depends on USB_ARCH_HAS_HCD". If platform definitely
does not have a host controller, then we'll hide drivers for USB
devices.

> 
> Anyway, I don't think that users will face the problem that you described
> very often.  But I understand what you are saying also.

Yeah, I do not think we have a good config language/tools that allows
easily turn on/off features, it's all different tradeoffs. Given that we
had this "select USB/depends on USB_ARCH_HAS_HCD" for close to 10 years
now, I'd prefer leaving it alone.

Thanks.

> 
> 
> > What exactly prompted this change?
> > 
> >>
> >> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> >> ---
> >>  drivers/input/joystick/Kconfig | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
> >> index 332c0cc1b2ab..4a199cff8c68 100644
> >> --- a/drivers/input/joystick/Kconfig
> >> +++ b/drivers/input/joystick/Kconfig
> >> @@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
> >>  
> >>  config JOYSTICK_XPAD
> >>  	tristate "X-Box gamepad support"
> >> -	depends on USB_ARCH_HAS_HCD
> >> -	select USB
> >> +	depends on USB
> >>  	help
> >>  	  Say Y here if you want to use the X-Box pad with your computer.
> >>  	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
> >> -- 
> >> 2.15.1
> >>
> > 
> 
> 
> -- 
> ~Randy

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: joystick: make USB drivers depend on USB
From: Randy Dunlap @ 2018-01-18 18:25 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson
  Cc: Tomohiro Yoshidomi, David Herrmann, linux-input, linux-kernel
In-Reply-To: <20180117215316.7qe5o2pspb3dqgny@dtor-ws>

On 01/17/2018 01:53 PM, Dmitry Torokhov wrote:
> On Wed, Jan 17, 2018 at 10:30:10PM +0100, Marcus Folkesson wrote:
>> A driver should not enable an entire subsystem.
> 
> I disagree. As you go through menuconfig and you encounter this option
> and you have the hardware and you want to enable it, you should be able
> to do so. Otherwise you enable bunch of functionality, then go back,
> see what new options appeared, enable them, go back, see if any more new
> options appeared, and so on.

I've been thinking about this.  If a user is using a distro .config file,
it most likely has USB support already enabled, so the description above will
not apply to them.  If they are using some kernel-supplied defconfig file,
I still think that the description above will not apply to them since those
defconfig file will most likely have USB enabled if the target platform supports
USB.  And if they are using some .config file that does not have USB support
enabled, it could be that way for a very good reason.  If the target platform
does not support USB but the user enables (sets) JOYSTICK_XPAD (which selects
USB) but then their device does not work, they will be both disappointed and
confused.

Anyway, I don't think that users will face the problem that you described
very often.  But I understand what you are saying also.


> What exactly prompted this change?
> 
>>
>> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>> ---
>>  drivers/input/joystick/Kconfig | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
>> index 332c0cc1b2ab..4a199cff8c68 100644
>> --- a/drivers/input/joystick/Kconfig
>> +++ b/drivers/input/joystick/Kconfig
>> @@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
>>  
>>  config JOYSTICK_XPAD
>>  	tristate "X-Box gamepad support"
>> -	depends on USB_ARCH_HAS_HCD
>> -	select USB
>> +	depends on USB
>>  	help
>>  	  Say Y here if you want to use the X-Box pad with your computer.
>>  	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
>> -- 
>> 2.15.1
>>
> 


-- 
~Randy

^ permalink raw reply

* Re: [PATCH v1] HID: sony: Print reversed MAC address via %pMR
From: Andy Shevchenko @ 2018-01-18 13:41 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Colenbrander, Roelof, Jiri Kosina, linux-input@vger.kernel.org
In-Reply-To: <CAO-hwJ++gQX+72q8AfnM8q8-MzHyFbxUhnjL+=kSQKeUQ+H1KQ@mail.gmail.com>

On Wed, 2017-12-20 at 10:40 +0100, Benjamin Tissoires wrote:
> Hi Andy,
> 
> On Tue, Dec 19, 2017 at 6:20 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Wed, 2017-12-13 at 02:22 +0000, Colenbrander, Roelof wrote:
> > > On 12/11/2017 05:07 AM, Andy Shevchenko wrote:
> > > > Reversed MAC addresses can be printed directly using %pMR
> > > > specifier.
> > > Looks good and in a quick test seems to function.
> > > 
> > > Acked-by: Roderick Colenbrander <roderick.colenbranderer@sony.com>
> > > 
> > 
> > Benjamin, perhaps it's good enough to being applied?
> 
> This question should be directed to Jiri :)

Jiri?

> Anyway:
> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks!

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply

* Re: [PATCH] input: joystick: make USB drivers depend on USB
From: Randy Dunlap @ 2018-01-18  0:01 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson
  Cc: Tomohiro Yoshidomi, David Herrmann, linux-input, linux-kernel
In-Reply-To: <20180117215316.7qe5o2pspb3dqgny@dtor-ws>

On 01/17/2018 01:53 PM, Dmitry Torokhov wrote:
> On Wed, Jan 17, 2018 at 10:30:10PM +0100, Marcus Folkesson wrote:
>> A driver should not enable an entire subsystem.
> 
> I disagree. As you go through menuconfig and you encounter this option
> and you have the hardware and you want to enable it, you should be able
> to do so. Otherwise you enable bunch of functionality, then go back,
> see what new options appeared, enable them, go back, see if any more new
> options appeared, and so on.
> 
> What exactly prompted this change?

Two things:  today when I reviewed Marcus's patch that selected USB, I
commented something along that line.

But that was based on something that Linus has written at least two times
in the past on lkml.

>>
>> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>> ---
>>  drivers/input/joystick/Kconfig | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
>> index 332c0cc1b2ab..4a199cff8c68 100644
>> --- a/drivers/input/joystick/Kconfig
>> +++ b/drivers/input/joystick/Kconfig
>> @@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
>>  
>>  config JOYSTICK_XPAD
>>  	tristate "X-Box gamepad support"
>> -	depends on USB_ARCH_HAS_HCD
>> -	select USB
>> +	depends on USB
>>  	help
>>  	  Say Y here if you want to use the X-Box pad with your computer.
>>  	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
>> -- 


-- 
~Randy

^ permalink raw reply

* Re: [PATCH] input: joystick: make USB drivers depend on USB
From: Dmitry Torokhov @ 2018-01-17 21:53 UTC (permalink / raw)
  To: Marcus Folkesson
  Cc: Tomohiro Yoshidomi, David Herrmann, linux-input, linux-kernel
In-Reply-To: <20180117213010.810-1-marcus.folkesson@gmail.com>

On Wed, Jan 17, 2018 at 10:30:10PM +0100, Marcus Folkesson wrote:
> A driver should not enable an entire subsystem.

I disagree. As you go through menuconfig and you encounter this option
and you have the hardware and you want to enable it, you should be able
to do so. Otherwise you enable bunch of functionality, then go back,
see what new options appeared, enable them, go back, see if any more new
options appeared, and so on.

What exactly prompted this change?

> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
>  drivers/input/joystick/Kconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
> index 332c0cc1b2ab..4a199cff8c68 100644
> --- a/drivers/input/joystick/Kconfig
> +++ b/drivers/input/joystick/Kconfig
> @@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
>  
>  config JOYSTICK_XPAD
>  	tristate "X-Box gamepad support"
> -	depends on USB_ARCH_HAS_HCD
> -	select USB
> +	depends on USB
>  	help
>  	  Say Y here if you want to use the X-Box pad with your computer.
>  	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
> -- 
> 2.15.1
> 

-- 
Dmitry

^ permalink raw reply

* [PATCH] input: touchscreen: make USB drivers depend on USB
From: Marcus Folkesson @ 2018-01-17 21:40 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andi Shyti, Michael Hennerich,
	Jelle van der Waa, Marcus Folkesson, Anthony Kim, hns,
	Randy Dunlap, Ksenija Stanojevic, Martin Kepplinger,
	Robert Jarzmik
  Cc: linux-input, linux-kernel

A driver should not enable an entire subsystem.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/input/touchscreen/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 38a226f9fcbd..08d2c1434493 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -837,8 +837,7 @@ config TOUCHSCREEN_WM97XX_ZYLONITE
 
 config TOUCHSCREEN_USB_COMPOSITE
 	tristate "USB Touchscreen Driver"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  USB Touchscreen driver for:
 	  - eGalax Touchkit USB (also includes eTurboTouch CT-410/510/700)
-- 
2.15.1


^ permalink raw reply related

* [PATCH] input: tablet: make USB drivers depend on USB
From: Marcus Folkesson @ 2018-01-17 21:36 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson; +Cc: linux-input, linux-kernel

A driver should not enable an entire subsystem.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/input/tablet/Kconfig | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/input/tablet/Kconfig b/drivers/input/tablet/Kconfig
index a2b9f97422ce..379f40858709 100644
--- a/drivers/input/tablet/Kconfig
+++ b/drivers/input/tablet/Kconfig
@@ -13,8 +13,7 @@ if INPUT_TABLET
 
 config TABLET_USB_ACECAD
 	tristate "Acecad Flair tablet support (USB)"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the USB version of the Acecad Flair
 	  tablet.  Make sure to say Y to "Mouse support"
@@ -26,8 +25,7 @@ config TABLET_USB_ACECAD
 
 config TABLET_USB_AIPTEK
 	tristate "Aiptek 6000U/8000U and Genius G_PEN tablet support (USB)"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the USB version of the Aiptek 6000U,
 	  Aiptek 8000U or Genius G-PEN 560 tablet.  Make sure to say Y to
@@ -51,8 +49,7 @@ config TABLET_USB_GTCO
 
 config TABLET_USB_HANWANG
 	tristate "Hanwang Art Master III tablet support (USB)"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the USB version of the Hanwang Art
 	  Master III tablet.
@@ -62,8 +59,7 @@ config TABLET_USB_HANWANG
 
 config TABLET_USB_KBTAB
 	tristate "KB Gear JamStudio tablet support (USB)"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the USB version of the KB Gear
 	  JamStudio tablet.  Make sure to say Y to "Mouse support"
@@ -75,8 +71,7 @@ config TABLET_USB_KBTAB
 
 config TABLET_USB_PEGASUS
 	tristate "Pegasus Mobile Notetaker Pen input tablet support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the Pegasus Mobile Notetaker,
 	  also known as:
-- 
2.15.1

^ permalink raw reply related

* [PATCH] input: mouse: make USB drivers depend on USB
From: Marcus Folkesson @ 2018-01-17 21:35 UTC (permalink / raw)
  To: Dmitry Torokhov, Benjamin Tissoires, Marcus Folkesson
  Cc: linux-input, linux-kernel

A driver should not enable an entire subsystem.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/input/mouse/Kconfig | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 89ebb8f39fee..38aed9b0bcb8 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -202,8 +202,7 @@ config MOUSE_SERIAL
 
 config MOUSE_APPLETOUCH
 	tristate "Apple USB Touchpad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use an Apple USB Touchpad.
 
@@ -223,8 +222,7 @@ config MOUSE_APPLETOUCH
 
 config MOUSE_BCM5974
 	tristate "Apple USB BCM5974 Multitouch trackpad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you have an Apple USB BCM5974 Multitouch
 	  trackpad.
@@ -418,8 +416,7 @@ config MOUSE_SYNAPTICS_I2C
 
 config MOUSE_SYNAPTICS_USB
 	tristate "Synaptics USB device support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use a Synaptics USB touchpad or pointing
 	  stick.
-- 
2.15.1

^ permalink raw reply related

* [PATCH] input: misc: make USB drivers depend on USB
From: Marcus Folkesson @ 2018-01-17 21:33 UTC (permalink / raw)
  To: Dmitry Torokhov, Sebastian Reichel, Rob Herring, Linus Walleij,
	Damien Riegel, Marcus Folkesson, Joseph Chen
  Cc: linux-input, linux-kernel

A driver should not enable an entire subsystem.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/input/misc/Kconfig | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 9f082a388388..dd04da910bc9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -354,8 +354,7 @@ config INPUT_ATLAS_BTNS
 
 config INPUT_ATI_REMOTE2
 	tristate "ATI / Philips USB RF remote control"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use an ATI or Philips USB RF remote control.
 	  These are RF remotes with USB receivers.
@@ -369,8 +368,7 @@ config INPUT_ATI_REMOTE2
 
 config INPUT_KEYSPAN_REMOTE
 	tristate "Keyspan DMR USB remote control"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use a Keyspan DMR USB remote control.
 	  Currently only the UIA-11 type of receiver has been tested.  The tag
@@ -401,8 +399,7 @@ config INPUT_KXTJ9_POLLED_MODE
 
 config INPUT_POWERMATE
 	tristate "Griffin PowerMate and Contour Jog support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use Griffin PowerMate or Contour Jog devices.
 	  These are aluminum dials which can measure clockwise and anticlockwise
@@ -417,8 +414,7 @@ config INPUT_POWERMATE
 
 config INPUT_YEALINK
 	tristate "Yealink usb-p1k voip phone"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to enable keyboard and LCD functions of the
 	  Yealink usb-p1k usb phones. The audio part is enabled by the generic
@@ -432,8 +428,7 @@ config INPUT_YEALINK
 
 config INPUT_CM109
 	tristate "C-Media CM109 USB I/O Controller"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to enable keyboard and buzzer functions of the
 	  C-Media CM109 usb phones. The audio part is enabled by the generic
-- 
2.15.1


^ permalink raw reply related

* [PATCH] input: joystick: make USB drivers depend on USB
From: Marcus Folkesson @ 2018-01-17 21:30 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson, Tomohiro Yoshidomi,
	David Herrmann
  Cc: linux-input, linux-kernel

A driver should not enable an entire subsystem.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/input/joystick/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index 332c0cc1b2ab..4a199cff8c68 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
 	tristate "X-Box gamepad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the X-Box pad with your computer.
 	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
-- 
2.15.1

^ permalink raw reply related

* Re: [PATCH v4] input: pxrc: new driver for PhoenixRC Flight Controller Adapter
From: Randy Dunlap @ 2018-01-17 20:12 UTC (permalink / raw)
  To: Marcus Folkesson
  Cc: Dmitry Torokhov, Jonathan Corbet, Tomohiro Yoshidomi,
	David Herrmann, Philippe Ombredanne, Kate Stewart,
	Greg Kroah-Hartman, linux-input, linux-doc, linux-kernel
In-Reply-To: <20180117194516.GC10949@gmail.com>

On 01/17/2018 11:45 AM, Marcus Folkesson wrote:
> Hi Randy!
> 
> On Wed, Jan 17, 2018 at 11:13:43AM -0800, Randy Dunlap wrote:
>> On 01/17/2018 11:07 AM, Marcus Folkesson wrote:
>>> This driver let you plug in your RC controller to the adapter and
>>> use it as input device in various RC simulators.
>>>
>>> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>>> ---
>>
>>> diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
>>> index f3c2f6ea8b44..18ab6dafff41 100644
>>> --- a/drivers/input/joystick/Kconfig
>>> +++ b/drivers/input/joystick/Kconfig
>>> @@ -351,4 +351,13 @@ config JOYSTICK_PSXPAD_SPI_FF
>>>  
>>>  	  To drive rumble motor a dedicated power supply is required.
>>>  
>>> +config JOYSTICK_PXRC
>>> +	tristate "PhoenixRC Flight Controller Adapter"
>>> +	depends on USB_ARCH_HAS_HCD
>>> +	select USB
>>
>> Drop the (first) depends and change "select USB" to "depends on USB".
>>
>> Argh, there are lots of input/ drivers that do that.  That's bad/wrong.
>> A driver should not select (enable) an entire subsystem.  If the user had
>> the subsystem disabled, it should stay that way.
>>
>> Dmitry, you can expect some patches...
>>
> 
> Hah, of course it should be "depends on" :-)
> Other drivers fooled me...
> 
> Should I fix the other drivers too when I'm on it, or do you?

Either way.  If you are up for it, please go ahead.

thanks,
-- 
~Randy

^ permalink raw reply

* [PATCH] HID: quirks: Fix keyboard + touchpad on Toshiba Click Mini not working
From: Hans de Goede @ 2018-01-17 20:05 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: Hans de Goede, linux-input, stable

The Toshiba Click Mini uses an i2c attached keyboard/touchpad combo
(single i2c_hid device for both) which has a vid:pid of 04F3:0401,
which is also used by a bunch of Elan touchpads which are handled by the
drivers/input/mouse/elan_i2c driver, but that driver deals with pure
touchpads and does not work for a combo device such as the one on the
Toshiba Click Mini.

The combo on the Mini has an ACPI id of ELAN0800, which is not claimed
by the elan_i2c driver, so check for that and if it is found do not ignore
the device. This fixes the keyboard/touchpad combo on the Mini not working
(although with the touchpad in mouse emulation mode).

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-quirks.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 1cf1e9a0d699..ed4b30bbdde3 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -729,7 +729,6 @@ static const struct hid_device_id hid_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) },
 	{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0400) },
-	{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0401) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) },
@@ -997,6 +996,17 @@ bool hid_ignore(struct hid_device *hdev)
 		    strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0)
 			return true;
 		break;
+	case USB_VENDOR_ID_ELAN:
+		/*
+		 * Many Elan devices have a product id of 0x0401 and are handled
+		 * by the elan_i2c input driver. But the ACPI HID ELAN0800 dev
+		 * is not (and cannot be) handled by that driver ->
+		 * Ignore all 0x0401 devs except for the ELAN0800 dev.
+		 */
+		if (hdev->product == 0x0401 &&
+		    strncmp(hdev->name, "ELAN0800", 8) != 0)
+			return true;
+		break;
 	}
 
 	if (hdev->type == HID_TYPE_USBMOUSE &&
-- 
2.14.3


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox