linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] Input: edt-ft5x06 - use per-client debugfs directory
@ 2025-03-18  9:17 Wolfram Sang
  2025-05-01  3:13 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2025-03-18  9:17 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Dmitry Torokhov, Jonathan Corbet, linux-input,
	linux-doc

The I2C core now provides a debugfs entry for each client. Let this
driver use it instead of the custom directory in debugfs root. Further
improvements by this change: support of multiple instances.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only, by me and buildbots. Trying to cleanup the debugfs a
little. But not sure if this is too complicated for users. Opinions?

 Documentation/input/devices/edt-ft5x06.rst | 21 +++++++++++++++++++--
 drivers/input/touchscreen/edt-ft5x06.c     | 20 ++++++++------------
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/Documentation/input/devices/edt-ft5x06.rst b/Documentation/input/devices/edt-ft5x06.rst
index 1ccc94b192b7..e410d73d4841 100644
--- a/Documentation/input/devices/edt-ft5x06.rst
+++ b/Documentation/input/devices/edt-ft5x06.rst
@@ -29,8 +29,25 @@ The driver allows configuration of the touch screen via a set of sysfs files:
 
 
 For debugging purposes the driver provides a few files in the debug
-filesystem (if available in the kernel). In /sys/kernel/debug/edt_ft5x06
-you'll find the following files:
+filesystem (if available in the kernel). They are located in:
+
+    /sys/kernel/debug/i2c/<i2c-bus>/<i2c-device>/
+
+If you don't know the bus and device numbers, you can look them up with this
+command:
+
+    $ ls -l /sys/bus/i2c/drivers/edt_ft5x06
+
+The dereference of the symlink will contain the needed information. You will
+need the last two elements of its path:
+
+    0-0038 -> ../../../../devices/platform/soc/fcfee800.i2c/i2c-0/0-0038
+
+So in this case, the location for the debug files is:
+
+    /sys/kernel/debug/i2c/i2c-0/0-0038/
+
+There, you'll find the following files:
 
 num_x, num_y:
     (readonly) contains the number of sensor fields in X- and
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 0d7bf18e2508..abc5bbb5c8c9 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -120,7 +120,6 @@ struct edt_ft5x06_ts_data {
 	struct regmap *regmap;
 
 #if defined(CONFIG_DEBUG_FS)
-	struct dentry *debug_dir;
 	u8 *raw_buffer;
 	size_t raw_bufsize;
 #endif
@@ -815,23 +814,21 @@ static const struct file_operations debugfs_raw_data_fops = {
 	.read = edt_ft5x06_debugfs_raw_data_read,
 };
 
-static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
-					  const char *debugfs_name)
+static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata)
 {
-	tsdata->debug_dir = debugfs_create_dir(debugfs_name, NULL);
+	struct dentry *debug_dir = tsdata->client->debugfs;
 
-	debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x);
-	debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y);
+	debugfs_create_u16("num_x", S_IRUSR, debug_dir, &tsdata->num_x);
+	debugfs_create_u16("num_y", S_IRUSR, debug_dir, &tsdata->num_y);
 
 	debugfs_create_file("mode", S_IRUSR | S_IWUSR,
-			    tsdata->debug_dir, tsdata, &debugfs_mode_fops);
+			    debug_dir, tsdata, &debugfs_mode_fops);
 	debugfs_create_file("raw_data", S_IRUSR,
-			    tsdata->debug_dir, tsdata, &debugfs_raw_data_fops);
+			    debug_dir, tsdata, &debugfs_raw_data_fops);
 }
 
 static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
 {
-	debugfs_remove_recursive(tsdata->debug_dir);
 	kfree(tsdata->raw_buffer);
 }
 
@@ -842,8 +839,7 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
 	return -ENOSYS;
 }
 
-static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata,
-					  const char *debugfs_name)
+static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata)
 {
 }
 
@@ -1349,7 +1345,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client)
 	if (error)
 		return error;
 
-	edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
+	edt_ft5x06_ts_prepare_debugfs(tsdata);
 
 	dev_dbg(&client->dev,
 		"EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] Input: edt-ft5x06 - use per-client debugfs directory
  2025-03-18  9:17 [RFC PATCH] Input: edt-ft5x06 - use per-client debugfs directory Wolfram Sang
@ 2025-05-01  3:13 ` Dmitry Torokhov
  2025-05-01  5:48   ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2025-05-01  3:13 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-renesas-soc, Jonathan Corbet, linux-input, linux-doc

Hi Wolfram,

On Tue, Mar 18, 2025 at 10:17:41AM +0100, Wolfram Sang wrote:
> The I2C core now provides a debugfs entry for each client. Let this
> driver use it instead of the custom directory in debugfs root. Further
> improvements by this change: support of multiple instances.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Build tested only, by me and buildbots. Trying to cleanup the debugfs a
> little. But not sure if this is too complicated for users. Opinions?

This looks nice and nobody is yelling. Any reason why I shouldn't simply
apply it?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] Input: edt-ft5x06 - use per-client debugfs directory
  2025-05-01  3:13 ` Dmitry Torokhov
@ 2025-05-01  5:48   ` Wolfram Sang
  2025-07-01 18:43     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2025-05-01  5:48 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-renesas-soc, Jonathan Corbet, linux-input, linux-doc

[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]

On Wed, Apr 30, 2025 at 08:13:08PM -0700, Dmitry Torokhov wrote:
> Hi Wolfram,
> 
> On Tue, Mar 18, 2025 at 10:17:41AM +0100, Wolfram Sang wrote:
> > The I2C core now provides a debugfs entry for each client. Let this
> > driver use it instead of the custom directory in debugfs root. Further
> > improvements by this change: support of multiple instances.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > ---
> > 
> > Build tested only, by me and buildbots. Trying to cleanup the debugfs a
> > little. But not sure if this is too complicated for users. Opinions?
> 
> This looks nice and nobody is yelling. Any reason why I shouldn't simply
> apply it?

Not really. I marked this as RFC because the path changed from

/sys/kernel/debug/edt_ft5x06

to

/sys/kernel/debug/i2c/<i2c-bus>/<i2c-device>/

so people have to deal with bus and device numbers now. I usually think
debugfs is mostly for developers, so they can handle that. I wasn't so
sure with this driver for some reason...


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] Input: edt-ft5x06 - use per-client debugfs directory
  2025-05-01  5:48   ` Wolfram Sang
@ 2025-07-01 18:43     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2025-07-01 18:43 UTC (permalink / raw)
  To: Wolfram Sang, linux-renesas-soc, Jonathan Corbet, linux-input,
	linux-doc

On Thu, May 01, 2025 at 07:48:48AM +0200, Wolfram Sang wrote:
> On Wed, Apr 30, 2025 at 08:13:08PM -0700, Dmitry Torokhov wrote:
> > Hi Wolfram,
> > 
> > On Tue, Mar 18, 2025 at 10:17:41AM +0100, Wolfram Sang wrote:
> > > The I2C core now provides a debugfs entry for each client. Let this
> > > driver use it instead of the custom directory in debugfs root. Further
> > > improvements by this change: support of multiple instances.
> > > 
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > ---
> > > 
> > > Build tested only, by me and buildbots. Trying to cleanup the debugfs a
> > > little. But not sure if this is too complicated for users. Opinions?
> > 
> > This looks nice and nobody is yelling. Any reason why I shouldn't simply
> > apply it?
> 
> Not really. I marked this as RFC because the path changed from
> 
> /sys/kernel/debug/edt_ft5x06
> 
> to
> 
> /sys/kernel/debug/i2c/<i2c-bus>/<i2c-device>/
> 
> so people have to deal with bus and device numbers now. I usually think
> debugfs is mostly for developers, so they can handle that. I wasn't so
> sure with this driver for some reason...

Sorry for the delay. Nobody raised any objections so I applied this.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-01 18:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18  9:17 [RFC PATCH] Input: edt-ft5x06 - use per-client debugfs directory Wolfram Sang
2025-05-01  3:13 ` Dmitry Torokhov
2025-05-01  5:48   ` Wolfram Sang
2025-07-01 18:43     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).