2007-10-30 21:02:24

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/2] usb_gigaset: suspend support [v2]

On Mon, 29 Oct 2007 22:41:30 +0100 (CET)
Tilman Schmidt <[email protected]> wrote:

> From: Tilman Schmidt <[email protected]>
>
> Add basic suspend/resume support to the usb_gigaset driver.
> (Corrected version.)
>

You're not a big fan of checkpatch, I see.

> +static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
> +{
> + struct cardstate *cs;
> + struct usb_cardstate *ucs;
> +
> + if ((cs = usb_get_intfdata(intf)) == NULL ||
> + (ucs = cs->hw.usb) == NULL) {
> + err("%s: no cardstate", __func__);
> + return -EFAULT;
> + }

Is the above reeeeeely needed? I bet it never happens.

> +static int gigaset_resume(struct usb_interface *intf)
> +{
> + struct cardstate *cs;
> + struct usb_cardstate *ucs;
> + int rc;
> +
> + if ((cs = usb_get_intfdata(intf)) == NULL ||
> + (ucs = cs->hw.usb) == NULL) {
> + err("%s: no cardstate", __func__);
> + return -EFAULT;
> + }

ditto.


2007-11-01 18:20:05

by Tilman Schmidt

[permalink] [raw]
Subject: Re: [PATCH 1/2] usb_gigaset: suspend support [v2]

Am 30.10.2007 22:01 schrieb Andrew Morton:
> On Mon, 29 Oct 2007 22:41:30 +0100 (CET)
> Tilman Schmidt <[email protected]> wrote:
>
>> From: Tilman Schmidt <[email protected]>
>>
>> Add basic suspend/resume support to the usb_gigaset driver.
>> (Corrected version.)
>>
>
> You're not a big fan of checkpatch, I see.

Sorry. I promise to mend my ways.

>> +static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
>> +{
>> + struct cardstate *cs;
>> + struct usb_cardstate *ucs;
>> +
>> + if ((cs = usb_get_intfdata(intf)) == NULL ||
>> + (ucs = cs->hw.usb) == NULL) {
>> + err("%s: no cardstate", __func__);
>> + return -EFAULT;
>> + }
>
> Is the above reeeeeely needed? I bet it never happens.

I'm a great believer in defensive programming. :-)

Anyway, to be sure these checks aren't needed, I would need the
assurance that the suspend and resume methods are serialized with
the probe and disconnect methods. Are they?

Thanks,
Tilman

--
Tilman Schmidt E-Mail: [email protected]
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Unge?ffnet mindestens haltbar bis: (siehe R?ckseite)


Attachments:
signature.asc (253.00 B)
OpenPGP digital signature

2007-11-01 18:50:37

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/2] usb_gigaset: suspend support [v2]

On Thu, 01 Nov 2007 19:20:07 +0100
Tilman Schmidt <[email protected]> wrote:

> >> +static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
> >> +{
> >> + struct cardstate *cs;
> >> + struct usb_cardstate *ucs;
> >> +
> >> + if ((cs = usb_get_intfdata(intf)) == NULL ||
> >> + (ucs = cs->hw.usb) == NULL) {
> >> + err("%s: no cardstate", __func__);
> >> + return -EFAULT;
> >> + }
> >
> > Is the above reeeeeely needed? I bet it never happens.
>
> I'm a great believer in defensive programming. :-)
>
> Anyway, to be sure these checks aren't needed, I would need the
> assurance that the suspend and resume methods are serialized with
> the probe and disconnect methods. Are they?

dunno it beats me. Not to my knowledge. Perhaps Greg and Rafael would know?

2007-11-01 19:47:19

by Alan Stern

[permalink] [raw]
Subject: Re: [linux-usb-devel] [PATCH 1/2] usb_gigaset: suspend support [v2]

On Thu, 1 Nov 2007, Tilman Schmidt wrote:

> Anyway, to be sure these checks aren't needed, I would need the
> assurance that the suspend and resume methods are serialized with
> the probe and disconnect methods. Are they?

Yes. See Documentation/usb/power-management.txt.

Alan Stern