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:
parent
05918954d8
commit
edd96b9fb9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349174
@ -108,34 +108,25 @@ static struct cdevsw pwm_cdevsw = {
|
|||||||
.d_ioctl = pwm_ioctl
|
.d_ioctl = pwm_ioctl
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef FDT
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pwmc_setup_label(struct pwmc_softc *sc)
|
pwmc_setup_label(struct pwmc_softc *sc)
|
||||||
{
|
{
|
||||||
|
const char *hintlabel;
|
||||||
|
#ifdef FDT
|
||||||
void *label;
|
void *label;
|
||||||
|
|
||||||
if (OF_getprop_alloc(ofw_bus_get_node(sc->dev), "label", &label) > 0) {
|
if (OF_getprop_alloc(ofw_bus_get_node(sc->dev), "label", &label) > 0) {
|
||||||
make_dev_alias(sc->cdev, "pwm/%s", (char *)label);
|
make_dev_alias(sc->cdev, "pwm/%s", (char *)label);
|
||||||
OF_prop_free(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),
|
if (resource_string_value(device_get_name(sc->dev),
|
||||||
device_get_unit(sc->dev), "label", &label) == 0) {
|
device_get_unit(sc->dev), "label", &hintlabel) == 0) {
|
||||||
make_dev_alias(sc->cdev, "pwm/%s", label);
|
make_dev_alias(sc->cdev, "pwm/%s", hintlabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FDT */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pwmc_probe(device_t dev)
|
pwmc_probe(device_t dev)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user