Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp120679ybl; Tue, 27 Aug 2019 17:01:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqztoRxEeQc23062kkItfHxWLnhB8fuRA3j+X7Abx8er/WL3CueEAmbMZJYIGbbH9jX7Vttu X-Received: by 2002:a17:90a:23c8:: with SMTP id g66mr1333223pje.123.1566950479865; Tue, 27 Aug 2019 17:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566950479; cv=none; d=google.com; s=arc-20160816; b=ZhuhHDKU5rj46KMM/7eWyQOZ7LZHtsSiHPW4mJ0cC1lZ7fRvPwy1bDy8CILcLQXJMg ucZdPxm/IaxaXSImY3cTc1Uj1xlgo88eq2U9K1mxWL3o5h+D6GBgzqhmPU+fa/EFHcZy ds8M7wDHSBZBk6q7o4wgb68YxWwbkEo5bVREpwjfqQi1oUXx8EZ6aZZ5Tek55RSxpX4k hKepQQLVvAa3d5xpkJw8q3DOSakBt57INNO1R1jRgy9XQHEstaJYE39eOPq94XVKwkCq hhAxkQh3o95T9LBVWA5hlPdHLJCzVSLrsVeH6Znu82HIKwreGlSbX7pZkbwm3iMbrGo+ /u4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=W77jTG8bpy693vui4bkkDm6EWrj+wqx5LPjIltQ2Bvg=; b=WHPfIa0pNPxfGcQ7VUWzneZEYgmwdrTV9qCAnQzwqXEXT3Mj7xlxn0OYnkGtsAOutg JjCdTZVrQIAIUrXdSo7MWh5bOWmTQ1UaSA/asllGWtypltbIGbVbxokv4T2heYNT22nM s1zuDC3LeWkmpdiIZ6yjNOrih5xBZJhADjlSDyuR1Wyg+mwyckrbG6Gk4evE9RjvpCWo CA58GcZEDapkYQLA7hTuH9sxLpNsTkmtbs+s3o1HU7TW2Ybph3s6vXrrTcXyJgqZAJjV GCrf5TQm+oWMY1MBCaE5d63JJYNiOKjKDsjjqFp5I00+pEaxhLSDK5QNEpwpZyI+wr+J cFTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q5Z5XfDA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az8si500557plb.34.2019.08.27.17.01.03; Tue, 27 Aug 2019 17:01:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q5Z5XfDA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbfH0X76 (ORCPT + 99 others); Tue, 27 Aug 2019 19:59:58 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35412 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbfH0X76 (ORCPT ); Tue, 27 Aug 2019 19:59:58 -0400 Received: by mail-wm1-f66.google.com with SMTP id l2so866972wmg.0 for ; Tue, 27 Aug 2019 16:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W77jTG8bpy693vui4bkkDm6EWrj+wqx5LPjIltQ2Bvg=; b=Q5Z5XfDAESAdLfdGE6V4W96CLOS3dePdM2+vmZfW8cm+pb1ZUVhF1J6Rfypeiyc7sJ s5q4L+VwYxCn49Ugw6k6/xI0JZcp1AAzgjL5uVV5znv9hy6LsWZSQvoALgfxDNRogtNq xZIhQ0yjN9+8TUG96Xzlq4Z4PJNPRgoS8dd6g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W77jTG8bpy693vui4bkkDm6EWrj+wqx5LPjIltQ2Bvg=; b=MuVfSv9S2nxH8mpKGu1+c+Fv8Mbd3DtuArmKHqrR33WIGV2cZ6rLSpArlqGCQRgMam Ib7mCoRkuqHZA3HVgU00PKm0fz1aX3CMuAneJhN0gCvDiultlzYnHy30nYp8paFpwZxj R8yXbtUxLiORKH+UYZ0v7akQqCLvXIygliDr+TmhK58d1vPudwIkhRrxr+aUP0iy1Kmc 8Iewe8tMdHAUvuQFy1cHbWpFx7dZYhVpc8Vmgc2ylPa4zRpFe0hlF4MOZDwUHPZI8NLP wFmJUdb8vXtkdX4K7j3PJHqnlOP4neKaBhmomExeI7z8qWZBFVB7PcRjE0DsY9H6X0yf qi6A== X-Gm-Message-State: APjAAAUdezJ309/jk16SuJAKD42yxiRxJlZXiiXiAo+e9kgkDVZXPOQr prwKzlmYVYjyKXRdKfyWjCEbW1lRpwEqqVK90dr8iA== X-Received: by 2002:a7b:ca54:: with SMTP id m20mr1001230wml.102.1566950396022; Tue, 27 Aug 2019 16:59:56 -0700 (PDT) MIME-Version: 1.0 References: <20190827231409.253037-1-jwerner@chromium.org> In-Reply-To: From: Julius Werner Date: Tue, 27 Aug 2019 16:59:43 -0700 Message-ID: Subject: Re: [PATCH] usb: storage: Add ums-cros-aoa driver To: Matthew Dharm Cc: Alan Stern , Greg Kroah-Hartman , LKML , linux-usb@vger.kernel.org, USB Mass Storage on Linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Why not do the mode switch from userspace? I thought we were trying to move all the mode-switching stuff in that direction..... I need to tie in to the main USB mass storage driver in a way that I think would make it too complicated to move the mode switching part to userspace. See the part I'm adding to initializers.c... that one has to be in the kernel since it operates on the device after the mode switch when it is claimed by the normal USB storage driver. But the mode switch part has to communicate information to it to make sure it picks up the right device (just relying on the normal USB device matching isn't enough in this case, because all Android devices in AOA mode identify themselves with that well-known VID/PID... I don't know if there's any other kernel driver using this protocol today, but there may be at some point and then it becomes important to make sure you really grab the device you meant to grab). Some of that information (the 'route' field) isn't even directly available from userspace (I could use the device name string instead and that would roughly come out to the same thing, but seems less clean to me). So I could either do the mode switch in userspace and add a big custom sysfs interface to the usb-storage driver to allow userspace to configure all this, or I can add a small kernel shim driver like in this patch. Considering how little code the shim driver actually needs I expect it would come out to roughly the same amount of kernel code in both cases, and I feel like this version is much simpler to follow and fits cleaner in the existing "unusual device" driver infrastructure.