From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A027AC433F5 for ; Thu, 30 Sep 2021 09:05:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 831746140F for ; Thu, 30 Sep 2021 09:05:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349145AbhI3JGz (ORCPT ); Thu, 30 Sep 2021 05:06:55 -0400 Received: from mail-ot1-f42.google.com ([209.85.210.42]:39505 "EHLO mail-ot1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348505AbhI3JGy (ORCPT ); Thu, 30 Sep 2021 05:06:54 -0400 Received: by mail-ot1-f42.google.com with SMTP id j11-20020a9d190b000000b00546fac94456so6413383ota.6; Thu, 30 Sep 2021 02:05:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A0kBNA83hCb4HCc/FO3KjbqdDYyweltNhd4aS4t5/kU=; b=ZQ03FvJTEVQgULL5OLEhNdTmZvrPWMrXROd0pTRxLQZ+a6FeveJ+mcBQqrxogW1hQ5 mdz0OPDeb36InyIXjRXRuu1rvSZWm60yjIZtW80Sm3TfQ760acisFrq0bATbPppPGVtW cuWt529BWO7y9B5RDxBC+rgdaeTgp5PTMKPTgLjtvQD1R6DmxL3zdiltg22154XI5r89 1J8QwxfL47Jiv1P18MVOTs54AAS2ljT+v/lMkX9oEOZurxNi1lYYgBl2UXjpTUcJW8TJ pzdOlfzssehxDMidDcALXpEqUyEjK0/2p5gu7t38ywiP1V7mlIKnpifgk9aEGXf2aKAY cEbw== X-Gm-Message-State: AOAM530FwqgiVHJN65gBistiziBI4/Qc3LOQgMmGfk9atCYeMDIMVHTI LYLS80UoHF3AMorsAnkfTEsMvqoPEVXohcQk2nk= X-Google-Smtp-Source: ABdhPJxQvr32DBDvE9GooVKcASD2AsIl4lfSqdKR1BOYS2VPGs0tjNvE9npSlrVtmKJ8P2bAkPp+G83bpdvcAuxPNP4= X-Received: by 2002:a05:6830:2784:: with SMTP id x4mr4274581otu.86.1632992711404; Thu, 30 Sep 2021 02:05:11 -0700 (PDT) MIME-Version: 1.0 References: <20210930010511.3387967-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210930010511.3387967-2-sathyanarayanan.kuppuswamy@linux.intel.com> <20210930014229.GA447956@rowland.harvard.edu> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 30 Sep 2021 11:05:00 +0200 Message-ID: Subject: Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core To: Dan Williams Cc: "Kuppuswamy, Sathyanarayanan" , Alan Stern , Greg Kroah-Hartman , Borislav Petkov , X86 ML , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Andreas Noever , "Michael S . Tsirkin" , Michael Jamet , Yehezkel Bernat , "Rafael J . Wysocki" , Mika Westerberg , Jonathan Corbet , Jason Wang , Andi Kleen , Kuppuswamy Sathyanarayanan , Linux Kernel Mailing List , Linux PCI , USB list , virtualization@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 6:59 AM Dan Williams wrote: > > On Wed, Sep 29, 2021 at 7:39 PM Kuppuswamy, Sathyanarayanan > wrote: > > > > > > > > On 9/29/21 6:55 PM, Dan Williams wrote: > > >> Also, you ignored the usb_[de]authorize_interface() functions and > > >> their friends. > > > Ugh, yes. > > > > I did not change it because I am not sure about the interface vs device > > dependency. > > > > This is was the rationale for has_probe_authorization flag. USB > performs authorization of child devices based on the authorization > state of the parent interface. > > > I think following change should work. > > > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > > index f57b5a7a90ca..84969732d09c 100644 > > --- a/drivers/usb/core/driver.c > > +++ b/drivers/usb/core/driver.c > > @@ -334,7 +334,7 @@ static int usb_probe_interface(struct device *dev) > > if (udev->dev.authorized == false) { > > dev_err(&intf->dev, "Device is not authorized for usage\n"); > > return error; > > - } else if (intf->authorized == 0) { > > + } else if (intf->dev.authorized == 0) { > > == false Or even (!intf->dev.authorized). > > dev_err(&intf->dev, "Interface %d is not authorized for usage\n", > > intf->altsetting->desc.bInterfaceNumber); > > return error; > > @@ -546,7 +546,7 @@ int usb_driver_claim_interface(struct usb_driver *driver, > > return -EBUSY; > > > > /* reject claim if interface is not authorized */ > > - if (!iface->authorized) > > + if (!iface->dev.authorized) > > I'd do == false to keep it consistent with other conversions. But this looks odd, FWIW.