Subject: Re: RICOH something cardbus adapter...
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Ignatios Souvatzis <is@netbsd.org>
List: tech-kern
Date: 02/27/2005 09:43:59
--eJnRUKwClWJh1Khz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

Jonathan Stone wrote:
>=20
> In message <20050226163952.GB22330@beverly.kleinbus.org>,
> Ignatios Souvatzis writes:
>=20
> >
> >I've managed to get it to work by limiting the tsleep() to hz/4, and=3D20
> >incrementing sc->pwrcycle if it was the same. Patch at the end.
>=20
> That worked for me too (though I had to apply it manually; I couldn't
> get your quoted-printable patch into a form patch would accept).
>=20
> But the patch isn't very clean. I can only find one call to
> wakeup(sc->sc_pwrcycle), at the tail of pccbbintr(), inside
> 	if (sockevent & CB_SOCKET_EVENT_POWER) {
>=20
> which always increments sc->sc_pwrcycle. Surely it'd be cleaner, and
> simpler, to remove the
>=20
> 		while (pwrcycle =3D=3D sc->sc_pwrcycle)
>=20
>  loop altogether, and just do:
>=20
> 		microtime(&before);
> 		/*
> 		 * wait for powercycle to complete, but wait no more than  0.25 sec,
> 		 * due to bridges that that don't notify us (on which we'd otherwise
> 		 * wait forever).
> 		 */
> 		tsleep(&sc->sc_pwrcycle, PWAIT, "pccpwr", hz/4);
> 		if (pwrcycle =3D=3D sc->sc_pwrcycle) {
> 			printf("%s: powerup timeout exceeded, assuming powered up\n",
> 					sc->sc_dev.dv_xname);
> 			++sc->sc_pwrcycle;	/* XXX */
> 		}

This might be, but my patch originated from a similar one that was only=20
intended to diagnose the problem, and once I had it working, I had no
intention to change the kernel on this machine again --- it will leave
Bonn with my boss tomorrow evening, and needs testing of the high level
functions before.

> Or even check whether return value from tsleep() indicates it returned
> due to wakeup() or a timeout. Or is there something I'm missing?

The level of sleep I had had that day. Guess you're right.

Regards,
	-is
--=20
seal your e-mail: http://www.gnupg.org/

--eJnRUKwClWJh1Khz
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFCIYhPN4tiz3B8hB0RAgTmAJ4gF33PwugGQJzLEtZgp1CY1lQIogCeKdHX
eK/JZuLAc22m26ODJIZiJes=
=fhFP
-----END PGP SIGNATURE-----

--eJnRUKwClWJh1Khz--