U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Cc: Tom Rini <trini@konsulko.com>,
	 Doug Zobel <douglas.zobel@climate.com>,
	Marek Vasut <marex@denx.de>,
	 Christian Gmeiner <christian.gmeiner@gmail.com>,
	 Christian Marangi <ansuelsmth@gmail.com>,
	Simon Glass <sjg@chromium.org>,
	 u-boot@lists.denx.de,
	 Michael Polyntsov <michael.polyntsov@iopsys.eu>
Subject: Re: [PATCH 1/2] led: Implement software led blinking
Date: Wed, 03 Jul 2024 13:27:33 +0200	[thread overview]
Message-ID: <87r0capvfe.fsf@prevas.dk> (raw)
In-Reply-To: <20240703010131.1735100-2-mikhail.kshevetskiy@iopsys.eu> (Mikhail Kshevetskiy's message of "Wed, 3 Jul 2024 05:01:30 +0400")

Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> writes:

> +
> +static int led_sw_set_period(struct udevice *dev, int period_ms)
> +{
> +	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
> +	struct cyclic_info *cyclic = uc_plat->cyclic;
> +	struct led_ops *ops = led_get_ops(dev);
> +	char cyclic_name[64];
> +	int half_period_us;
> +
> +	uc_plat->sw_blink_state = LED_SW_BLINK_ST_NONE;
> +	ops->set_state(dev, LEDST_OFF);
> +
> +	half_period_us = period_ms * 1000 / 2;
> +
> +	if (cyclic) {
> +		cyclic->delay_us = half_period_us;
> +		cyclic->start_time_us = timer_get_us();
> +	} else {
> +		snprintf(cyclic_name, sizeof(cyclic_name),
> +			 "led_sw_blink_%s", uc_plat->label);
> +
> +		cyclic = cyclic_register(led_sw_blink, half_period_us,
> +					 cyclic_name, dev);
> +		if (!cyclic) {
> +			log_err("Registering of blinking function for %s failed\n",
> +				uc_plat->label);
> +			return -ENOMEM;
> +		}
> +
> +		uc_plat->cyclic = cyclic;
> +	}

You need to be aware of the API change that is by now in master, see
https://lore.kernel.org/u-boot/20240521084652.1726460-1-rasmus.villemoes@prevas.dk/
and in particular commits 3a11eada38e and 008c4b3c3115. The latter
you'll find soon enough because this won't build.

The former is a bit more subtle and would silently break here (as
passing an auto array is no longer allowed) - consider whether you
really need the led_sw_blink_ to be part of the name, or if
uc_plat->label itself isn't descriptive enough.

Rasmus

  parent reply	other threads:[~2024-07-03 13:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 11:31 [PATCH 1/2] led: Implement software led blinking Mikhail Kshevetskiy
2024-06-27 11:31 ` [PATCH 2/2] led: Add dts property to specify blinking of the led Mikhail Kshevetskiy
2024-06-27 19:05 ` [PATCH 1/2] led: Implement software led blinking Simon Glass
2024-07-02 11:54   ` Mikhail Kshevetskiy
2024-07-02 15:51     ` Simon Glass
2024-07-03  1:01       ` led blinking patches Mikhail Kshevetskiy
2024-07-03  1:01         ` [PATCH 1/2] led: Implement software led blinking Mikhail Kshevetskiy
2024-07-03  8:08           ` Simon Glass
2024-07-03 11:27           ` Rasmus Villemoes [this message]
2024-07-03  1:01         ` [PATCH 2/2] led: Add dts property to specify blinking of the led Mikhail Kshevetskiy
2024-07-03  8:08           ` Simon Glass
2024-07-05  2:20             ` Mikhail Kshevetskiy
2024-06-27 19:36 ` [PATCH 1/2] led: Implement software led blinking Tom Rini
2024-06-27 20:29   ` Christian Marangi
  -- strict thread matches above, loose matches on Subject: below --
2024-07-05  2:26 Mikhail Kshevetskiy
2024-07-05  8:29 ` Mark Kettenis
2024-07-05  9:24   ` Mikhail Kshevetskiy

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=87r0capvfe.fsf@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=ansuelsmth@gmail.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=douglas.zobel@climate.com \
    --cc=marex@denx.de \
    --cc=michael.polyntsov@iopsys.eu \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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