Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 2019 17:05:05 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349174 - head/sys/dev/pwm
Message-ID:  <201906181705.x5IH55eE064714@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Tue Jun 18 17:05:05 2019
New Revision: 349174
URL: https://svnweb.freebsd.org/changeset/base/349174

Log:
  Handle labels specified with hints even on FDT systems.  Hints are the
  easiest thing for a user to control (via loader.conf or kenv+kldload), so
  handle them in addition to any label specified via the FDT data.

Modified:
  head/sys/dev/pwm/pwmc.c

Modified: head/sys/dev/pwm/pwmc.c
==============================================================================
--- head/sys/dev/pwm/pwmc.c	Tue Jun 18 16:31:05 2019	(r349173)
+++ head/sys/dev/pwm/pwmc.c	Tue Jun 18 17:05:05 2019	(r349174)
@@ -108,33 +108,24 @@ static struct cdevsw pwm_cdevsw = {
 	.d_ioctl	= pwm_ioctl
 };
 
-#ifdef FDT
-
 static void
 pwmc_setup_label(struct pwmc_softc *sc)
 {
+	const char *hintlabel;
+#ifdef FDT
 	void *label;
 
 	if (OF_getprop_alloc(ofw_bus_get_node(sc->dev), "label", &label) > 0) {
 		make_dev_alias(sc->cdev, "pwm/%s", (char *)label);
 		OF_prop_free(label);
 	}
-}
+#endif
 
-#else /* FDT */
-
-static void
-pwmc_setup_label(struct pwmc_softc *sc)
-{
-	const char *label;
-
 	if (resource_string_value(device_get_name(sc->dev),
-	    device_get_unit(sc->dev), "label", &label) == 0) {
-		make_dev_alias(sc->cdev, "pwm/%s", label);
+	    device_get_unit(sc->dev), "label", &hintlabel) == 0) {
+		make_dev_alias(sc->cdev, "pwm/%s", hintlabel);
 	}
 }
-
-#endif /* FDT */
 
 static int
 pwmc_probe(device_t dev)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906181705.x5IH55eE064714>