All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Loys Ollivier <lollivier@baylibre.com>
Cc: Johan Hovold <johan@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Colin Ian King <colin.king@canonical.com>,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RESEND PATCH] gnss: get serial speed from subdrivers
Date: Wed, 8 May 2019 17:53:41 +0200	[thread overview]
Message-ID: <20190508155341.GA1605@Red> (raw)
In-Reply-To: <1557322788-10403-1-git-send-email-lollivier@baylibre.com>

On Wed, May 08, 2019 at 03:39:48PM +0200, Loys Ollivier wrote:
> The default serial speed was hardcoded in the code.
> Rename current-speed to default-speed.
> Add a function parameter that lets the subdrivers specify their
> default speed.
> If not specified fallback to the device-tree default-speed.
> 
> Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
> ---
> Hello,
> 
> This patch moves the currently hardcoded, default serial speed
> to the subdrivers.
> If the default speed is not specified by the subdriver then it is read
> from the device tree.
> 
> Cheers,
> Loys
> 
>  drivers/gnss/mtk.c    |  6 +++++-
>  drivers/gnss/serial.c | 21 +++++++++++++--------
>  drivers/gnss/serial.h |  3 ++-
>  drivers/gnss/ubx.c    |  3 ++-
>  4 files changed, 22 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gnss/mtk.c b/drivers/gnss/mtk.c
> index d1fc55560daf..a1a89f0cc75c 100644
> --- a/drivers/gnss/mtk.c
> +++ b/drivers/gnss/mtk.c
> @@ -16,6 +16,10 @@
>  
>  #include "serial.h"
>  
> +static uint serial_speed = 9600; /* Serial speed (baud rate) */
> +module_param(serial_speed, uint, 0644);
> +MODULE_PARM_DESC(serial_speed, "Serial baud rate (bit/s), (default = 9600)");
> +
>  struct mtk_data {
>  	struct regulator *vbackup;
>  	struct regulator *vcc;
> @@ -69,7 +73,7 @@ static int mtk_probe(struct serdev_device *serdev)
>  	struct mtk_data *data;
>  	int ret;
>  
> -	gserial = gnss_serial_allocate(serdev, sizeof(*data));
> +	gserial = gnss_serial_allocate(serdev, sizeof(*data), serial_speed);
>  	if (IS_ERR(gserial)) {
>  		ret = PTR_ERR(gserial);
>  		return ret;
> diff --git a/drivers/gnss/serial.c b/drivers/gnss/serial.c
> index def64b36d994..706fc5b46811 100644
> --- a/drivers/gnss/serial.c
> +++ b/drivers/gnss/serial.c
> @@ -103,17 +103,13 @@ static int gnss_serial_set_power(struct gnss_serial *gserial,
>  	return gserial->ops->set_power(gserial, state);
>  }
>  
> -/*
> - * FIXME: need to provide subdriver defaults or separate dt parsing from
> - * allocation.
> - */
>  static int gnss_serial_parse_dt(struct serdev_device *serdev)
>  {
>  	struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
>  	struct device_node *node = serdev->dev.of_node;
> -	u32 speed = 4800;
> +	uint speed;
>  
> -	of_property_read_u32(node, "current-speed", &speed);
> +	of_property_read_u32(node, "default-speed", &speed);

Hello

of_property_read_u32 use u32, so no reason to use uint instead.

Regards

WARNING: multiple messages have this Message-ID (diff)
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Loys Ollivier <lollivier@baylibre.com>
Cc: Johan Hovold <johan@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Colin Ian King <colin.king@canonical.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RESEND PATCH] gnss: get serial speed from subdrivers
Date: Wed, 8 May 2019 17:53:41 +0200	[thread overview]
Message-ID: <20190508155341.GA1605@Red> (raw)
In-Reply-To: <1557322788-10403-1-git-send-email-lollivier@baylibre.com>

On Wed, May 08, 2019 at 03:39:48PM +0200, Loys Ollivier wrote:
> The default serial speed was hardcoded in the code.
> Rename current-speed to default-speed.
> Add a function parameter that lets the subdrivers specify their
> default speed.
> If not specified fallback to the device-tree default-speed.
> 
> Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
> ---
> Hello,
> 
> This patch moves the currently hardcoded, default serial speed
> to the subdrivers.
> If the default speed is not specified by the subdriver then it is read
> from the device tree.
> 
> Cheers,
> Loys
> 
>  drivers/gnss/mtk.c    |  6 +++++-
>  drivers/gnss/serial.c | 21 +++++++++++++--------
>  drivers/gnss/serial.h |  3 ++-
>  drivers/gnss/ubx.c    |  3 ++-
>  4 files changed, 22 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gnss/mtk.c b/drivers/gnss/mtk.c
> index d1fc55560daf..a1a89f0cc75c 100644
> --- a/drivers/gnss/mtk.c
> +++ b/drivers/gnss/mtk.c
> @@ -16,6 +16,10 @@
>  
>  #include "serial.h"
>  
> +static uint serial_speed = 9600; /* Serial speed (baud rate) */
> +module_param(serial_speed, uint, 0644);
> +MODULE_PARM_DESC(serial_speed, "Serial baud rate (bit/s), (default = 9600)");
> +
>  struct mtk_data {
>  	struct regulator *vbackup;
>  	struct regulator *vcc;
> @@ -69,7 +73,7 @@ static int mtk_probe(struct serdev_device *serdev)
>  	struct mtk_data *data;
>  	int ret;
>  
> -	gserial = gnss_serial_allocate(serdev, sizeof(*data));
> +	gserial = gnss_serial_allocate(serdev, sizeof(*data), serial_speed);
>  	if (IS_ERR(gserial)) {
>  		ret = PTR_ERR(gserial);
>  		return ret;
> diff --git a/drivers/gnss/serial.c b/drivers/gnss/serial.c
> index def64b36d994..706fc5b46811 100644
> --- a/drivers/gnss/serial.c
> +++ b/drivers/gnss/serial.c
> @@ -103,17 +103,13 @@ static int gnss_serial_set_power(struct gnss_serial *gserial,
>  	return gserial->ops->set_power(gserial, state);
>  }
>  
> -/*
> - * FIXME: need to provide subdriver defaults or separate dt parsing from
> - * allocation.
> - */
>  static int gnss_serial_parse_dt(struct serdev_device *serdev)
>  {
>  	struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
>  	struct device_node *node = serdev->dev.of_node;
> -	u32 speed = 4800;
> +	uint speed;
>  
> -	of_property_read_u32(node, "current-speed", &speed);
> +	of_property_read_u32(node, "default-speed", &speed);

Hello

of_property_read_u32 use u32, so no reason to use uint instead.

Regards


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-05-08 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 13:39 [RESEND PATCH] gnss: get serial speed from subdrivers Loys Ollivier
2019-05-08 13:39 ` Loys Ollivier
2019-05-08 15:53 ` Corentin Labbe [this message]
2019-05-08 15:53   ` Corentin Labbe
2019-05-16 16:39   ` Loys Ollivier
2019-05-16 16:39     ` Loys Ollivier

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=20190508155341.GA1605@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=johan@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lollivier@baylibre.com \
    --cc=matthias.bgg@gmail.com \
    /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.