MFp4: //depot/projects/usb@155906

Remove "vbus_interrupt" method from bus methods and use
	a global function instead for the various drivers using it.
	The reason for the removal is to simplify the code.

Submitted by: Hans Petter Selasky
This commit is contained in:
thompsa 2009-01-13 19:03:33 +00:00
parent 0dee809a2d
commit 53c862677a
7 changed files with 14 additions and 26 deletions

View File

@ -729,11 +729,9 @@ at91dci_interrupt_poll(struct at91dci_softc *sc)
}
}
static void
at91dci_vbus_interrupt(struct usb2_bus *bus, uint8_t is_on)
void
at91dci_vbus_interrupt(struct at91dci_softc *sc, uint8_t is_on)
{
struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus);
DPRINTFN(5, "vbus = %u\n", is_on);
USB_BUS_LOCK(&sc->sc_bus);
@ -760,7 +758,6 @@ at91dci_vbus_interrupt(struct usb2_bus *bus, uint8_t is_on)
&at91dci_root_intr_done);
}
}
USB_BUS_UNLOCK(&sc->sc_bus);
}
@ -2466,6 +2463,5 @@ struct usb2_bus_methods at91dci_bus_methods =
.get_hw_ep_profile = &at91dci_get_hw_ep_profile,
.set_stall = &at91dci_set_stall,
.clear_stall = &at91dci_clear_stall,
.vbus_interrupt = &at91dci_vbus_interrupt,
.roothub_exec = &at91dci_root_ctrl_task,
};

View File

@ -240,5 +240,6 @@ void at91dci_uninit(struct at91dci_softc *sc);
void at91dci_suspend(struct at91dci_softc *sc);
void at91dci_resume(struct at91dci_softc *sc);
void at91dci_interrupt(struct at91dci_softc *sc);
void at91dci_vbus_interrupt(struct at91dci_softc *sc, uint8_t is_on);
#endif /* _AT9100_DCI_H_ */

View File

@ -72,7 +72,7 @@ struct at91_udp_softc {
};
static void
at91_vbus_interrupt(struct at91_udp_softc *sc)
at91_vbus_poll(struct at91_udp_softc *sc)
{
uint32_t temp;
uint8_t vbus_val;
@ -84,8 +84,7 @@ at91_vbus_interrupt(struct at91_udp_softc *sc)
/* just forward it */
vbus_val = at91_pio_gpio_get(VBUS_BASE, VBUS_MASK);
(sc->sc_dci.sc_bus.methods->vbus_interrupt)
(&sc->sc_dci.sc_bus, vbus_val);
at91dci_vbus_interrupt(&sc->sc_dci, vbus_val);
}
static void
@ -220,10 +219,10 @@ at91_udp_attach(device_t dev)
}
#if (__FreeBSD_version >= 700031)
err = bus_setup_intr(dev, sc->sc_vbus_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
NULL, (void *)at91_vbus_interrupt, sc, &sc->sc_vbus_intr_hdl);
NULL, (void *)at91_vbus_poll, sc, &sc->sc_vbus_intr_hdl);
#else
err = bus_setup_intr(dev, sc->sc_vbus_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
(void *)at91_vbus_interrupt, sc, &sc->sc_vbus_intr_hdl);
(void *)at91_vbus_poll, sc, &sc->sc_vbus_intr_hdl);
#endif
if (err) {
sc->sc_vbus_intr_hdl = NULL;
@ -237,7 +236,7 @@ at91_udp_attach(device_t dev)
goto error;
} else {
/* poll VBUS one time */
at91_vbus_interrupt(sc);
at91_vbus_poll(sc);
}
return (0);

View File

@ -954,11 +954,9 @@ musbotg_interrupt_poll(struct musbotg_softc *sc)
}
}
static void
musbotg_vbus_interrupt(struct usb2_bus *bus, uint8_t is_on)
void
musbotg_vbus_interrupt(struct musbotg_softc *sc, uint8_t is_on)
{
struct musbotg_softc *sc = MUSBOTG_BUS2SC(bus);
DPRINTFN(4, "vbus = %u\n", is_on);
USB_BUS_LOCK(&sc->sc_bus);
@ -2873,6 +2871,5 @@ struct usb2_bus_methods musbotg_bus_methods =
.get_hw_ep_profile = &musbotg_get_hw_ep_profile,
.set_stall = &musbotg_set_stall,
.clear_stall = &musbotg_clear_stall,
.vbus_interrupt = &musbotg_vbus_interrupt,
.roothub_exec = &musbotg_root_ctrl_task,
};

View File

@ -402,5 +402,6 @@ void musbotg_uninit(struct musbotg_softc *sc);
void musbotg_suspend(struct musbotg_softc *sc);
void musbotg_resume(struct musbotg_softc *sc);
void musbotg_interrupt(struct musbotg_softc *sc);
void musbotg_vbus_interrupt(struct musbotg_softc *sc, uint8_t is_on);
#endif /* _MUSB2_OTG_H_ */

View File

@ -50,14 +50,12 @@ struct musbotg_super_softc {
};
static void
musbotg_vbus_interrupt(struct musbotg_super_softc *sc)
musbotg_vbus_poll(struct musbotg_super_softc *sc)
{
uint8_t vbus_val = 1; /* fake VBUS on - TODO */
/* just forward it */
(sc->sc_otg.sc_bus.methods->vbus_interrupt)
(&sc->sc_otg.sc_bus, vbus_val);
musbotg_vbus_interrupt(&sc->sc_otg, vbus_val);
}
static void
@ -154,7 +152,7 @@ musbotg_attach(device_t dev)
goto error;
} else {
/* poll VBUS one time */
musbotg_vbus_interrupt(sc);
musbotg_vbus_poll(sc);
}
return (0);

View File

@ -91,10 +91,6 @@ struct usb2_bus_methods {
void (*set_stall) (struct usb2_device *udev, struct usb2_xfer *xfer, struct usb2_pipe *pipe);
void (*clear_stall) (struct usb2_device *udev, struct usb2_pipe *pipe);
/* USB Device mode only - Optional */
void (*vbus_interrupt) (struct usb2_bus *, uint8_t is_on);
/* USB Device and Host mode - Optional */
void (*roothub_exec) (struct usb2_bus *);