Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp515693imm; Wed, 20 Jun 2018 02:03:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKlLr6i4ClZm7XXUsxsk6qHCOGLsBlUfz8Var119mrm4dfWeTkuE8LC2PfxfFldkTAGUtXa X-Received: by 2002:a65:640d:: with SMTP id a13-v6mr18222633pgv.154.1529485425205; Wed, 20 Jun 2018 02:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529485425; cv=none; d=google.com; s=arc-20160816; b=BfaQGRpDHusr6Ak27lbyAKxrNka1AMf7ZzXe2OyjelMrRfjVS8350B6JBzB/HleQJT XZP6p5a6s0KttoadnvErEVXEiLhwG9L4jG2bDWDzx7xxaZX3+HYreWZfLDY7Z+PlR28y yIydbt2v7v4xVEdS3IhJweHhFxOqNOVw+AmvIQg2ZzW2Wxz+nLIfBtwlqKao30uXERCE tNt6SS/iJ/3eDJS3rFdUkEXCbd8LVS/prea/OzpUph08BN8RC5aUFPR6OhjJecxX4F9C SOgvCNgaSsn+s8liJFw4FGk7pq82K16QZuSx75S2I/nfVNgfQg1Yr2mp9I/PPnPh1tto KWNA== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=0w+zoAkND/JYQJnb34jIgOhCerzzset+WBWIuLe62wM=; b=NZ62W3dqLIoBvIo1hFqBEqVOcqxfSXA/BYi0qpZ/77+TXoz4g+aHExolGvFS4sXolK WA+lk12KmS6Yg18CQ3aK4UP9vGO1cDx8yiswIp5T95jDFiNO4HBdbSNs9LtKWQPZ9KAK CSNX3wDzFTY2KSlKGbfdhBpSiZ5UiSGs7Go2zWTpKu1Z43H1DIBM7Bta4fL6QPadnSWD bRLjsp+9GL65RjzMhqbomqQEuHVjdKGsI6hRa18a4NzO4/W54v3ZuywZ3f/83CcR1vzJ P2wWm7PBFrGp2z12h5aFvMWALQeAe7pBBnDJVPb90s5MWXIFM6ibt//NsReqS6RUnqVJ /BmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=LLwcwL7C; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9-v6si1714513pgo.36.2018.06.20.02.03.27; Wed, 20 Jun 2018 02:03:45 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=LLwcwL7C; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932620AbeFTJCm (ORCPT + 99 others); Wed, 20 Jun 2018 05:02:42 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:52098 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932602AbeFTJC2 (ORCPT ); Wed, 20 Jun 2018 05:02:28 -0400 Received: by mail-it0-f65.google.com with SMTP id n7-v6so4394690itn.1 for ; Wed, 20 Jun 2018 02:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0w+zoAkND/JYQJnb34jIgOhCerzzset+WBWIuLe62wM=; b=LLwcwL7CGN8eby2k78XQQSYNi0I8Wg0KN4nLMfLOUKC2oaBR3CwnolY1D1mpxeJHpy oVA2jCuAJ/M2l7Wxl1F+J4EDdTzBiCYd9cXkmdP+ScMlmJexpjcDu0tlRX4lavrJBv0/ vG3RPVJTYkn7RLzeY+8NdVR63+pVIToZVB3umY6zGkTV5v2AckCKe2jy1SV7h3dXdj87 NIbW+0pVJS1vgjLenAPiFLND6WL6vHbf/5zDLky2d3zvBUgbmr2BuXyykDOkwJaUtcmz TiOAhE/8LGesZ4EAwpaSGgPyyklL4pU38RxFPWDsXa3OWgtO77TPeuPFwxa/qaR1/Nfe VNaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0w+zoAkND/JYQJnb34jIgOhCerzzset+WBWIuLe62wM=; b=LZKR4zxU17e9kdb4kHg0L1f9ztLxl+9WV1FSaqQNnTnBtSrBvVQRqeGtFh2CI6sKaG G/gx/mKEpfbODdMbMXwF5ObjjPDBi4AawBNFVlw755eongmuW8crQZqY2iJjmORLV6tD RL837rEolmdOyJuZto95vztrXvYCK6n5Jxp+3KfU0MXAa8ayc5JDFRhL80hHW9xGLIPa aB9D9wYBxdVcK2WVNKYA6z+Rx/g92QUVI+ZVHtS8LBUpNZqgs3zqhEhTeq8VMRrdsvMf JHwFnWK5fK+BzicPMS7ncFwwT5RIZ0nSVM9M5l9V5PDwJTdyB+OQ4+jOkDhsMX88Xo0E PZ3w== X-Gm-Message-State: APt69E3CWdj1WLqf2ro9046Blh3RFffLPQ5Z9Jh8twhLMbWGRJhw/YXp HYL9lCOnlSsET51OQH2jwJo8f3figwuPX1RbdRbNbQ== X-Received: by 2002:a24:ddc5:: with SMTP id t188-v6mr730673itf.125.1529481418582; Wed, 20 Jun 2018 00:56:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:9c51:0:0:0:0:0 with HTTP; Wed, 20 Jun 2018 00:56:58 -0700 (PDT) In-Reply-To: References: <20180619160950.6283-1-brgl@bgdev.pl> <20180619160950.6283-2-brgl@bgdev.pl> From: Bartosz Golaszewski Date: Wed, 20 Jun 2018 09:56:58 +0200 Message-ID: Subject: Re: [PATCH 1/3] net: ethernet: fix suspend/resume in davinci_emac To: Florian Fainelli Cc: Grygorii Strashko , "David S . Miller" , Dan Carpenter , Ivan Khoronzhuk , Rob Herring , Lukas Wunner , Kevin Hilman , David Lechner , Sekhar Nori , Andrew Lunn , linux-omap@vger.kernel.org, netdev@vger.kernel.org, Linux Kernel Mailing List , Bartosz Golaszewski , stable 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 2018-06-19 18:55 GMT+02:00 Florian Fainelli : > On 06/19/2018 09:09 AM, Bartosz Golaszewski wrote: >> From: Bartosz Golaszewski >> >> This patch reverts commit 3243ff2a05ec ("net: ethernet: davinci_emac: >> Deduplicate bus_find_device() by name matching") and adds a comment >> which should stop anyone from reintroducing the same "fix" in the future. >> >> We can't use bus_find_device_by_name() here because the device name is >> not guaranteed to be 'davinci_mdio'. On some systems it can be >> 'davinci_mdio.0' so we need to use strncmp() against the first part of >> the string to correctly match it. >> >> Fixes: 3243ff2a05ec ("net: ethernet: davinci_emac: Deduplicate bus_find_device() by name matching") >> Cc: stable@vger.kernel.org >> Signed-off-by: Bartosz Golaszewski >> --- >> drivers/net/ethernet/ti/davinci_emac.c | 15 +++++++++++++-- >> 1 file changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c >> index 06d7c9e4dcda..a1a6445b5a7e 100644 >> --- a/drivers/net/ethernet/ti/davinci_emac.c >> +++ b/drivers/net/ethernet/ti/davinci_emac.c >> @@ -1385,6 +1385,11 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) >> return -EOPNOTSUPP; >> } >> >> +static int match_first_device(struct device *dev, void *data) >> +{ >> + return !strncmp(dev_name(dev), "davinci_mdio", 12); > > const char *bus_name = "davinci_mdio"; > > return !strncmp(dev_name(dev), bus_name, strlen(bus_name)); > > Or even better yet, if you want to make sure this really is a PHY device > that you are trying to match, you could try to use sscanf() with PHY_ID_FMT. > -- > Florian I don't think this is necessary. This simple function would get too complicated with the additional buffer for the sscanf'ed phy name etc. Thanks, Bart