Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/815759/?format=api
{ "id": 815759, "url": "http://patchwork.ozlabs.org/api/patches/815759/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170919174654.2122-6-f.fainelli@gmail.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170919174654.2122-6-f.fainelli@gmail.com>", "list_archive_url": null, "date": "2017-09-19T17:46:47", "name": "[net-next,v3,05/12] net: dsa: b53: Use a macro to define I/O operations", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "46075814dcce1bf13f0b861e71100ea4da15ba26", "submitter": { "id": 2800, "url": "http://patchwork.ozlabs.org/api/people/2800/?format=api", "name": "Florian Fainelli", "email": "f.fainelli@gmail.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170919174654.2122-6-f.fainelli@gmail.com/mbox/", "series": [ { "id": 3941, "url": "http://patchwork.ozlabs.org/api/series/3941/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=3941", "date": "2017-09-19T17:46:42", "name": "net: dsa: b53/bcm_sf2 cleanups", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/3941/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/815759/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/815759/checks/", "tags": {}, "related": [], "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; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"iSgoYKVi\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxVhd2X3hz9rvt\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 03:48:01 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751580AbdISRr7 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 19 Sep 2017 13:47:59 -0400", "from mail-wm0-f66.google.com ([74.125.82.66]:33476 \"EHLO\n\tmail-wm0-f66.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751804AbdISRrQ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 19 Sep 2017 13:47:16 -0400", "by mail-wm0-f66.google.com with SMTP id m127so325530wmm.0\n\tfor <netdev@vger.kernel.org>; Tue, 19 Sep 2017 10:47:15 -0700 (PDT)", "from fainelli-desktop.broadcom.com ([192.19.255.250])\n\tby smtp.gmail.com with ESMTPSA id\n\tq19sm11543124wrb.17.2017.09.19.10.47.12\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 10:47:14 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=ZWcvBn5C2IzoSjdOtgu0IH0e44F9wLq51uLX0Y8QLjs=;\n\tb=iSgoYKViECd0u2LxGwrtew8z6beRmYfHHxrswmCzvpI6r/8h9Q6QIsiD/m2iSad6fd\n\t4E6O0P3kJI03MzOaOnXs+wO5o1Zh8MchOhP69peVmAsXdAcD1r7TFfsn5fV/sBODpuaN\n\trH9u4zklPu1kN7BPXg7DF83QK3ynEENHpg8QLMjfLMZEErvhuKi7EL8IqzfRptBt/JKn\n\tDLjoBm5hjqVVaAsHInbdwpgtkpvkwmei80XGqD2NamwGk/MJdGJoclSLOaxbJqpVv/NE\n\tf9vVHFL4SpwyrZoWcNQK4hWGONZbKqxm/eszHDhV3MORbI/X85bM8sbWL3ZzilS7sYfy\n\tdLjw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=ZWcvBn5C2IzoSjdOtgu0IH0e44F9wLq51uLX0Y8QLjs=;\n\tb=s3JFVYSJVNLyS87T0Os8qTTBVkXQTp6N6FXEzc8dcSZ6oOsKYilVhmzk7PwUg5gdSe\n\t6RFwlK+s8J/+0mbOeRLwzNvWI2KNP44u1dX6z6Ve4K4X015HhZVkk0vzmhfmfRZsWc+G\n\t+wICnVv2GX5+lc2lBUqPp+j/TqfMdY1+jWF+cVdOEOeoQ+2+9xgBJB/KMZ/ZLWX0Gbil\n\t3UK4BMhz0HBtxSdVyonKESF+2y9DCts84vmQARKRR+ju1VIPUiL2Aedxy98hQCCO0zcS\n\t5Y52Xp6upWR6HQEnW/SaWSOtUF7inNjaA51kXX2UORG+027ikpZz/kB3L2gFXVvM0jEI\n\tAl9Q==", "X-Gm-Message-State": "AHPjjUjaY9a/VySQlcrP4e6hX1kcn8/OEqi2ASJ7sLTBRPJYW7UuiauT\n\tYTEQPsByIrx6HirAp+5E2CmDw+17", "X-Google-Smtp-Source": "AOwi7QC40e806AzAd2VHaIY7/edZ7jWjYtJCSK33D3V715uxyVrmGbNGRxjYOWsRo2Yh5xxodxErnw==", "X-Received": "by 10.28.212.148 with SMTP id l142mr1562134wmg.99.1505843235040; \n\tTue, 19 Sep 2017 10:47:15 -0700 (PDT)", "From": "Florian Fainelli <f.fainelli@gmail.com>", "To": "netdev@vger.kernel.org", "Cc": "davem@davemloft.net, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,\n\tFlorian Fainelli <f.fainelli@gmail.com>", "Subject": "[PATCH net-next v3 05/12] net: dsa: b53: Use a macro to define I/O\n\toperations", "Date": "Tue, 19 Sep 2017 10:46:47 -0700", "Message-Id": "<20170919174654.2122-6-f.fainelli@gmail.com>", "X-Mailer": "git-send-email 2.9.3", "In-Reply-To": "<20170919174654.2122-1-f.fainelli@gmail.com>", "References": "<20170919174654.2122-1-f.fainelli@gmail.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Instead of repeating the same pattern: acquire mutex, read/write,\nrelease mutex, define a macro: b53_build_op() which takes the type\n(read|write), I/O size, and value (scalar or pointer). This helps with\nfixing bugs that could exist (e.g: missing barrier, lock etc.).\n\nReviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\nSigned-off-by: Florian Fainelli <f.fainelli@gmail.com>\n---\n drivers/net/dsa/b53/b53_priv.h | 133 +++++++----------------------------------\n 1 file changed, 22 insertions(+), 111 deletions(-)", "diff": "diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h\nindex 7528b22aeb03..5bebe97900e8 100644\n--- a/drivers/net/dsa/b53/b53_priv.h\n+++ b/drivers/net/dsa/b53/b53_priv.h\n@@ -199,119 +199,30 @@ static inline void b53_switch_remove(struct b53_device *dev)\n \tdsa_unregister_switch(dev->ds);\n }\n \n-static inline int b53_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->read8(dev, page, reg, val);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->read16(dev, page, reg, val);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->read32(dev, page, reg, val);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->read48(dev, page, reg, val);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n+#define b53_build_op(type_op_size, val_type)\t\t\t\t\\\n+static inline int b53_##type_op_size(struct b53_device *dev, u8 page,\t\\\n+\t\t\t\t u8 reg, val_type val)\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\tint ret;\t\t\t\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\tmutex_lock(&dev->reg_mutex);\t\t\t\t\t\\\n+\tret = dev->ops->type_op_size(dev, page, reg, val);\t\t\\\n+\tmutex_unlock(&dev->reg_mutex);\t\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\treturn ret;\t\t\t\t\t\t\t\\\n }\n \n-static inline int b53_read64(struct b53_device *dev, u8 page, u8 reg, u64 *val)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->read64(dev, page, reg, val);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_write8(struct b53_device *dev, u8 page, u8 reg, u8 value)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->write8(dev, page, reg, value);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_write16(struct b53_device *dev, u8 page, u8 reg,\n-\t\t\t u16 value)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->write16(dev, page, reg, value);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_write32(struct b53_device *dev, u8 page, u8 reg,\n-\t\t\t u32 value)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->write32(dev, page, reg, value);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_write48(struct b53_device *dev, u8 page, u8 reg,\n-\t\t\t u64 value)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->write48(dev, page, reg, value);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n-\n-static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg,\n-\t\t\t u64 value)\n-{\n-\tint ret;\n-\n-\tmutex_lock(&dev->reg_mutex);\n-\tret = dev->ops->write64(dev, page, reg, value);\n-\tmutex_unlock(&dev->reg_mutex);\n-\n-\treturn ret;\n-}\n+b53_build_op(read8, u8 *);\n+b53_build_op(read16, u16 *);\n+b53_build_op(read32, u32 *);\n+b53_build_op(read48, u64 *);\n+b53_build_op(read64, u64 *);\n+\n+b53_build_op(write8, u8);\n+b53_build_op(write16, u16);\n+b53_build_op(write32, u32);\n+b53_build_op(write48, u64);\n+b53_build_op(write64, u64);\n \n struct b53_arl_entry {\n \tu8 port;\n", "prefixes": [ "net-next", "v3", "05/12" ] }