svn commit: r349174 - head/sys/dev/pwm

Ian Lepore ian at FreeBSD.org
Tue Jun 18 17:05:06 UTC 2019


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)


More information about the svn-src-head mailing list