1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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.
This commit is contained in:
Ian Lepore 2019-06-18 17:05:05 +00:00
parent 05918954d8
commit edd96b9fb9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349174

View File

@ -108,34 +108,25 @@ 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);
}
}
#else /* FDT */
static void
pwmc_setup_label(struct pwmc_softc *sc)
{
const char *label;
#endif
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)
{