Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6669654rdb; Fri, 15 Dec 2023 05:25:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoluooE/RBcg1KKwqU+zpz9SZBUmsvG2J4SFod4m57KJ7LVH3yiPPK3d2O64iP0qYIG08u X-Received: by 2002:a05:6102:a4d:b0:465:d88a:4e53 with SMTP id i13-20020a0561020a4d00b00465d88a4e53mr9849856vss.14.1702646714422; Fri, 15 Dec 2023 05:25:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702646714; cv=none; d=google.com; s=arc-20160816; b=eG/7guNkAFYK2/82fLFz4JADyntxjNRI6PSHdtx5GRW4J8QBMBf2q/xwfPGv+GLz6Z PCvTXwQrzw0+F8EbsUXanHiqqnjDaDDDSptBirno3WQyjXUFecR6Pr9iToM5HhgKc1jr JuOEA1Uqdp+MIVfVzxB5v+4zeV5+D7Q3/PDwZf+oXYS0+OLgTtTbX1SuqEwnfYCCGOG2 0wljbyi6GbV2fYABd4xhozFHs+h4ULw/o0qHcnoYIR9MEFGHqWFc5rEJs6Obkc+9mEe9 ZlNFSYuJlMi2xlLHfiYOTAJhgLH/YwApuUOyA0NAFSa/ntlE2cdzi9r12NyTMEgOngBq Gbfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=cWutSZhoRLpsHq1ss8DLqxz5PanY9fUqHso3qlY5Y3k=; fh=PrsvKj9RgkJ6KyuxqIrBsykwNaYXjEXEBuk48luiO+Y=; b=ry8f6LpTfxIid9OgqnZUZPdXla9c+dWIrpxDd17NRw2EvT9+HQg7EccpsfyweN3peR 8B1NRtS7mhvhlGFey3ErV/upBQh9JouET3OfV2Y3e7Fuwg9CavAcOPNvCRfmSfRHMbl2 9ywKFGKt1tZurR+MJglkQ3oo+MR6zjbYjeUylh9dVPbJ0c5VuTlrKt0G+zjANns87NSc gVDkAGe5oTuszolDNY/jnx2Ufw9CGPADbA9KdBNxOEJ9+LzfaMXNs8bWkibdixb4ytoV V0SiNEL4FtLwFLzYsqxGCPgFlvzHNVNn/LK6hIrARMtJh/8vybuH/gv0pRmS5n/YpHkp j/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mjR+LvMx; spf=pass (google.com: domain of linux-kernel+bounces-1006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1006-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h9-20020a67cfc9000000b00464814964c6si3222463vsm.667.2023.12.15.05.25.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 05:25:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mjR+LvMx; spf=pass (google.com: domain of linux-kernel+bounces-1006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1006-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 28AD51C22347 for ; Fri, 15 Dec 2023 13:25:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 319B62DB7D; Fri, 15 Dec 2023 13:23:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mjR+LvMx" X-Original-To: linux-kernel@vger.kernel.org Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05C102DB75 for ; Fri, 15 Dec 2023 13:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <09d43174-03fc-abb8-db28-b0fb338492f1@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702646607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cWutSZhoRLpsHq1ss8DLqxz5PanY9fUqHso3qlY5Y3k=; b=mjR+LvMxSuWdkFGFG4DUNSzFKZil3WEiZc5MnuuONTcrLrkXQCR3ZrvciqT5IkP+FNDx38 qUR/FYdCLkCQFzsssJPIUpZcZlzDe7k1whpDj05gBHjdwTXxxqoWwaJhKWABFInL7T0UrM jv77eIug5gUENdFPPSQuH8qRHyMnQCo= Date: Fri, 15 Dec 2023 21:23:12 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] USB: core: Use device_driver directly in struct usb_driver and usb_device_driver To: Greg KH Cc: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, wg@grandegger.com, mkl@pengutronix.de, aspriel@gmail.com, franky.lin@broadcom.com, hante.meuleman@broadcom.com, kvalo@kernel.org, briannorris@chromium.org, mka@chromium.org, johan@kernel.org, oneukum@suse.com, stern@rowland.harvard.edu, valentina.manea.m@gmail.com, shuah@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231215063101.792991-1-yajun.deng@linux.dev> <2023121505-dexterity-rectal-8898@gregkh> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: <2023121505-dexterity-rectal-8898@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2023/12/15 20:40, Greg KH wrote: > On Fri, Dec 15, 2023 at 02:31:01PM +0800, Yajun Deng wrote: >> There is usbdrv_wrap in struct usb_driver and usb_device_driver, >> it contains device_driver and for_devices. for_devices is used to >> distinguish between device drivers and interface drivers. > Yes. > >> We can compare that if 'drv->probe' is equal to usb_probe_device instead >> of using for_devices in is_usb_device_driver(). > Why? For remove struct usbdrv_wrap. As we can see,  other structs use device_driver directly. struct sdio_driver { ... ...         struct device_driver drv; }; struct pcie_port_service_driver { ... ...         struct device_driver driver; }; and so on ... So there is no need a wrapper for device_driver if we can implement is_usb_device_driver(). > >> Remove struct usbdrv_wrap, use device_driver directly in struct usb_driver >> and usb_device_driver. This makes the code more concise. > Really? What does this help out with? Are there future changes that > require this? No, just for cleanups and consistency with other structs. > I'm all for cleanups, but I don't see what this helps with. > > Also, you have a coding style issue in this patch, which means I > couldn't take it anyway: > >> +extern int usb_probe_device(struct device *dev); > We don't do that in .c files :( It's in drivers/usb/core/usb.h, not in .c files. > > thanks, > > greg k-h