public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org,
	linux-usb-devel@lists.sourceforge.net,
	Matt Colyer <matt@colyer.name>,
	jeffm@suse.de
Subject: Re: [RFC] USB: driver for iphone charging
Date: Fri, 24 Aug 2007 09:20:46 +0200	[thread overview]
Message-ID: <200708240920.46397.oliver@neukum.org> (raw)
In-Reply-To: <20070823224514.GA25830@kroah.com>

Am Freitag 24 August 2007 schrieb Greg KH:

Hi,

> +static int select_configuration(struct usb_device *udev)
> +{
> +       char *dummy_buffer = kzalloc(2, GFP_KERNEL);
> +       int retval;
> +
> +       if (!dummy_buffer)
> +               return -ENOMEM;
> +
> +       dbg(&udev->dev, "Calling set_configuration\n");
> +       retval = usb_driver_set_configuration(udev, 3);
> +       if (retval) {
> +               dev_err(&udev->dev, "Set Configuration failed :%d.\n", retval);
> +               goto exit;
> +       }
> +
> +       dbg(&udev->dev, "Sending first magic command\n");
> +       retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x40, 0x40,
> +                                0x6400, 0, dummy_buffer, 0, 100);
> +

int usb_driver_set_configuration(struct usb_device *udev, int config)
{
	struct set_config_request *req;

	req = kmalloc(sizeof(*req), GFP_KERNEL);
	if (!req)
		return -ENOMEM;
	req->udev = udev;
	req->config = config;
	INIT_WORK(&req->work, driver_set_config_work);

	usb_get_dev(udev);
	schedule_work(&req->work);
	return 0;
}

This schedules the change via a workqueue, so you'll be reprobed. If you
fire of the first vendor command you are doing so before the configuration
is changed. How is this supposed to work?

	Regards
		Oliver

  reply	other threads:[~2007-08-24  7:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 22:45 [RFC] USB: driver for iphone charging Greg KH
2007-08-24  7:20 ` Oliver Neukum [this message]
2007-08-24 14:08   ` [linux-usb-devel] " Alan Stern
2007-08-24 14:23     ` Oliver Neukum
2007-08-24 18:36       ` Greg KH
2007-08-24 18:35     ` Greg KH
2007-08-24 18:55       ` Alan Stern
2007-08-25  2:21         ` Matt Colyer
     [not found] <8VtFd-7mx-51@gated-at.bofh.it>
2007-08-24 10:51 ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200708240920.46397.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=greg@kroah.com \
    --cc=jeffm@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=matt@colyer.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox