linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: "Johan Hovold" <johan@kernel.org>,
	"Frédéric Danis" <frederic.danis.oss@gmail.com>,
	robh@kernel.org, sre@kernel.org, loic.poulain@gmail.com,
	lukas@wunner.de, hdegoede@redhat.com,
	linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH 1/2] serdev: Add ACPI support
Date: Tue, 10 Oct 2017 10:15:28 +0200	[thread overview]
Message-ID: <20171010081528.GJ4269@localhost> (raw)
In-Reply-To: <BC1C29B8-C76B-499D-B8BE-365B5D3A0065@holtmann.org>

On Tue, Oct 10, 2017 at 10:10:58AM +0200, Marcel Holtmann wrote:
> Hi Johan,
> 
> >> This patch allows SerDev module to manage serial devices declared as
> >> attached to an UART in ACPI table.
> >> 
> >> acpi_serdev_add_device() callback will only take into account entries
> >> without enumerated flag set. This flags is set for all entries during
> >> ACPI scan, except for SPI and I2C serial devices, and for UART with
> >> 2nd patch in the series.
> >> 
> >> Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com>
> >> ---
> >> drivers/tty/serdev/core.c | 99 ++++++++++++++++++++++++++++++++++++++++++++---
> >> 1 file changed, 94 insertions(+), 5 deletions(-)
> >> 
> >> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> >> index c68fb3a..104777d 100644
> >> --- a/drivers/tty/serdev/core.c
> >> +++ b/drivers/tty/serdev/core.c

> >> +static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
> >> +{
> >> +	acpi_status status;
> >> +	acpi_handle handle;
> >> +
> >> +	handle = ACPI_HANDLE(ctrl->dev.parent);
> >> +	if (!handle)
> >> +		return -ENODEV;
> >> +
> >> +	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
> >> +				     acpi_serdev_add_device, NULL, ctrl, NULL);
> >> +	if (ACPI_FAILURE(status)) {
> >> +		dev_warn(&ctrl->dev, "failed to enumerate Serial slaves\n");
> > 
> > s/Serial/serdev/
> > 
> >> +		return -ENODEV;
> >> +	}
> >> +
> >> +	return 0;
> > 
> > What if there are no slaves defined? I'm not very familiar with the ACPI
> > helpers, but from a quick look it seems you'd then end up returning zero
> > here which would cause the serdev controller to be registered instead of
> > the tty-class device.
> > 
> > [ And if I'm mistaken, you do want to suppress that error message for
> > when there are no slaves defined. ]

> >> -	ret = of_serdev_register_devices(ctrl);
> >> -	if (ret)
> >> +	ret_of = of_serdev_register_devices(ctrl);
> >> +	ret_acpi = acpi_serdev_register_devices(ctrl);
> >> +	if (ret_of && ret_acpi) {
> >> +		dev_dbg(&ctrl->dev, "serdev%d no devices registered: of:%d acpi:%d\n",
> > 
> > "serdev%d" is redundant here as you're using dev_dbg (which will print
> > the device name).
> > 
> >> +			ctrl->nr, ret_of, ret_acpi);
> >> +		ret = -ENODEV;
> >> 		goto out_dev_del;
> >> +	}
> >> 
> >> 	dev_dbg(&ctrl->dev, "serdev%d registered: dev:%p\n",
> >> 		ctrl->nr, &ctrl->dev);
> > 
> > Hmm, I see it's already used here. No need to follow that example
> > though.
> 
> lets have an extra patch on top of it that fixes these.

Some of the above are minor nits that can be addressed by a follow-up
patch indeed, but the handling of nodes with no child devices needs to
be correct (or you could end up breaking normal serial-port support).

Johan

  reply	other threads:[~2017-10-10  8:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04  8:51 [PATCH 0/2] ACPI serdev support Frédéric Danis
2017-10-04  8:51 ` [PATCH 2/2] ACPI / scan: Fix enumeration for special UART devices Frédéric Danis
2017-10-07 11:36   ` Sebastian Reichel
     [not found]   ` <1507107090-15992-3-git-send-email-frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-07 15:19     ` Johan Hovold
2017-10-07 22:53       ` Sebastian Reichel
2017-10-08  8:51         ` Marcel Holtmann
2017-10-09  8:59           ` Sebastian Reichel
2017-10-09  7:35         ` Johan Hovold
2017-10-09  8:55           ` Sebastian Reichel
2017-10-09  9:08             ` Johan Hovold
2017-10-09 18:09               ` Marcel Holtmann
     [not found]                 ` <E19C0643-85AA-4E80-BCDC-0C01EC0F88C2-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-10-10  7:08                   ` Johan Hovold
2017-10-05 15:21 ` [PATCH 0/2] ACPI serdev support Marcel Holtmann
2017-10-06  7:33   ` Ian W MORRISON
     [not found]     ` <25008d7b-db06-49ad-033f-63c0b72d9c34-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-06  8:16       ` Frédéric Danis
     [not found]         ` <CAFXWsS9uhvB=5r83GC=aA=uujDvxfjnOvEUUviymNEM31fka5Q@mail.gmail.com>
2017-10-06 17:36           ` Frédéric Danis
2017-10-07 15:14             ` Johan Hovold
     [not found] ` <1507107090-15992-1-git-send-email-frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-04  8:51   ` [PATCH 1/2] serdev: Add ACPI support Frédéric Danis
2017-10-06 12:33     ` Rob Herring
     [not found]       ` <CAL_JsqKDzR9-ptE=SbL0LuQvTKDNT-GZ8buOvffJDyWz6fHfSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-06 18:32         ` Marcel Holtmann
2017-10-07  0:03           ` Rafael J. Wysocki
     [not found]             ` <CAJZ5v0gLhnisMn9o00ndnB6fjHt5V7KCy_57UScF=ZfZVF=dxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-07  0:31               ` Marcel Holtmann
     [not found]                 ` <E5446B94-9914-44B5-A734-050F7457746D-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2017-10-07  6:42                   ` Greg Kroah-Hartman
     [not found]     ` <1507107090-15992-2-git-send-email-frederic.danis.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-07  6:42       ` Greg KH
2017-10-07 11:35       ` Sebastian Reichel
2017-10-07 15:12     ` Johan Hovold
2017-10-10  8:10       ` Marcel Holtmann
2017-10-10  8:15         ` Johan Hovold [this message]
2017-10-10  8:22           ` Marcel Holtmann
2017-10-10 16:36             ` Johan Hovold
2017-10-10 23:13               ` Ian W MORRISON
2017-10-10  0:27   ` [PATCH 0/2] ACPI serdev support Rafael J. Wysocki

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=20171010081528.GJ4269@localhost \
    --to=johan@kernel.org \
    --cc=frederic.danis.oss@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=loic.poulain@gmail.com \
    --cc=lukas@wunner.de \
    --cc=marcel@holtmann.org \
    --cc=robh@kernel.org \
    --cc=sre@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 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).