linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: "Michael G. Katzmann" <michaelk@IEEE.org>,
	"Charles Yeh" <charlesyeh522@gmail.com>,
	"Yeh.Charles [葉榮鑫]" <charles-yeh@prolific.com.tw>,
	"Johan Hovold" <johan@kernel.org>
Subject: [PATCH 5/5] USB: serial: pl2303: add device-type names
Date: Thu, 11 Mar 2021 17:14:51 +0100	[thread overview]
Message-ID: <20210311161451.1496-6-johan@kernel.org> (raw)
In-Reply-To: <20210311161451.1496-1-johan@kernel.org>

Add names for the device types to be printed at probe when debugging is
enabled.

Note that the HXN type is referred to as G for now as that is the name
the vendor uses.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/pl2303.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index e742187c8a7f..7208966891d0 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -183,6 +183,7 @@ enum pl2303_type {
 };
 
 struct pl2303_type_data {
+	const char *name;
 	speed_t max_baud_rate;
 	unsigned long quirks;
 	unsigned int no_autoxonxoff:1;
@@ -204,23 +205,29 @@ struct pl2303_private {
 
 static const struct pl2303_type_data pl2303_type_data[TYPE_COUNT] = {
 	[TYPE_H] = {
+		.name			= "H",
 		.max_baud_rate		= 1228800,
 		.quirks			= PL2303_QUIRK_LEGACY,
 		.no_autoxonxoff		= true,
 	},
 	[TYPE_HX] = {
+		.name			= "HX",
 		.max_baud_rate		= 6000000,
 	},
 	[TYPE_TA] = {
+		.name			= "TA",
 		.max_baud_rate		= 6000000,
 	},
 	[TYPE_TB] = {
+		.name			= "TB",
 		.max_baud_rate		= 12000000,
 	},
 	[TYPE_HXD] = {
+		.name			= "HXD",
 		.max_baud_rate		= 12000000,
 	},
 	[TYPE_HXN] = {
+		.name			= "G",
 		.max_baud_rate		= 12000000,
 		.no_divisors		= true,
 	},
@@ -444,7 +451,7 @@ static int pl2303_startup(struct usb_serial *serial)
 		return ret;
 
 	type = ret;
-	dev_dbg(&serial->interface->dev, "device type: %d\n", type);
+	dev_dbg(&serial->interface->dev, "device type: %s\n", pl2303_type_data[type].name);
 
 	spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
 	if (!spriv)
-- 
2.26.2


      parent reply	other threads:[~2021-03-11 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 16:14 [PATCH 0/5] USB: serial: pl2303: amend device-type detection Johan Hovold
2021-03-11 16:14 ` [PATCH 1/5] USB: serial: pl2303: clean up type detection Johan Hovold
2021-03-11 16:14 ` [PATCH 2/5] USB: serial: pl2303: amend and tighten " Johan Hovold
2021-03-11 16:14 ` [PATCH 3/5] USB: serial: pl2303: rename legacy PL2303H type Johan Hovold
2021-03-11 16:14 ` [PATCH 4/5] USB: serial: pl2303: tighten type HXN (G) detection Johan Hovold
2021-03-11 16:14 ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210311161451.1496-6-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=charles-yeh@prolific.com.tw \
    --cc=charlesyeh522@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=michaelk@IEEE.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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).