Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3551015pxu; Tue, 15 Dec 2020 09:31:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxE5FB8zzje4AC88cnxZzg2jlmYFVw7KYhxbtFC3b5CELyeT6JRVKdLjEf+9Q8/JxL5VPfV X-Received: by 2002:a50:d5d5:: with SMTP id g21mr31553573edj.41.1608053476255; Tue, 15 Dec 2020 09:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608053476; cv=none; d=google.com; s=arc-20160816; b=dQ9VN/y18JYR4CdrtuRyDAq4HRWyksnMpIJTTltg1qWiV0eAbtZQkcTKD8wNc+YsTq K4MdNc4ChmdN10bXwpPru9J4SZB3M6CmYEg+W1wr1mqAviVZSFA2eePioUhD9C14/hrJ ne8b+aYF/XJLTkG1UEfOTJy+4PwCumjwdfp1FFHXsHq1tP2nL3fZxsryme7JhdBzsxT+ 2RO30DR/DWzA/I0EM/E/JUHb7j5vr57U3moS6SgnplRXTHvkd+S7bRp7nX3PV0dGiBev DdmW1QdW5wQKrGvU+bPCx8D0nV0ZCEOSBX3zM7By98rM1fMUOwE2YZDZJrbqmNJLl7jT W70g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YLQe1sM4Ge2CHlLzOz2p/trhD+G58BxTmNBt25LRZ8A=; b=NOriZdIW4IlUkdGHrc2GrJgF6KPCRAgqEnvZAESyxGjAhq/qJc2eeKxkKbGIW0YDgv IQbwEyQTA3Tq2+3kQzksKIaHCMXsSl4uxiaE7wtxQIVj2gnvXJ28Kx4nb2BuyozrRyHT RfsteMmwl0dRlYOhy55bCLTUWL6X7L3DzkClstoW7dUL5OMPO0ZgvG6PBRJZABDx+pga P2NnSAIjKzG5aNwjgrqf0RHox+xa5sUx2tgD5xAdTRvmEMZ+D078tIVUHkmSZgtOB0gR oIzft5GED8qlJFaNtRdpOuLI5MspllLZpcBEVmPvUCUVUnBnvCaGit0UeNpfrMlbBIsc Epbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mtRXacPg; 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 h26si1207089ejq.399.2020.12.15.09.30.52; Tue, 15 Dec 2020 09:31:16 -0800 (PST) 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=mtRXacPg; 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 S1730031AbgLOR2K (ORCPT + 99 others); Tue, 15 Dec 2020 12:28:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726431AbgLOR2C (ORCPT ); Tue, 15 Dec 2020 12:28:02 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 736BEC06179C; Tue, 15 Dec 2020 09:27:22 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id lj6so1613629pjb.0; Tue, 15 Dec 2020 09:27:22 -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=YLQe1sM4Ge2CHlLzOz2p/trhD+G58BxTmNBt25LRZ8A=; b=mtRXacPgffa47mMHg0mb+jE2Uic1s/vh3S7sCBxhHYjvzthmVLzIhwhGpfUGV8suE/ ZaaYyacg7kpzmnlJoPPBkhXEOr4rxWuWZi9VhRYODw5JLp6LKb4rzi9AH6D23jG7wB7y iJHSSQ/bc+Ub7HIbwibushpozgI25EwzwGOYpEXNi0+Uux/Cz7F2ownzUE6Yqygbg/3r N2Ei0jsQOvWH8mwF3Sj/1OGcFltg2PkPFsPZqNBUKrJy2zM/kc1giBz4cnnHrLEYL5Dn qpo2qAZqzNZxWJK6JavzI4QkjrnyhwK3AHbgjuVs5VX1/g4sDRRPcIOhF30E7IPup6IY W8lg== 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=YLQe1sM4Ge2CHlLzOz2p/trhD+G58BxTmNBt25LRZ8A=; b=IUaJ/yiRiZU8dlBmmBHB3LY52Xq+73SPQoBMXnSwfo6+QQVnCHIYB46v3nUTAlHVDV 2PpUIw+vD34tPNYbM67TE/NmgpgpvJxucw3jDtHAF6G34IiWKisC5Ue47PDPZilk03vb EGTOLYAQoYJTL0f3WUd8AiO+wKDY1ZARy6MxjnkqaEUa5wal+IzLRgQsXzxITaeFCf4P uJaoYrr8VecO8D3uyrj1CHl9uHkILUZ7YtL+GW3Z6pwhzm96Dhn12rh0BoacXm/Ir5Kc epWkp/h99M+0pU9t2iabij994aQAHSFrtMOhyYwcXHdl5LWw5JcVrI+dmYTyYBqrgPJD thNQ== X-Gm-Message-State: AOAM5333pbtRq99mXuuK3U2Ki1pQfhoqO+0ta9CmIg2tXKsErVIkzMu9 KOhOWaOX2d5jDDRlBGZDZ/xP0ISRz6dl6fBBTvI= X-Received: by 2002:a17:90a:c592:: with SMTP id l18mr31159805pjt.228.1608053241871; Tue, 15 Dec 2020 09:27:21 -0800 (PST) MIME-Version: 1.0 References: <20201215164315.3666-1-calvin.johnson@oss.nxp.com> <20201215164315.3666-5-calvin.johnson@oss.nxp.com> In-Reply-To: <20201215164315.3666-5-calvin.johnson@oss.nxp.com> From: Andy Shevchenko Date: Tue, 15 Dec 2020 19:28:10 +0200 Message-ID: Subject: Re: [net-next PATCH v2 04/14] net: phy: Introduce fwnode_get_phy_id() To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , "linux.cj" , Laurentiu Tudor , Diana Madalina Craciun , ACPI Devel Maling List , Linux Kernel Mailing List , linux-arm Mailing List , netdev , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 15, 2020 at 6:44 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. ... > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) { > + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); > + return 0; > + } > + return -EINVAL; Perhaps traditional pattern, i.e. if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) != 2) return -EINVAL; *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF); return 0; And perhaps GENMASK() ? -- With Best Regards, Andy Shevchenko