Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2022905imm; Sat, 28 Jul 2018 07:42:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd6FGo+uWiIuJ6QGl1JY/3kUPNLgEypyfzHcvxjiFJGfDtbtNr4c/S9clNVYhPP2jYRgYwN X-Received: by 2002:a63:c252:: with SMTP id l18-v6mr10025415pgg.76.1532788952031; Sat, 28 Jul 2018 07:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532788952; cv=none; d=google.com; s=arc-20160816; b=DnhT4fNm4ilsVHxmu6cod79HibZElKEAZCBugFeu0AW/XyAanXyP2/ZMZv42OSLyiQ h6Wf8IQyxFD5oTOY0UJz6Q0NGknC5WpkI0isFjIZx2DHDh+xx//DNIYWxloXZcmx34xm +SNnWf9ffFO1pIk5MPlC81lfSrLa7PHRug7hUIjMHOzZu6l1fRpkpNmRxgWVTVYPAag+ eTKgW45G7l9cutpMBWDTC+9ikgkvRwNXLSK2PN1CixY3iYZTkqCqvSMau3br8domKWuS snMCOw6mtEFZcN93jNAi89uzDFuhQuzotpOgy7d99fq6KvZQCHG3Zgor3K9W7qLX2umE ltAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=YoQveHrYPV6rU/j6PVFFUOjhVI5Q9WMAt3fDuIHGSbM=; b=xy5jsX3GGXQ4uod3G/FLqXgS13Rc5KFoHka1Xr7oE1ZgEYjslR09WRB2RbGE8eqERS ZlOU8FfJwH+6wuiiEkFyq0GFt+Z7bvnNcKgmTaob6LHw+CBC9aueBLZd/7uW55pgks31 qpmGgJ9kmJO/n4VIQV+CJzTkAy4IB6hQnGEixZkRGW36LyldlT6YU57Dh4F+GN57pk2x n1N48OH4XCuwZzmaMBV9gNZsXt1UaDww1znZa91qDclZu/5d1iwCnQBqPjqMsf3sEOX3 ey4uxfNQMyNWRlu5zVFp5DPy60IvK1y4fNLsl3usvbEIVh659lOe0i7iwhMUOz0JZ+vO QNHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BitPXz7Q; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si6027515pge.404.2018.07.28.07.42.17; Sat, 28 Jul 2018 07:42:31 -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=@linaro.org header.s=google header.b=BitPXz7Q; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728962AbeG1QIP (ORCPT + 99 others); Sat, 28 Jul 2018 12:08:15 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:36761 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728949AbeG1QIP (ORCPT ); Sat, 28 Jul 2018 12:08:15 -0400 Received: by mail-lf1-f66.google.com with SMTP id b22-v6so5395544lfa.3 for ; Sat, 28 Jul 2018 07:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YoQveHrYPV6rU/j6PVFFUOjhVI5Q9WMAt3fDuIHGSbM=; b=BitPXz7QmrW9S+70TwZk4jE6m1OiZrpkfvoouudQxxkrC+zOOGHcuoSa1v0oHqLJip hoJsEflmmpqz48OZcVsCAkZEhYOsWoyv+TDHgHvbeaZ1UMHTiy5dEdBKDdArFqL5SPH9 CwEksJGkkOjhUrBAXM1S2V41v+khZkPaFdJ5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=YoQveHrYPV6rU/j6PVFFUOjhVI5Q9WMAt3fDuIHGSbM=; b=NVODSq7lT7cGtJsKZUcG6BoMY5VH7fGhs01cJb8fNd1JH/o3DdAupPQpOvtNTwVorm DqWw22W0wA9q5byjR3pGtSmq2vWB4+xbJURwPIA8BWQuR/Ly3BNnQ0GjCL5Bt9R4nMhj QmXeiktqm6PGmCrc3LblMKiBNtEgizWNR8q82yRqy9kw6MUVVl4cfECBm7ju/G97gPso oDGgDJnshuMwA0ydcFLqxTTUZs/brdL595CXBqFLKIRbNURwHf7xx860yr1jzhGwUTa8 VEf8+bKfhFmbzjgW9fbDdbvo8zAwV7hMUAI8YqJLgm38SmmXq+W9Wt/6+DzpVjQTJUBw wKHw== X-Gm-Message-State: AOUpUlHVkwkQy1NirQwqlOSoCuumjQfc/7f7aMDkv5aWVVO/57xFt2lx ATpevlHqpqTWQ69Zx+AhSESNWg== X-Received: by 2002:a19:a417:: with SMTP id q23-v6mr6267670lfc.59.1532788889080; Sat, 28 Jul 2018 07:41:29 -0700 (PDT) Received: from khorivan (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id t8-v6sm900684lfd.2.2018.07.28.07.41.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Jul 2018 07:41:28 -0700 (PDT) Date: Sat, 28 Jul 2018 17:41:26 +0300 From: Ivan Khoronzhuk To: Joe Perches Cc: grygorii.strashko@ti.com, davem@davemloft.net, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, andrew@lunn.ch Subject: Re: [PATCH v3 net-next] net: ethernet: ti: cpsw: replace unnecessarily macroses on functions Message-ID: <20180728144125.GA7561@khorivan> Mail-Followup-To: Joe Perches , grygorii.strashko@ti.com, davem@davemloft.net, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, andrew@lunn.ch References: <20180727225725.3843-1-ivan.khoronzhuk@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 27, 2018 at 04:30:54PM -0700, Joe Perches wrote: >On Sat, 2018-07-28 at 01:57 +0300, Ivan Khoronzhuk wrote: >> Replace ugly macroses on functions. > >trivia: > >As cpsw_src_port_detect is only used once, and is a >very small function, it might make the code more >intelligible to just directly code it where it's used. > >> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c >[] >> @@ -565,40 +565,40 @@ static const struct cpsw_stats cpsw_gstrings_ch_stats[] = { >[] >> +static void cpsw_src_port_detect(struct cpsw_common *cpsw, int status, >> + struct sk_buff *skb) >> +{ >> + if (!cpsw->data.dual_emac) >> + return; >> + >> + if (CPDMA_RX_SOURCE_PORT(status) == 1) >> + skb->dev = cpsw->slaves[0].ndev; >> + else if (CPDMA_RX_SOURCE_PORT(status) == 2) >> + skb->dev = cpsw->slaves[1].ndev; >> +} >[] >> @@ -801,7 +801,8 @@ static void cpsw_rx_handler(void *token, int len, int status) >> int ret = 0; >> struct cpsw_common *cpsw = ndev_to_cpsw(ndev); >> >> - cpsw_dual_emac_src_port_detect(cpsw, status, ndev, skb); >> + cpsw_src_port_detect(cpsw, status, skb); > >here Can put here, instead of function, the following: if (cpsw->data.dual_emac) { port = CPDMA_RX_SOURCE_PORT(status); if (port) { ndev = cpsw->slaves[--port].ndev; skb->dev = ndev; } } if no objection ofc. > >> + ndev = skb->dev; -- Regards, Ivan Khoronzhuk