Re: [PATCH] iPhone USB Ethernet driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Sonntag, 6. September 2009 20:42:36 schrieb Diego Giagio:
> Hi,
>
> I've been working on an iPhone USB Ethernet driver for some time now
> and I would like to ask you for some input. Currently the driver seems
> to be fully working. It has been tested on both Fedora 11 and Ubuntu
> Jaunty kernels.

static void ipheth_carrier_check_work(struct work_struct *work)
{
	struct ipheth_device *dev = container_of(work, struct ipheth_device,
						 carrier_work.work);

	ipheth_carrier_set(dev);
	schedule_delayed_work(&dev->carrier_work, IPHETH_CARRIER_CHECK_TIMEOUT);
}

Doing this means that it is impossible to have runtime power management
for the device. Is there an alternative?

static int ipheth_open (struct net_device *net)
{
	struct ipheth_device *dev = netdev_priv(net);
	struct usb_device *udev = dev->udev;
	int retval = 0;

	usb_set_interface(udev, IPHETH_INTFNUM, IPHETH_ALT_INTFNUM);

This needs error checking.

	usb_clear_halt(udev, usb_rcvbulkpipe(udev, dev->bulk_in));
	usb_clear_halt(udev, usb_sndbulkpipe(udev, dev->bulk_out));

Is this really needed?

exit:
	return NETDEV_TX_OK;

Even in an error case?

	/* Ensure we are probing the right interface */
	if (intf->cur_altsetting->desc.bInterfaceClass != IPHETH_USBINTF_CLASS ||
	    intf->cur_altsetting->desc.bInterfaceSubClass != IPHETH_USBINTF_SUBCLASS)
		return -ENODEV;

Please use extend macros to specify the interface you want instead of
checking in probe()

static void ipheth_disconnect(struct usb_interface *intf)
{
	struct ipheth_device *dev;

	dev = usb_get_intfdata(intf);
	if (dev != NULL) {

How can this be NULL?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux