> Date: Sat, 5 Aug 2017 13:47:16 +0200
> From: Stefan Sperling <[email protected]>
>
> On Sat, Jun 10, 2017 at 02:23:55PM +0200, Stefan Sperling wrote:
> > On Tue, May 23, 2017 at 07:51:14AM +0200, Cesare Gargano wrote:
> > > Hi,
> > > I made E200HA keyboard and touchpad work configuring node->parent deps.
> > > As Mark says, it's a order problem, we should attach all deps drivers
> > > before
> > > attaching the device driver itself.
> > >
> > > Attached diff and a (old) dmesg.
> > >
> > > -
> > > C.
> >
> > This diff has not caused a problem on any of my machines, and I still
> > have it in my build tree.
> >
> > What happened to it?
>
> Ping. Should this diff be discarded?
Setting node->parent->attached is a bit of an ugly hack. Is tis to
prevent us from entering an infinite loop because the i2c device has a
_DEP pointing back at the i2c controller?
Perhaps the solution here is to set node->parent->attached to 1 before
calling config_found() in acpi.c?
> > > diff --git a/.gitignore b/.gitignore
> > > new file mode 100644
> > > index 00000000000..dbd7620a943
> > > --- /dev/null
> > > +++ b/.gitignore
> > > @@ -0,0 +1,4 @@
> > > +obj/
> > > +~*
> > > +*.o
> > > +*.d
> > > diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
> > > index 09495657aad..092693e192c 100644
> > > --- a/sys/dev/acpi/acpi.c
> > > +++ b/sys/dev/acpi/acpi.c
> > > @@ -2819,7 +2819,7 @@ acpi_attach_deps(struct acpi_softc *sc, struct
> > > aml_node *node)
> > > if (dep == NULL || dep->attached)
> > > continue;
> > > dep = aml_searchname(dep, "_HID");
> > > - if (dep)
> > > + if (dep && dep->parent->attached != 2)
> > > acpi_foundhid(dep, sc);
> > > }
> > >
> > > diff --git a/sys/dev/acpi/dwiic.c b/sys/dev/acpi/dwiic.c
> > > index 60bf8d17a22..302b0051229 100644
> > > --- a/sys/dev/acpi/dwiic.c
> > > +++ b/sys/dev/acpi/dwiic.c
> > > @@ -196,6 +196,8 @@ int dwiic_i2c_exec(void *, i2c_op_t,
> > > i2c_addr_t, const void *,
> > > size_t, void *, size_t, int);
> > > void dwiic_xfer_msg(struct dwiic_softc *);
> > >
> > > +extern void acpi_attach_deps(struct acpi_softc *, struct aml_node
> > > *);
> > > +
> > > struct cfattach dwiic_ca = {
> > > sizeof(struct dwiic_softc),
> > > dwiic_match,
> > > @@ -567,11 +569,15 @@ dwiic_acpi_found_hid(struct aml_node *node, void
> > > *arg)
> > > aml_freevalue(&res);
> > > return (0);
> > > }
> > > +
> > > memset(&crs, 0, sizeof(crs));
> > > crs.devnode = sc->sc_devnode;
> > > aml_parse_resource(&res, dwiic_acpi_parse_crs, &crs);
> > > aml_freevalue(&res);
> > >
> > > + node->parent->attached = 2;
> > > + acpi_attach_deps(acpi_softc, node->parent);
> > > +
> > > if (dwiic_matchhids(cdev, ihidev_hids))
> > > return dwiic_acpi_found_ihidev(sc, node, dev, crs);
> > > else if (dwiic_matchhids(dev, iatp_hids))
> >
> >
>
>