From: Wolfram Sang <wsa@the-dreams.de>
To: linux-i2c@vger.kernel.org
Cc: linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
Simon Horman <horms@verge.net.au>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Wolfram Sang <wsa@the-dreams.de>,
Andrey Danin <danindrey@mail.ru>,
linux-tegra@vger.kernel.org
Subject: [RFC 5/9] i2c: rename address check functions
Date: Fri, 17 Jul 2015 16:08:25 +0200 [thread overview]
Message-ID: <1437142109-31975-6-git-send-email-wsa@the-dreams.de> (raw)
In-Reply-To: <1437142109-31975-1-git-send-email-wsa@the-dreams.de>
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
The current naming is based on the arguments of the functions and not on
what they do. Even I as the maintainer find this confusing, so let's
rename them to something more descriptive.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/i2c/i2c-core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a807e272e1fc2e..b54a0f092d53f6 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -793,7 +793,7 @@ static unsigned short i2c_encode_flags_to_addr(struct i2c_client *client)
/* This is a permissive address validity check, I2C address map constraints
* are purposely not enforced, except for the general call address. */
-static int i2c_check_client_addr_validity(const struct i2c_client *client)
+static int i2c_check_addr_validity(const struct i2c_client *client)
{
if (client->flags & I2C_CLIENT_TEN) {
/* 10-bit address, all values are valid */
@@ -811,7 +811,7 @@ static int i2c_check_client_addr_validity(const struct i2c_client *client)
* device uses a reserved address, then it shouldn't be probed. 7-bit
* addressing is assumed, 10-bit address devices are rare and should be
* explicitly enumerated. */
-static int i2c_check_addr_validity(unsigned short addr)
+static int i2c_check_7bit_addr_validity_strict(unsigned short addr)
{
/*
* Reserved addresses per I2C specification:
@@ -980,7 +980,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
strlcpy(client->name, info->type, sizeof(client->name));
/* Check for address validity */
- status = i2c_check_client_addr_validity(client);
+ status = i2c_check_addr_validity(client);
if (status) {
dev_err(&adap->dev, "Invalid %d-bit I2C address 0x%02hx\n",
client->flags & I2C_CLIENT_TEN ? 10 : 7, client->addr);
@@ -2265,7 +2265,7 @@ static int i2c_detect_address(struct i2c_client *temp_client,
int err;
/* Make sure the address is valid */
- err = i2c_check_addr_validity(addr);
+ err = i2c_check_7bit_addr_validity_strict(addr);
if (err) {
dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
addr);
@@ -2382,7 +2382,7 @@ i2c_new_probed_device(struct i2c_adapter *adap,
for (i = 0; addr_list[i] != I2C_CLIENT_END; i++) {
/* Check address validity */
- if (i2c_check_addr_validity(addr_list[i]) < 0) {
+ if (i2c_check_7bit_addr_validity_strict(addr_list[i]) < 0) {
dev_warn(&adap->dev, "Invalid 7-bit address "
"0x%02x\n", addr_list[i]);
continue;
@@ -2957,7 +2957,7 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
if (!(client->flags & I2C_CLIENT_TEN)) {
/* Enforce stricter address checking */
- ret = i2c_check_addr_validity(client->addr);
+ ret = i2c_check_7bit_addr_validity_strict(client->addr);
if (ret) {
dev_err(&client->dev, "%s: invalid address\n", __func__);
return ret;
--
2.1.4
next prev parent reply other threads:[~2015-07-17 14:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 14:08 [RFC 0/9] i2c: slave: improve i2c client address spaces and their DT support Wolfram Sang
2015-07-17 14:08 ` [RFC 4/9] i2c: apply address offset for slaves, too Wolfram Sang
2015-07-17 14:08 ` Wolfram Sang [this message]
[not found] ` <1437142109-31975-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-07-17 14:08 ` [RFC 1/9] i2c: tegra: implement slave mode Wolfram Sang
2015-07-17 14:08 ` [RFC 2/9] dt-bindings: add header for generic I2C flags in bindings Wolfram Sang
2015-07-17 14:08 ` [RFC 3/9] i2c: add a flag to mark clients as slaves Wolfram Sang
2015-07-17 14:08 ` [RFC 6/9] i2c: make address check indpendent from client struct Wolfram Sang
2015-07-17 14:08 ` [RFC 8/9] i2c: take address space into account when checking for used addresses Wolfram Sang
2015-07-17 14:08 ` [RFC 9/9] dts: tegra: WIP: hack dts to test new dt flags for i2c Wolfram Sang
2015-07-17 14:11 ` Wolfram Sang
2015-07-20 7:28 ` Andrey Danin
2015-07-20 9:03 ` Wolfram Sang
[not found] ` <1437142109-31975-10-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-07-20 7:53 ` Laurent Pinchart
2015-07-20 8:45 ` Wolfram Sang
2015-07-20 16:10 ` Rob Herring
2015-07-20 22:09 ` Stephen Warren
[not found] ` <55AD71A6.4030105-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-07-21 6:55 ` Wolfram Sang
2015-07-20 22:13 ` [RFC 0/9] i2c: slave: improve i2c client address spaces and their DT support Stephen Warren
[not found] ` <55AD7279.5090203-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-07-21 7:00 ` Wolfram Sang
2015-07-17 14:08 ` [RFC 7/9] i2c: apply DT flags when probing Wolfram Sang
2015-07-20 7:23 ` [RFC 0/9] i2c: slave: improve i2c client address spaces and their DT support Andrey Danin
[not found] ` <55ACA1D8.6010403-JGs/UdohzUI@public.gmane.org>
2015-07-20 8:52 ` Wolfram Sang
2015-07-20 8:59 ` Andrey Danin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437142109-31975-6-git-send-email-wsa@the-dreams.de \
--to=wsa@the-dreams.de \
--cc=danindrey@mail.ru \
--cc=geert@linux-m68k.org \
--cc=horms@verge.net.au \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).