[{"id":1770548,"web_url":"http://patchwork.ozlabs.org/comment/1770548/","msgid":"<87wp4v1wrg.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","list_archive_url":null,"date":"2017-09-18T22:12:51","subject":"Re: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","submitter":{"id":15889,"url":"http://patchwork.ozlabs.org/api/people/15889/","name":"Vivien Didelot","email":"vivien.didelot@savoirfairelinux.com"},"content":"Hi Florian,\n\nFlorian Fainelli <f.fainelli@gmail.com> writes:\n\n> Instead of repeating the same pattern: acquire mutex, read/write, release\n> mutex, define a macro: b53_build_op() which takes the type (read|write), I/O\n> size, and value (scalar or pointer). This helps with fixing bugs that could\n> exit (e.g: missing barrier, lock etc.).\n>\n> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>\n\nReviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xx0hz5YXKz9s7m\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 08:16:35 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750886AbdIRWQd (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 18:16:33 -0400","from mail.savoirfairelinux.com ([208.88.110.44]:35428 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1750783AbdIRWQd (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 18 Sep 2017 18:16:33 -0400","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 0C95C9C1A41;\n\tMon, 18 Sep 2017 18:16:22 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id UMX93FCqSsqO; Mon, 18 Sep 2017 18:16:21 -0400 (EDT)","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 715789C2C54;\n\tMon, 18 Sep 2017 18:16:21 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id HmvP1prIveZP; Mon, 18 Sep 2017 18:16:21 -0400 (EDT)","from localhost (unknown [192.168.49.104])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id 4B0C59C1A41;\n\tMon, 18 Sep 2017 18:16:21 -0400 (EDT)"],"X-Virus-Scanned":"amavisd-new at mail.savoirfairelinux.com","From":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>","To":"Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org","Cc":"davem@davemloft.net, andrew@lunn.ch,\n\tFlorian Fainelli <f.fainelli@gmail.com>","Subject":"Re: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","In-Reply-To":"<20170918214128.27896-6-f.fainelli@gmail.com>","References":"<20170918214128.27896-1-f.fainelli@gmail.com>\n\t<20170918214128.27896-6-f.fainelli@gmail.com>","Date":"Mon, 18 Sep 2017 18:12:51 -0400","Message-ID":"<87wp4v1wrg.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","MIME-Version":"1.0","Content-Type":"text/plain","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1770972,"web_url":"http://patchwork.ozlabs.org/comment/1770972/","msgid":"<063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>","list_archive_url":null,"date":"2017-09-19T12:53:51","subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","submitter":{"id":6689,"url":"http://patchwork.ozlabs.org/api/people/6689/","name":"David Laight","email":"David.Laight@ACULAB.COM"},"content":"From: Florian Fainelli\n> Sent: 18 September 2017 22:41\n> Instead of repeating the same pattern: acquire mutex, read/write, release\n> mutex, define a macro: b53_build_op() which takes the type (read|write), I/O\n> size, and value (scalar or pointer). This helps with fixing bugs that could\n> exit (e.g: missing barrier, lock etc.).\n....\n> +#define b53_build_op(type, op_size, val_type)\t\\\n> +static inline int b53_##type##op_size(struct b53_device *dev, u8 page,\t\t\\\n> +\t\t\t\t      u8 reg, val_type val)\t\t\t\\\n> +{\t\t\t\t\t\t\t\t\t\t\\\n> +\tint ret;\t\t\t\t\t\t\t\t\\\n> +\t\t\t\t\t\t\t\t\t\t\\\n> +\tmutex_lock(&dev->reg_mutex);\t\t\t\t\t\t\\\n> +\tret = dev->ops->type##op_size(dev, page, reg, val);\t\t\t\\\n> +\tmutex_unlock(&dev->reg_mutex);\t\t\t\t\t\t\\\n> +\t\t\t\t\t\t\t\t\t\t\\\n> +\treturn ret;\t\t\t\t\t\t\t\t\\\n>  }\n\nWhy separate the 'type' and 'op_size' arguments since they\nare always pasted together?\n\n\tDavid","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxN9P2fFwz9s7m\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 22:54:01 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751410AbdISMx7 convert rfc822-to-8bit (ORCPT\n\t<rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 19 Sep 2017 08:53:59 -0400","from smtp-out6.electric.net ([192.162.217.185]:60845 \"EHLO\n\tsmtp-out6.electric.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750823AbdISMx6 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 19 Sep 2017 08:53:58 -0400","from 1duI2B-0005PU-VO by out6d.electric.net with emc1-ok (Exim\n\t4.87) (envelope-from <David.Laight@ACULAB.COM>)\n\tid 1duI2C-0005UW-Us; Tue, 19 Sep 2017 05:53:52 -0700","by emcmailer; Tue, 19 Sep 2017 05:53:52 -0700","from [156.67.243.126] (helo=AcuExch.aculab.com)\n\tby out6d.electric.net with esmtps (TLSv1:AES128-SHA:128)\n\t(Exim 4.87) (envelope-from <David.Laight@ACULAB.COM>)\n\tid 1duI2B-0005PU-VO; Tue, 19 Sep 2017 05:53:51 -0700","from ACUEXCH.Aculab.com ([::1]) by AcuExch.aculab.com ([::1]) with\n\tmapi id 14.03.0123.003; Tue, 19 Sep 2017 13:53:52 +0100"],"From":"David Laight <David.Laight@ACULAB.COM>","To":"'Florian Fainelli' <f.fainelli@gmail.com>,\n\t\"netdev@vger.kernel.org\" <netdev@vger.kernel.org>","CC":"\"davem@davemloft.net\" <davem@davemloft.net>,\n\t\"andrew@lunn.ch\" <andrew@lunn.ch>, \"vivien.didelot@savoirfairelinux.com\" \n\t<vivien.didelot@savoirfairelinux.com>","Subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","Thread-Topic":"[PATCH net-next 05/12] net: dsa: b53: Use a macro to define\n\tI/O operations","Thread-Index":"AQHTMMcS0SFE3rMzSEqD+9k6WIZjW6K8Km2Q","Date":"Tue, 19 Sep 2017 12:53:51 +0000","Message-ID":"<063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>","References":"<20170918214128.27896-1-f.fainelli@gmail.com>\n\t<20170918214128.27896-6-f.fainelli@gmail.com>","In-Reply-To":"<20170918214128.27896-6-f.fainelli@gmail.com>","Accept-Language":"en-GB, en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","x-originating-ip":"[10.202.99.200]","Content-Type":"text/plain; charset=\"Windows-1252\"","Content-Transfer-Encoding":"8BIT","MIME-Version":"1.0","X-Outbound-IP":"156.67.243.126","X-Env-From":"David.Laight@ACULAB.COM","X-Proto":"esmtps","X-Revdns":"","X-HELO":"AcuExch.aculab.com","X-TLS":"TLSv1:AES128-SHA:128","X-Authenticated_ID":"","X-PolicySMART":"3396946, 3397078","X-Virus-Status":["Scanned by VirusSMART (c)","Scanned by VirusSMART (s)"],"Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1771074,"web_url":"http://patchwork.ozlabs.org/comment/1771074/","msgid":"<87tvzy93ew.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","list_archive_url":null,"date":"2017-09-19T14:19:35","subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","submitter":{"id":15889,"url":"http://patchwork.ozlabs.org/api/people/15889/","name":"Vivien Didelot","email":"vivien.didelot@savoirfairelinux.com"},"content":"Hi David,\n\nDavid Laight <David.Laight@ACULAB.COM> writes:\n\n> From: Florian Fainelli\n>> Sent: 18 September 2017 22:41\n>> Instead of repeating the same pattern: acquire mutex, read/write, release\n>> mutex, define a macro: b53_build_op() which takes the type (read|write), I/O\n>> size, and value (scalar or pointer). This helps with fixing bugs that could\n>> exit (e.g: missing barrier, lock etc.).\n> ....\n>> +#define b53_build_op(type, op_size, val_type)\t\\\n>> +static inline int b53_##type##op_size(struct b53_device *dev, u8 page,\t\t\\\n>> +\t\t\t\t      u8 reg, val_type val)\t\t\t\\\n>> +{\t\t\t\t\t\t\t\t\t\t\\\n>> +\tint ret;\t\t\t\t\t\t\t\t\\\n>> +\t\t\t\t\t\t\t\t\t\t\\\n>> +\tmutex_lock(&dev->reg_mutex);\t\t\t\t\t\t\\\n>> +\tret = dev->ops->type##op_size(dev, page, reg, val);\t\t\t\\\n>> +\tmutex_unlock(&dev->reg_mutex);\t\t\t\t\t\t\\\n>> +\t\t\t\t\t\t\t\t\t\t\\\n>> +\treturn ret;\t\t\t\t\t\t\t\t\\\n>>  }\n>\n> Why separate the 'type' and 'op_size' arguments since they\n> are always pasted together?\n\nFor read/write48, the value type is u64.\n\n\nThanks,\n\n        Vivien","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxQ8K54gTz9s7h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 00:23:13 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751377AbdISOXL (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 19 Sep 2017 10:23:11 -0400","from mail.savoirfairelinux.com ([208.88.110.44]:38894 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1750974AbdISOXK (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 19 Sep 2017 10:23:10 -0400","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 40F079C1ACB;\n\tTue, 19 Sep 2017 10:23:09 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id ibK9GGNlyfI8; Tue, 19 Sep 2017 10:23:06 -0400 (EDT)","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 552539C2AC2;\n\tTue, 19 Sep 2017 10:23:06 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id RxHisatCufoX; Tue, 19 Sep 2017 10:23:06 -0400 (EDT)","from localhost (unknown [192.168.49.104])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id 2E95E9C2A85;\n\tTue, 19 Sep 2017 10:23:06 -0400 (EDT)"],"X-Virus-Scanned":"amavisd-new at mail.savoirfairelinux.com","From":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>","To":"David Laight <David.Laight@ACULAB.COM>,\n\t'Florian Fainelli' <f.fainelli@gmail.com>,\n\t\"netdev\\@vger.kernel.org\" <netdev@vger.kernel.org>","Cc":"\"davem\\@davemloft.net\" <davem@davemloft.net>,\n\t\"andrew\\@lunn.ch\" <andrew@lunn.ch>","Subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","In-Reply-To":"<063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>","References":"<20170918214128.27896-1-f.fainelli@gmail.com>\n\t<20170918214128.27896-6-f.fainelli@gmail.com>\n\t<063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>","Date":"Tue, 19 Sep 2017 10:19:35 -0400","Message-ID":"<87tvzy93ew.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","MIME-Version":"1.0","Content-Type":"text/plain","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1771083,"web_url":"http://patchwork.ozlabs.org/comment/1771083/","msgid":"<12153E6A-CB96-4EED-91CE-05604B640927@gmail.com>","list_archive_url":null,"date":"2017-09-19T14:29:38","subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","submitter":{"id":2800,"url":"http://patchwork.ozlabs.org/api/people/2800/","name":"Florian Fainelli","email":"f.fainelli@gmail.com"},"content":"On September 19, 2017 7:19:35 AM PDT, Vivien Didelot <vivien.didelot@savoirfairelinux.com> wrote:\n>Hi David,\n>\n>David Laight <David.Laight@ACULAB.COM> writes:\n>\n>> From: Florian Fainelli\n>>> Sent: 18 September 2017 22:41\n>>> Instead of repeating the same pattern: acquire mutex, read/write,\n>release\n>>> mutex, define a macro: b53_build_op() which takes the type\n>(read|write), I/O\n>>> size, and value (scalar or pointer). This helps with fixing bugs\n>that could\n>>> exit (e.g: missing barrier, lock etc.).\n>> ....\n>>> +#define b53_build_op(type, op_size, val_type)\t\\\n>>> +static inline int b53_##type##op_size(struct b53_device *dev, u8\n>page,\t\t\\\n>>> +\t\t\t\t      u8 reg, val_type val)\t\t\t\\\n>>> +{\t\t\t\t\t\t\t\t\t\t\\\n>>> +\tint ret;\t\t\t\t\t\t\t\t\\\n>>> +\t\t\t\t\t\t\t\t\t\t\\\n>>> +\tmutex_lock(&dev->reg_mutex);\t\t\t\t\t\t\\\n>>> +\tret = dev->ops->type##op_size(dev, page, reg, val);\t\t\t\\\n>>> +\tmutex_unlock(&dev->reg_mutex);\t\t\t\t\t\t\\\n>>> +\t\t\t\t\t\t\t\t\t\t\\\n>>> +\treturn ret;\t\t\t\t\t\t\t\t\\\n>>>  }\n>>\n>> Why separate the 'type' and 'op_size' arguments since they\n>> are always pasted together?\n>\n>For read/write48, the value type is u64.\n\nThe way I read David's comment is that instead of calling the macro with read, 48, just combine that in a single argument: read48. I don't have a preference about that and can respin eventually.","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"abElmPq0\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxQHv1xjSz9s7h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 00:29:47 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751353AbdISO3o (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 19 Sep 2017 10:29:44 -0400","from mail-io0-f195.google.com ([209.85.223.195]:37260 \"EHLO\n\tmail-io0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750948AbdISO3n (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 19 Sep 2017 10:29:43 -0400","by mail-io0-f195.google.com with SMTP id 93so5061204iol.4\n\tfor <netdev@vger.kernel.org>; Tue, 19 Sep 2017 07:29:43 -0700 (PDT)","from ?IPv6:2001:470:d:73f:486a:8c86:5312:d581?\n\t([2001:470:d:73f:486a:8c86:5312:d581])\n\tby smtp.gmail.com with ESMTPSA id\n\tv75sm3633163oia.57.2017.09.19.07.29.41\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 07:29:41 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=date:user-agent:in-reply-to:references:mime-version\n\t:content-transfer-encoding:subject:to:cc:from:message-id;\n\tbh=H3cbzAqhqPcxi94FYThGoTOEbZ8IeCIWTYeBsrikNto=;\n\tb=abElmPq0Qvbm9puTuJhfJVoQGeKvnrbmhPv7T6ePN2yWIb3xMhbum2TBDUI3enXF6p\n\tB0cccNNFffA09pDBLqkri7cSdGRWhfLNctMp1+sHFuE94m2HZXdVsdhPdu6DfyHVzh21\n\t+YTgznr9bezZwY89lth0HwsO+XIoNA1bhKISWARhJPlIeGF4Z+P0BR8d3JHOa0+7slfp\n\tTjrRg4Yzu4QyfKyZ05YagdWmHkRS6u65YB9spYolbKBLZ9kokWV3H3CPwHAmJxUec2/E\n\tNI4ly5lQOfksY6jQysTnUGWkTNjXC3ikkL8ZZkS8nyxDzAde+VKfzbKY+5s2SuzadxbO\n\tonLA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:user-agent:in-reply-to:references\n\t:mime-version:content-transfer-encoding:subject:to:cc:from\n\t:message-id;\n\tbh=H3cbzAqhqPcxi94FYThGoTOEbZ8IeCIWTYeBsrikNto=;\n\tb=uIHZcrxim7+lW5nqyCHF4eARnlPht+BvNxYMJcP9ch17HI+1Mq5nKUrGUtu11eQxKe\n\t13aIBW+04aavl4FEqD5HJ/L2ju7ZjNxJVwvg/K5QdlqtLbPbU+Kw/ilSExymdCx9AwQg\n\tGWF8juVqq1wFln2yuNMQpiiDNcMwY+R6uCj5pxYv/86SiJb11U4WPsMtkSUjJhmVRbge\n\tNpt78yzr6n5Dvpm7KHUk5jVeLgINht8MwqqCitFe0l7jNYOnKSOAG7APY3m9X5mfe5TR\n\tIZB4kGxiLF/XV2KnFzr/qxuQBqBkpf/TDtTD9FOK4Q1lsAHdpcY8F2/RFYNPy7asPSzi\n\tkQfw==","X-Gm-Message-State":"AHPjjUjltfc+OhZ2jJ86h7i6mhOWAzOEaMDnhX/wA0PjQOIsftrdKAEX\n\topiS/hAJNKs6p0xvlH2iNVK0ozAs","X-Google-Smtp-Source":"AOwi7QAo0639c4TI8Z4cK3gy80KILmz7oWAODV7fZ7jZCx2PTLz9ux4d6G8NEQ89LbWLnFzy2lUHDA==","X-Received":"by 10.202.180.84 with SMTP id d81mr1636324oif.15.1505831382815; \n\tTue, 19 Sep 2017 07:29:42 -0700 (PDT)","Date":"Tue, 19 Sep 2017 07:29:38 -0700","User-Agent":"K-9 Mail for Android","In-Reply-To":"<87tvzy93ew.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","References":"<20170918214128.27896-1-f.fainelli@gmail.com>\n\t<20170918214128.27896-6-f.fainelli@gmail.com>\n\t<063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>\n\t<87tvzy93ew.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","MIME-Version":"1.0","Content-Type":"text/plain;\n charset=utf-8","Content-Transfer-Encoding":"quoted-printable","Subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","To":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>,\n\tDavid Laight <David.Laight@ACULAB.COM>,\n\t\"netdev@vger.kernel.org\" <netdev@vger.kernel.org>","CC":"\"davem@davemloft.net\" <davem@davemloft.net>,\n\t\"andrew@lunn.ch\" <andrew@lunn.ch>","From":"Florian Fainelli <f.fainelli@gmail.com>","Message-ID":"<12153E6A-CB96-4EED-91CE-05604B640927@gmail.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1771192,"web_url":"http://patchwork.ozlabs.org/comment/1771192/","msgid":"<063D6719AE5E284EB5DD2968C1650D6DD007A2E6@AcuExch.aculab.com>","list_archive_url":null,"date":"2017-09-19T16:14:23","subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","submitter":{"id":6689,"url":"http://patchwork.ozlabs.org/api/people/6689/","name":"David Laight","email":"David.Laight@ACULAB.COM"},"content":"> >>> +#define b53_build_op(type, op_size, val_type)\t\\\r\n> >>> +static inline int b53_##type##op_size(struct b53_device *dev, u8\r\n> >page,\t\t\\\r\n> >>> +\t\t\t\t      u8 reg, val_type val)\t\t\t\\\r\n> >>> +{\t\t\t\t\t\t\t\t\t\t\\\r\n> >>> +\tint ret;\t\t\t\t\t\t\t\t\\\r\n> >>> +\t\t\t\t\t\t\t\t\t\t\\\r\n> >>> +\tmutex_lock(&dev->reg_mutex);\t\t\t\t\t\t\\\r\n> >>> +\tret = dev->ops->type##op_size(dev, page, reg, val);\t\t\t\\\r\n> >>> +\tmutex_unlock(&dev->reg_mutex);\t\t\t\t\t\t\\\r\n> >>> +\t\t\t\t\t\t\t\t\t\t\\\r\n> >>> +\treturn ret;\t\t\t\t\t\t\t\t\\\r\n> >>>  }\r\n> >>\r\n> >> Why separate the 'type' and 'op_size' arguments since they\r\n> >> are always pasted together?\r\n> >\r\n> >For read/write48, the value type is u64.\r\n> \r\n> The way I read David's comment is that instead of calling the macro with read, 48, just combine that\r\n> in a single argument: read48. I don't have a preference about that and can respin eventually.\r\n\r\nIndeed, factoring in the type is harder because reads want 'u64 *' not 'u64'.\r\nWhile that could be factored, it would take more source lines and make\r\nthings very obfuscated.\r\n\r\n\tDavid","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxScr5vJrz9rvt\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 02:14:36 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751506AbdISQOe (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 19 Sep 2017 12:14:34 -0400","from smtp-out4.electric.net ([192.162.216.194]:56029 \"EHLO\n\tsmtp-out4.electric.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750972AbdISQOd (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 19 Sep 2017 12:14:33 -0400","from 1duLAE-0003WX-Uz by out4a.electric.net with emc1-ok (Exim\n\t4.87) (envelope-from <David.Laight@ACULAB.COM>)\n\tid 1duLAG-0003hf-Ve; Tue, 19 Sep 2017 09:14:24 -0700","by emcmailer; Tue, 19 Sep 2017 09:14:24 -0700","from [156.67.243.126] (helo=AcuExch.aculab.com)\n\tby out4a.electric.net with esmtps (TLSv1:AES128-SHA:128)\n\t(Exim 4.87) (envelope-from <David.Laight@ACULAB.COM>)\n\tid 1duLAE-0003WX-Uz; Tue, 19 Sep 2017 09:14:22 -0700","from ACUEXCH.Aculab.com ([::1]) by AcuExch.aculab.com ([::1]) with\n\tmapi id 14.03.0123.003; Tue, 19 Sep 2017 17:14:23 +0100"],"From":"David Laight <David.Laight@ACULAB.COM>","To":"'Florian Fainelli' <f.fainelli@gmail.com>,\n\tVivien Didelot <vivien.didelot@savoirfairelinux.com>,\n\t\"netdev@vger.kernel.org\" <netdev@vger.kernel.org>","CC":"\"davem@davemloft.net\" <davem@davemloft.net>,\n\t\"andrew@lunn.ch\" <andrew@lunn.ch>","Subject":"RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations","Thread-Topic":"[PATCH net-next 05/12] net: dsa: b53: Use a macro to define\n\tI/O operations","Thread-Index":"AQHTMMcS0SFE3rMzSEqD+9k6WIZjW6K8Km2QgAAbhjOAABx0IA==","Date":"Tue, 19 Sep 2017 16:14:23 +0000","Message-ID":"<063D6719AE5E284EB5DD2968C1650D6DD007A2E6@AcuExch.aculab.com>","References":"<20170918214128.27896-1-f.fainelli@gmail.com>\n\t<20170918214128.27896-6-f.fainelli@gmail.com>\n\t<063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>\n\t<87tvzy93ew.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>\n\t<12153E6A-CB96-4EED-91CE-05604B640927@gmail.com>","In-Reply-To":"<12153E6A-CB96-4EED-91CE-05604B640927@gmail.com>","Accept-Language":"en-GB, en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","x-originating-ip":"[10.202.99.200]","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","MIME-Version":"1.0","X-Outbound-IP":"156.67.243.126","X-Env-From":"David.Laight@ACULAB.COM","X-Proto":"esmtps","X-Revdns":"","X-HELO":"AcuExch.aculab.com","X-TLS":"TLSv1:AES128-SHA:128","X-Authenticated_ID":"","X-PolicySMART":"3396946, 3397078","X-Virus-Status":["Scanned by VirusSMART (c)","Scanned by VirusSMART (s)"],"Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}}]