Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp776440ybj; Tue, 5 May 2020 07:24:13 -0700 (PDT) X-Google-Smtp-Source: APiQypKaP8uC2vSsCZUJeJ9tRLfUewMw7oS0q90bw7LxPmUaOZ9hJ0vbCgugLHNz0qE8ca4u6XQi X-Received: by 2002:a50:b285:: with SMTP id p5mr2969553edd.150.1588688653584; Tue, 05 May 2020 07:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588688653; cv=none; d=google.com; s=arc-20160816; b=XQNp7qYd/f0hzkbC91J0n6nviyTYdTW4Zv6Qfe1v8rQH1xMW3RUizdH1AQRm6QTuXf hkBZbRQ4GsdPJaFzJPWd2B1QtIvZ5iMEtBMLhI3UyYh7H4FBjdkGqy7klDUqhVWleGff zLCwagR4O4Y/poG/iGAQ3cjfTOMqOnvSbxbqgKj4UpCjXFP8ZaYYady1faAGQ1bnCNoM Nb6SkmvhknLJQDuYrqgU9wMMHpHVeA3g3AEOJaiHjEZrnmwnnUNbVM0VqxEd5aVvm8ge xQUuU7zVpO5hAs65fku6BDeM1KrMbmAZHu/d9FRYTZB59P4loXMgpPB3PBOkQyV+jlUL GiCw== 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=0nX/PJie6N8ENA2Zvbm0yQ+G3ZDyBTfdd9KJ7MPuSj4=; b=WrExLsUdTynvGi+lJ6eNTbkdpHEcIFVuMY7hqWuo1EuDkE2+VDYtmdvBMYgkZ4qgDh MFbfsBS9P+rVYVqd/3Sd3QGlukG9RTutUzVQIlBIhXGBbyT7fvTq1RLyA3r5ERoQwfiA 4vjyHJ1KpjeYfKTm2PK1pIldYDRhjbEmuJp4vbtYM6RzuD9bhFwkWjNP/FLtPblgAVYJ Xu5g52y48lPNwHNYH/OjVovgI50oMDPQXVKXsjx60aw3qPhLqoEuxg1qZoq+bYbSEfS3 /UH5U7fVBpzSxI8m8G0raMcIVEwnMOmyA4sa8TZ7Dtf/02ZCTELuQRJ6bXjbayJi+5JB ALpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nfmE75xA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dm27si1377477edb.49.2020.05.05.07.23.49; Tue, 05 May 2020 07:24:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nfmE75xA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730598AbgEEOVS (ORCPT + 99 others); Tue, 5 May 2020 10:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729797AbgEEOPX (ORCPT ); Tue, 5 May 2020 10:15:23 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC5DC061A0F; Tue, 5 May 2020 07:15:23 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id s8so1135687pgq.1; Tue, 05 May 2020 07:15:23 -0700 (PDT) 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=0nX/PJie6N8ENA2Zvbm0yQ+G3ZDyBTfdd9KJ7MPuSj4=; b=nfmE75xAk2mRtYELliGHUe/ax/6qkgrPatqmkxJZ/4QQY+o+lMk11CjpG4sAQ3FVBV WzncbHPCgbdKwNdc+0McksELLJMYnMAiR59i9RiNpkJ1wTWQvRjMj/LOf+Xb5oeK3q9X 8VD8zvXA45j3xTucUWd8a6+SrLV7AXDs8dsNgTmPYadNJvCSJY3+9yk+3FG9cqznsAn1 Ayjs9sTijBSlXb0wCaoDlmLuPkX19TLs6CSO8ttbuzlrxO+xpFQbVBsTgFRVP0zVj4wd QyMxU4d3tVal6fMMXpNV6WOxd3TZfCk2bsV8QT8ybu6iLP/OmMTw0MsgxUT8NrAH2Rv+ 1Ceg== 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=0nX/PJie6N8ENA2Zvbm0yQ+G3ZDyBTfdd9KJ7MPuSj4=; b=L303mJpbVSMNy1ExethZrn1BrbfB9EogsM9HridS/D8+4WcZiXGqoWk7vWF6GPZiwo ShmaWWFGJ/lyaH7gqfTXYghTHub9QlUO9yz7cn1laBMCOMwbudx9/lUWLuGL5xuJsNPo CI2/0YQ5F4AV4a4lCye0DXUkXVIqhJBIFeqaCZIeyjXJz25GoUDcSbduNuFXuXG1N0Il aR7+eG5H1tpsAUtCeJAVMMxvj//QmYLwQnhRPokCYQg8i4fnhrU8bTRoi60H2Z/K8kVY OqMOUi1o1U6nMLpn3D1XnMCvtKo15MO15T8WFUGIHH+dzfcK0X1j6BB+qCz34GA751PF AJMw== X-Gm-Message-State: AGi0PuamiyE38pwwZG5ADwgsmkPDl8yYZxVtl5QOKKVlbSCLmL/w7NJm BnWthRIaovLTx4nmjYGsV71Mz904+ktKfu2m3T4= X-Received: by 2002:a62:5ec7:: with SMTP id s190mr3257831pfb.130.1588688122575; Tue, 05 May 2020 07:15:22 -0700 (PDT) MIME-Version: 1.0 References: <20200505132905.10276-1-calvin.johnson@oss.nxp.com> <20200505132905.10276-5-calvin.johnson@oss.nxp.com> In-Reply-To: <20200505132905.10276-5-calvin.johnson@oss.nxp.com> From: Andy Shevchenko Date: Tue, 5 May 2020 17:15:16 +0300 Message-ID: Subject: Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id() To: Calvin Johnson Cc: "Rafael J . Wysocki" , Russell King - ARM Linux admin , linux.cj@gmail.com, Jeremy Linton , Andrew Lunn , Florian Fainelli , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Greg Kroah-Hartman , Heikki Krogerus , Varun Sethi , "Rajesh V . Bikkina" , ACPI Devel Maling List , Linux Kernel Mailing List , Diana Madalina Craciun , netdev , Marcin Wojtas , Laurentiu Tudor , Makarand Pawagi , linux-arm Mailing List , Pankaj Bansal , "David S. Miller" , Heiner Kallweit 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 Tue, May 5, 2020 at 4:29 PM Calvin Johnson wrote: > > Extract phy_id from compatible string. This will be used by > fwnode_mdiobus_register_phy() to create phy device using the > phy_id. > +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id) > +{ > + const char *cp; > + unsigned int upper, lower; > + int ret; > + > + ret = fwnode_property_read_string(fwnode, "compatible", &cp); > + if (!ret) { if (ret) return ret; will help a lot with readability of this. > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", > + &upper, &lower) == 2) { > + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); How upper can be bigger than 0xfff? Same for lower. > + return 0; > + } > + } > + return -EINVAL; > +} -- With Best Regards, Andy Shevchenko