summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/via/via_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/fbdev/via/via_i2c.c')
-rw-r--r--drivers/video/fbdev/via/via_i2c.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/drivers/video/fbdev/via/via_i2c.c b/drivers/video/fbdev/via/via_i2c.c
index dd53058bbbb7..42c378425586 100644
--- a/drivers/video/fbdev/via/via_i2c.c
+++ b/drivers/video/fbdev/via/via_i2c.c
@@ -1,26 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation;
- * either version 2, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE.See the GNU General Public License
- * for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/platform_device.h>
#include <linux/delay.h>
+#include <linux/export.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#include <linux/via-core.h>
@@ -118,7 +105,7 @@ static void via_i2c_setsda(void *data, int state)
spin_unlock_irqrestore(&i2c_vdev->reg_lock, flags);
}
-int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
+int viafb_i2c_readbyte(u8 adap, u8 target_addr, u8 index, u8 *pdata)
{
int ret;
u8 mm1[] = {0x00};
@@ -129,7 +116,7 @@ int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
*pdata = 0;
msgs[0].flags = 0;
msgs[1].flags = I2C_M_RD;
- msgs[0].addr = msgs[1].addr = slave_addr / 2;
+ msgs[0].addr = msgs[1].addr = target_addr / 2;
mm1[0] = index;
msgs[0].len = 1; msgs[1].len = 1;
msgs[0].buf = mm1; msgs[1].buf = pdata;
@@ -142,7 +129,7 @@ int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
return ret;
}
-int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
+int viafb_i2c_writebyte(u8 adap, u8 target_addr, u8 index, u8 data)
{
int ret;
u8 msg[2] = { index, data };
@@ -151,7 +138,7 @@ int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
if (!via_i2c_par[adap].is_active)
return -ENODEV;
msgs.flags = 0;
- msgs.addr = slave_addr / 2;
+ msgs.addr = target_addr / 2;
msgs.len = 2;
msgs.buf = msg;
ret = i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1);
@@ -163,7 +150,7 @@ int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
return ret;
}
-int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len)
+int viafb_i2c_readbytes(u8 adap, u8 target_addr, u8 index, u8 *buff, int buff_len)
{
int ret;
u8 mm1[] = {0x00};
@@ -173,7 +160,7 @@ int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len
return -ENODEV;
msgs[0].flags = 0;
msgs[1].flags = I2C_M_RD;
- msgs[0].addr = msgs[1].addr = slave_addr / 2;
+ msgs[0].addr = msgs[1].addr = target_addr / 2;
mm1[0] = index;
msgs[0].len = 1; msgs[1].len = buff_len;
msgs[0].buf = mm1; msgs[1].buf = buff;
@@ -215,7 +202,6 @@ static int create_i2c_bus(struct i2c_adapter *adapter,
sprintf(adapter->name, "viafb i2c io_port idx 0x%02x",
adap_cfg->ioport_index);
adapter->owner = THIS_MODULE;
- adapter->class = I2C_CLASS_DDC;
adapter->algo_data = algo;
if (pdev)
adapter->dev.parent = &pdev->dev;
@@ -260,7 +246,7 @@ static int viafb_i2c_probe(struct platform_device *platdev)
return 0;
}
-static int viafb_i2c_remove(struct platform_device *platdev)
+static void viafb_i2c_remove(struct platform_device *platdev)
{
int i;
@@ -273,7 +259,6 @@ static int viafb_i2c_remove(struct platform_device *platdev)
if (i2c_stuff->is_active)
i2c_del_adapter(&i2c_stuff->adapter);
}
- return 0;
}
static struct platform_driver via_i2c_driver = {