[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181219100532.GA2066@nanopsycho>
Date: Wed, 19 Dec 2018 11:05:32 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Tristram.Ha@...rochip.com
Cc: Sergio Paracuellos <sergio.paracuellos@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Pavel Machek <pavel@....cz>, Marek Vasut <marex@...x.de>,
Dan Carpenter <dan.carpenter@...cle.com>,
vivien.didelot@...oirfairelinux.com, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org
Subject: Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver
Wed, Dec 19, 2018 at 04:41:37AM CET, Tristram.Ha@...rochip.com wrote:
>From: Tristram Ha <Tristram.Ha@...rochip.com>
>
>Add KSZ9477 I2C driver support. The code ksz9477.c and ksz_common.c are
>used together to generate the I2C driver.
>
>Signed-off-by: Tristram Ha <Tristram.Ha@...rochip.com>
>diff --git a/drivers/net/dsa/microchip/ksz_i2c.h b/drivers/net/dsa/microchip/ksz_i2c.h
>new file mode 100644
>index 0000000..b9af0a8
>--- /dev/null
>+++ b/drivers/net/dsa/microchip/ksz_i2c.h
>@@ -0,0 +1,69 @@
>+/* SPDX-License-Identifier: GPL-2.0
>+ * Microchip KSZ series I2C access common header
>+ *
>+ * Copyright (C) 2018 Microchip Technology Inc.
>+ * Tristram Ha <Tristram.Ha@...rochip.com>
>+ */
>+
>+#ifndef __KSZ_I2C_H
>+#define __KSZ_I2C_H
>+
>+/* Chip dependent I2C access */
>+static int ksz_i2c_read(struct ksz_device *dev, u32 reg, u8 *data,
>+ unsigned int len);
>+static int ksz_i2c_write(struct ksz_device *dev, u32 reg, void *data,
>+ unsigned int len);
>+
>+static int ksz_i2c_read8(struct ksz_device *dev, u32 reg, u8 *val)
>+{
>+ return ksz_i2c_read(dev, reg, val, 1);
>+}
>+
>+static int ksz_i2c_read16(struct ksz_device *dev, u32 reg, u16 *val)
>+{
>+ int ret = ksz_i2c_read(dev, reg, (u8 *)val, 2);
>+
>+ if (!ret)
>+ *val = be16_to_cpu(*val);
>+
>+ return ret;
>+}
>+
>+static int ksz_i2c_read32(struct ksz_device *dev, u32 reg, u32 *val)
>+{
>+ int ret = ksz_i2c_read(dev, reg, (u8 *)val, 4);
>+
>+ if (!ret)
>+ *val = be32_to_cpu(*val);
>+
>+ return ret;
>+}
>+
>+static int ksz_i2c_write8(struct ksz_device *dev, u32 reg, u8 value)
>+{
>+ return ksz_i2c_write(dev, reg, &value, 1);
>+}
>+
>+static int ksz_i2c_write16(struct ksz_device *dev, u32 reg, u16 value)
>+{
>+ value = cpu_to_be16(value);
>+ return ksz_i2c_write(dev, reg, &value, 2);
>+}
>+
>+static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value)
>+{
>+ value = cpu_to_be32(value);
>+ return ksz_i2c_write(dev, reg, &value, 4);
>+}
>+
>+static int ksz_i2c_get(struct ksz_device *dev, u32 reg, void *data, size_t len)
>+{
>+ return ksz_i2c_read(dev, reg, data, len);
>+}
>+
>+static int ksz_i2c_set(struct ksz_device *dev, u32 reg, void *data, size_t len)
>+{
>+ return ksz_i2c_write(dev, reg, data, len);
>+}
This header file makes no sense. Please move the functions into .c
>+
>+#endif
>--
>1.9.1
>
Powered by blists - more mailing lists