Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6715430imu; Mon, 3 Dec 2018 01:24:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/XVKO9614+ijNOjbbhWjzuN2vhAE6JTBvHuMnrt1NmG1BLpLHIRBIfu6cEGRO50GKJPPRMX X-Received: by 2002:a17:902:a98c:: with SMTP id bh12mr15301797plb.31.1543829071535; Mon, 03 Dec 2018 01:24:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543829071; cv=none; d=google.com; s=arc-20160816; b=AaCUJlFY9J8ZldKb44vO7K0I9fs106Keyo+Ha9aWBIFjTFwYP5jbOFX5ul8HgHeUJj dnycl9Lo966aXzn7ErLKnzdnpmecfmBCH+Vm6Nfd5/68BFQ1zXzxfurtw7Q3WG4TfKvc /FGMLoZTFLO71LTtAOQ+AzAgJEuzRjdf/Xh4OgqCgqIaQ5Dj+Na2QzQMgBzayNy45ZQ2 MxH5NPDXACnr8Gc73wwkX5fZxe6nOMJ9NH9VTDMd0npGSVovUNsvaGZ59imEeS6qiFdQ 6qo/iaK27L60Z+xZDvAclIRG/pyMje4QVgAY2HJ00NXbGSnp/ZYFA2NkEakY5JXmBHLP 0CVg== 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=GzEQLHk5lgAA5E0RyRju2SXaYKs0b2Do2xr9/bHiFoU=; b=mlhjx2ZxqXoaxhxBN51gV3ZDwQdNH6pqO+hqGyn/cHl8y12Ci1XH7/Nw9LvFLJZLcd RlD/A3fHQWu+ghLpsQ7tWoc6Czo1nl9DdMIeU4Ra1se9KLJzE65DtpUfJThnyCi9CbyC 3p8iDwt5zltBKa+j5lTjfKy76Hz0aGxionRQps6ctprHT83Bk1aybz+VdP8QmPFL5pNP HfQZUexNCQLOjO3GuLqIq+5No004zfnqHbd0+BMsdaJ8hlPTUYRoEjWU0V1GjcRZyHUc WJu9PstNNMeYwJ6dqes+BDvCCWYDmMarTuD/+E/zIDaBDjkj22h3NrJwpNL4BG2jERWR bQgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bhkIFqcJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w22si12835868plp.301.2018.12.03.01.24.16; Mon, 03 Dec 2018 01:24:31 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=bhkIFqcJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726086AbeLCJXZ (ORCPT + 99 others); Mon, 3 Dec 2018 04:23:25 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:38425 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeLCJXZ (ORCPT ); Mon, 3 Dec 2018 04:23:25 -0500 Received: by mail-qk1-f193.google.com with SMTP id d19so6882683qkg.5; Mon, 03 Dec 2018 01:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GzEQLHk5lgAA5E0RyRju2SXaYKs0b2Do2xr9/bHiFoU=; b=bhkIFqcJ1F4hElH//yJXv5OvBG52iCdoOVV186dZWFc2YYsDUMxkJCpS2Oz+Yag4eG 2JUtFgYUghAVwI5UhMom6tMxeio1VQmDHp8Xa999voWR1jiabRcOgzPz7/Tma8oySaxN HWh8ggRcyGsT4ckTKmx3TH/iQT1BfCbajVjhrkJUPwAWMSj8+OtAHHXhYt0ByuHXuLND Me5Fbz2zfREAjU58J3HoIdvKdCqc8N3ldc8J3/kM3glkYlYa3cpdmGvzbV0O2dfE7Jri fMGhf7E1Kxq2O00Gzplyx+PT50UyGrbQxR0zyNPPG6TD3NM3h13ZJZfDmcZ1DQqw8cQP NwiA== 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=GzEQLHk5lgAA5E0RyRju2SXaYKs0b2Do2xr9/bHiFoU=; b=MhjJldgFCXrTMqkRBwgSIbMIo4e/CmDlCDuBR1fcqq2/sH0vhnPUoq1IvVUaCiSjUG 5bXzZugqp8AMwG8B2ZFvQf1Xm64PJ7DTELTjHHPFzEuDVNNMp/I0mrB14i+h6dP+EXpT 3tFtyuCXQhQI3JPMchkOjgWluMIJLFMaOLB8sAhPytt9rqJUPcSZx78N1BM3umLPtQpd 4OP3ZeRnmMC9qPf/NLoI6L1W7lT4h9LNomOMrfXExw/DpDCp1B/do+rBddIlM9nWrDUA Oq+0Do4hdbfpcipkzDur56E9zOtLXpLeQq3z6/eX6dWOk+IPWMU+i73+e+yGp0VLN1nN V2dg== X-Gm-Message-State: AA+aEWZ00S2SRlCU7in7L4YgNOvfelaqw02EOWm5+AuwI3wLsLOr0s+6 FsumVojMaDPPOrlKKbq7K24IcjoRfwyOkm6xSonTpWUV X-Received: by 2002:a37:c3c3:: with SMTP id r64mr13988551qkl.70.1543828991816; Mon, 03 Dec 2018 01:23:11 -0800 (PST) MIME-Version: 1.0 References: <20181203034515.91412-1-chenyu56@huawei.com> <20181203034515.91412-11-chenyu56@huawei.com> In-Reply-To: <20181203034515.91412-11-chenyu56@huawei.com> From: Andy Shevchenko Date: Mon, 3 Dec 2018 11:23:00 +0200 Message-ID: Subject: Re: [PATCH v1 10/12] hikey960: Support usb functionality of Hikey960 To: chenyu56@huawei.com Cc: USB , devicetree , Linux Kernel Mailing List , Suzhuangluan , Kongfei , Arnd Bergmann , Greg Kroah-Hartman , John Stultz , Wangbinghui , "Krogerus, Heikki" 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 On Mon, Dec 3, 2018 at 5:47 AM Yu Chen wrote: > > This driver handles usb hub power on and typeC port event of HiKey960 board: > 1)DP&DM switching between usb hub and typeC port base on typeC port > state > 2)Control power of usb hub on Hikey960 > 3)Control vbus of typeC port > +config HISI_HIKEY_USB > + tristate "USB functionality of HiSilicon Hikey Platform" > + depends on GPIOLIB > + default n No, Linus is not happy about this. Default n _is_ a default. > + help > + If you say yes here you get support for usb functionality of HiSilicon Hikey Platform. > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * hisi_hikey_usb.c > + * > + * Copyright (c) Hisilicon Tech. Co., Ltd. All rights reserved. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + */ Same comments to the above lines. > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include Order? > + pr_debug("%s: set hub power %d\n", __func__, value); Noise. > + pr_debug("%s: switch to %s\n", __func__, switch_to_str); Noise. > + pr_debug("%s: set typec vbus gpio to %d\n", __func__, value); Noise. > + if (!nb) > + return -EINVAL; On which conditions this happen? > + pr_info("%s:set typec state to %lu\n", __func__, state); Noise! Guys, you perhaps can read about tracepoints and function tracer facilities in the kernel. > +static int hisi_hikey_usb_probe(struct platform_device *pdev) > +{ > + pr_info("%s: typc_vbus_enable_val can't get\n", __func__); Noise! > + if (IS_ERR_OR_NULL(hisi_hikey_usb->typec_vbus)) { So, this check is redundant. You are repeating it below. > + if (!hisi_hikey_usb->typec_vbus) > + ret = -EINVAL; > + else > + ret = PTR_ERR(hisi_hikey_usb->typec_vbus); > + return ret; > + } > + if (IS_ERR_OR_NULL(hisi_hikey_usb->role_sw)) { > + pr_err("%s: usb_role_switch_get failed\n", __func__); Noise and same comment to the conditional check as above > + if (!hisi_hikey_usb->role_sw) > + ret = -ENOENT; > + else > + ret = PTR_ERR(hisi_hikey_usb->role_sw); > + return ret; > + } > + .of_match_table = of_match_ptr(id_table_hisi_hikey_usb), Does it compiles for non-OF case? Why macro is in use? -- With Best Regards, Andy Shevchenko