From: Johan Hovold <johan@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] USB: serial: ftdi_sio: clean up attribute visibility logic
Date: Mon, 19 Sep 2022 15:24:54 +0200 [thread overview]
Message-ID: <20220919132456.20851-2-johan@kernel.org> (raw)
In-Reply-To: <20220919132456.20851-1-johan@kernel.org>
Clean up the attribute visibility logic by defaulting to attributes
being visible and explicitly listing the exceptions.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 147b5e80595a..a5fc199cde0b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1775,19 +1775,18 @@ static umode_t ftdi_is_visible(struct kobject *kobj, struct attribute *attr, int
struct usb_serial_port *port = to_usb_serial_port(dev);
struct ftdi_private *priv = usb_get_serial_port_data(port);
enum ftdi_chip_type type = priv->chip_type;
- umode_t mode = attr->mode;
- if (type != SIO) {
- if (attr == &dev_attr_event_char.attr)
- return mode;
+ if (attr == &dev_attr_event_char.attr) {
+ if (type == SIO)
+ return 0;
}
- if (type != SIO && type != FT232A) {
- if (attr == &dev_attr_latency_timer.attr)
- return mode;
+ if (attr == &dev_attr_latency_timer.attr) {
+ if (type == SIO || type == FT232A)
+ return 0;
}
- return 0;
+ return attr->mode;
}
static const struct attribute_group ftdi_group = {
--
2.35.1
next prev parent reply other threads:[~2022-09-19 13:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 13:24 [PATCH 0/3] USB: serial: ftdi_sio: misc clean ups Johan Hovold
2022-09-19 13:24 ` Johan Hovold [this message]
2022-09-19 13:24 ` [PATCH 2/3] USB: serial: ftdi_sio: move driver structure Johan Hovold
2022-09-19 13:24 ` [PATCH 3/3] USB: serial: ftdi_sio: clean up driver prefix Johan Hovold
2022-09-20 7:29 ` [PATCH 0/3] USB: serial: ftdi_sio: misc clean ups Greg KH
2022-09-20 7:47 ` Johan Hovold
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=20220919132456.20851-2-johan@kernel.org \
--to=johan@kernel.org \
--cc=jiasheng@iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.