summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-01-28 22:55:39 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2019-01-29 09:27:04 +0100
commit5c9408572406c8718a35931ecf74a5cf38632914 (patch)
treecfcbe96996cb41a46334cf76f6d51d48a694397f
parent0c2431b5a15ca03e20ce3c698b8b708181db5fd9 (diff)
downloadbarebox-5c9408572406c8718a35931ecf74a5cf38632914.tar.gz
barebox-5c9408572406c8718a35931ecf74a5cf38632914.tar.xz
devfs: Drop dev_lseek_default()
Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-mxs/ocotp.c1
-rw-r--r--arch/sandbox/board/hostfile.c1
-rw-r--r--commands/stddev.c4
-rw-r--r--common/block.c1
-rw-r--r--drivers/base/regmap/regmap.c1
-rw-r--r--drivers/eeprom/at24.c1
-rw-r--r--drivers/eeprom/at25.c1
-rw-r--r--drivers/hw_random/core.c1
-rw-r--r--drivers/mfd/act8846.c1
-rw-r--r--drivers/mfd/lp3972.c1
-rw-r--r--drivers/mfd/mc34704.c1
-rw-r--r--drivers/mfd/mc9sdz60.c1
-rw-r--r--drivers/mfd/stmpe-i2c.c1
-rw-r--r--drivers/mfd/twl-core.c1
-rw-r--r--drivers/misc/sram.c1
-rw-r--r--drivers/mtd/core.c1
-rw-r--r--drivers/mtd/mtdoob.c1
-rw-r--r--drivers/mtd/mtdraw.c1
-rw-r--r--drivers/net/e1000/eeprom.c2
-rw-r--r--drivers/net/ksz8864rmn.c1
-rw-r--r--drivers/net/phy/mdio_bus.c1
-rw-r--r--drivers/nvmem/core.c1
-rw-r--r--drivers/video/fb.c1
-rw-r--r--drivers/w1/slaves/w1_ds2431.c1
-rw-r--r--drivers/w1/slaves/w1_ds2433.c1
-rw-r--r--fs/devfs-core.c1
-rw-r--r--fs/devfs.c2
-rw-r--r--include/driver.h5
28 files changed, 0 insertions, 37 deletions
diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c
index 01db731166..f230d9ad89 100644
--- a/arch/arm/mach-mxs/ocotp.c
+++ b/arch/arm/mach-mxs/ocotp.c
@@ -174,7 +174,6 @@ free_mem:
static struct cdev_operations mxs_ocotp_ops = {
.read = mxs_ocotp_cdev_read,
- .lseek = dev_lseek_default,
};
static int mxs_ocotp_probe(struct device_d *dev)
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 3fc1503799..745f078d1a 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -67,7 +67,6 @@ static void hf_info(struct device_d *dev)
static struct cdev_operations hf_fops = {
.read = hf_read,
.write = hf_write,
- .lseek = dev_lseek_default,
};
static int hf_probe(struct device_d *dev)
diff --git a/commands/stddev.c b/commands/stddev.c
index 4d1b6f5108..2b3d084c83 100644
--- a/commands/stddev.c
+++ b/commands/stddev.c
@@ -27,7 +27,6 @@ static ssize_t zero_read(struct cdev *cdev, void *buf, size_t count, loff_t offs
static struct cdev_operations zeroops = {
.read = zero_read,
- .lseek = dev_lseek_default,
};
static int zero_init(void)
@@ -55,7 +54,6 @@ static ssize_t full_read(struct cdev *cdev, void *buf, size_t count, loff_t offs
static struct cdev_operations fullops = {
.read = full_read,
- .lseek = dev_lseek_default,
};
static int full_init(void)
@@ -82,7 +80,6 @@ static ssize_t null_write(struct cdev *cdev, const void *buf, size_t count, loff
static struct cdev_operations nullops = {
.write = null_write,
- .lseek = dev_lseek_default,
};
static int null_init(void)
@@ -110,7 +107,6 @@ static ssize_t prng_read(struct cdev *cdev, void *buf, size_t count, loff_t offs
static struct cdev_operations prngops = {
.read = prng_read,
- .lseek = dev_lseek_default,
};
static int prng_init(void)
diff --git a/common/block.c b/common/block.c
index 8d0de42d90..d90c98948c 100644
--- a/common/block.c
+++ b/common/block.c
@@ -350,7 +350,6 @@ static struct cdev_operations block_ops = {
#endif
.close = block_op_close,
.flush = block_op_flush,
- .lseek = dev_lseek_default,
};
int blockdevice_register(struct block_device *blk)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 8bbc2373fc..d2f8ec70e4 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -353,7 +353,6 @@ static ssize_t regmap_cdev_write(struct cdev *cdev, const void *buf, size_t coun
}
static struct cdev_operations regmap_fops = {
- .lseek = dev_lseek_default,
.read = regmap_cdev_read,
.write = regmap_cdev_write,
};
diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index e79031a2d3..1fd4aeaba6 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -447,7 +447,6 @@ static int at24_probe(struct device_d *dev)
at24->cdev.priv = at24;
at24->cdev.dev = dev;
at24->cdev.ops = &at24->fops;
- at24->fops.lseek = dev_lseek_default;
at24->fops.read = at24_cdev_read,
at24->fops.protect = at24_cdev_protect,
at24->cdev.size = chip.byte_len;
diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index a9050d6c16..1c9ef12321 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -235,7 +235,6 @@ static ssize_t at25_ee_write(struct cdev *cdev,
static struct cdev_operations at25_fops = {
.read = at25_ee_read,
.write = at25_ee_write,
- .lseek = dev_lseek_default,
};
static int at25_np_to_chip(struct device_d *dev,
diff --git a/drivers/hw_random/core.c b/drivers/hw_random/core.c
index 1c68a379f7..ee3d5a52dd 100644
--- a/drivers/hw_random/core.c
+++ b/drivers/hw_random/core.c
@@ -63,7 +63,6 @@ static ssize_t rng_dev_read(struct cdev *cdev, void *buf, size_t size,
static struct cdev_operations rng_chrdev_ops = {
.read = rng_dev_read,
- .lseek = dev_lseek_default,
};
static int hwrng_register_cdev(struct hwrng *rng)
diff --git a/drivers/mfd/act8846.c b/drivers/mfd/act8846.c
index 53ab70f5cc..b7a64c739c 100644
--- a/drivers/mfd/act8846.c
+++ b/drivers/mfd/act8846.c
@@ -117,7 +117,6 @@ static ssize_t act8846_write(struct cdev *cdev, const void *_buf, size_t count,
}
static struct cdev_operations act8846_fops = {
- .lseek = dev_lseek_default,
.read = act8846_read,
.write = act8846_write,
};
diff --git a/drivers/mfd/lp3972.c b/drivers/mfd/lp3972.c
index 42b28070ad..3ae9d1ac64 100644
--- a/drivers/mfd/lp3972.c
+++ b/drivers/mfd/lp3972.c
@@ -70,7 +70,6 @@ static ssize_t lp_read(struct cdev *cdev, void *_buf, size_t count, loff_t offse
}
static struct cdev_operations lp_fops = {
- .lseek = dev_lseek_default,
.read = lp_read,
};
diff --git a/drivers/mfd/mc34704.c b/drivers/mfd/mc34704.c
index f15f37ef6e..4aa02b74ff 100644
--- a/drivers/mfd/mc34704.c
+++ b/drivers/mfd/mc34704.c
@@ -100,7 +100,6 @@ static ssize_t mc34704_write(struct cdev *cdev, const void *_buf, size_t count,
}
static struct cdev_operations mc34704_fops = {
- .lseek = dev_lseek_default,
.read = mc34704_read,
.write = mc34704_write,
};
diff --git a/drivers/mfd/mc9sdz60.c b/drivers/mfd/mc9sdz60.c
index 2cb38d9784..408d746450 100644
--- a/drivers/mfd/mc9sdz60.c
+++ b/drivers/mfd/mc9sdz60.c
@@ -112,7 +112,6 @@ static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, loff_
}
static struct cdev_operations mc_fops = {
- .lseek = dev_lseek_default,
.read = mc_read,
.write = mc_write,
};
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index 084e4b43bb..f140f1bbc4 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -101,7 +101,6 @@ static ssize_t stmpe_write(struct cdev *cdev, const void *_buf, size_t count, lo
}
static struct cdev_operations stmpe_fops = {
- .lseek = dev_lseek_default,
.read = stmpe_read,
.write = stmpe_write,
};
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index fb435f510f..c3240b8542 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -150,7 +150,6 @@ static ssize_t twl_write(struct cdev *cdev, const void *_buf, size_t count,
}
struct cdev_operations twl_fops = {
- .lseek = dev_lseek_default,
.read = twl_read,
.write = twl_write,
};
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index 27b4c681fd..053b35150c 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -29,7 +29,6 @@ static struct cdev_operations memops = {
.read = mem_read,
.write = mem_write,
.memmap = generic_memmap_rw,
- .lseek = dev_lseek_default,
};
static int sram_probe(struct device_d *dev)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index f44c6cfc69..881b5f4864 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -462,7 +462,6 @@ static struct cdev_operations mtd_ops = {
.protect = mtd_op_protect,
#endif
.ioctl = mtd_ioctl,
- .lseek = dev_lseek_default,
};
static int mtd_partition_set(struct param_d *p, void *priv)
diff --git a/drivers/mtd/mtdoob.c b/drivers/mtd/mtdoob.c
index ffaf9506f3..4aef844485 100644
--- a/drivers/mtd/mtdoob.c
+++ b/drivers/mtd/mtdoob.c
@@ -66,7 +66,6 @@ static ssize_t mtd_op_read_oob(struct cdev *cdev, void *buf, size_t count,
static struct cdev_operations mtd_ops_oob = {
.read = mtd_op_read_oob,
.ioctl = mtd_ioctl,
- .lseek = dev_lseek_default,
};
static int add_mtdoob_device(struct mtd_info *mtd, const char *devname, void **priv)
diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 6e36dc5337..f63da7b3b2 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -291,7 +291,6 @@ static const struct cdev_operations mtd_raw_fops = {
.read = mtdraw_read,
.write = mtdraw_write,
.erase = mtdraw_erase,
- .lseek = dev_lseek_default,
};
static int add_mtdraw_device(struct mtd_info *mtd, const char *devname, void **priv)
diff --git a/drivers/net/e1000/eeprom.c b/drivers/net/e1000/eeprom.c
index c0f2db552a..01f6addbc3 100644
--- a/drivers/net/e1000/eeprom.c
+++ b/drivers/net/e1000/eeprom.c
@@ -1325,7 +1325,6 @@ exit:
static struct cdev_operations e1000_invm_ops = {
.read = e1000_invm_cdev_read,
.write = e1000_invm_cdev_write,
- .lseek = dev_lseek_default,
};
static ssize_t e1000_eeprom_cdev_read(struct cdev *cdev, void *buf,
@@ -1350,7 +1349,6 @@ static ssize_t e1000_eeprom_cdev_read(struct cdev *cdev, void *buf,
static struct cdev_operations e1000_eeprom_ops = {
.read = e1000_eeprom_cdev_read,
- .lseek = dev_lseek_default,
};
static int e1000_mtd_read_or_write(bool read,
diff --git a/drivers/net/ksz8864rmn.c b/drivers/net/ksz8864rmn.c
index 4a19dd8734..85063ff0d8 100644
--- a/drivers/net/ksz8864rmn.c
+++ b/drivers/net/ksz8864rmn.c
@@ -113,7 +113,6 @@ static ssize_t micel_switch_write(struct cdev *cdev, const void *_buf, size_t co
static struct cdev_operations micrel_switch_ops = {
.read = micel_switch_read,
.write = micel_switch_write,
- .lseek = dev_lseek_default,
};
static int micrel_switch_probe(struct device_d *dev)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index e1dd8f0ae3..3480e2ffb4 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -392,7 +392,6 @@ static ssize_t phydev_write(struct cdev *cdev, const void *_buf, size_t count, l
static struct cdev_operations phydev_ops = {
.read = phydev_read,
.write = phydev_write,
- .lseek = dev_lseek_default,
};
static void of_set_phy_supported(struct phy_device *phydev)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 9fd599095c..6cf98f62af 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -85,7 +85,6 @@ static ssize_t nvmem_cdev_write(struct cdev *cdev, const void *buf, size_t count
static struct cdev_operations nvmem_chrdev_ops = {
.read = nvmem_cdev_read,
.write = nvmem_cdev_write,
- .lseek = dev_lseek_default,
};
static int nvmem_register_cdev(struct nvmem_device *nvmem, const char *name)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 72f33a6db6..2d82bc01fa 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -228,7 +228,6 @@ static struct cdev_operations fb_ops = {
.read = mem_read,
.write = mem_write,
.memmap = generic_memmap_rw,
- .lseek = dev_lseek_default,
.ioctl = fb_ioctl,
.close = fb_close,
.flush = fb_op_flush,
diff --git a/drivers/w1/slaves/w1_ds2431.c b/drivers/w1/slaves/w1_ds2431.c
index 13691d7bab..6446f4ba05 100644
--- a/drivers/w1/slaves/w1_ds2431.c
+++ b/drivers/w1/slaves/w1_ds2431.c
@@ -260,7 +260,6 @@ out_up:
static struct cdev_operations ds2431_ops = {
.read = ds2431_cdev_read,
.write = ds2431_cdev_write,
- .lseek = dev_lseek_default,
};
static int ds2431_probe(struct w1_device *dev)
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index f521a46a75..b24fb5b3b5 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -159,7 +159,6 @@ out_up:
static struct cdev_operations ds2433_ops = {
.read = ds2433_cdev_read,
.write = ds2433_cdev_write,
- .lseek = dev_lseek_default,
};
static int ds2433_cdev_create(struct w1_device *dev, int size, int id)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index f017e1c55d..522ef91752 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -459,7 +459,6 @@ static const struct cdev_operations loop_ops = {
.read = loop_read,
.write = loop_write,
.memmap = generic_memmap_rw,
- .lseek = dev_lseek_default,
};
struct cdev *cdev_create_loop(const char *path, ulong flags, loff_t offset)
diff --git a/fs/devfs.c b/fs/devfs.c
index 6acbbd7adb..5599f39e8c 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -66,8 +66,6 @@ static loff_t devfs_lseek(struct device_d *_dev, FILE *f, loff_t pos)
ret = cdev->ops->lseek(cdev, pos + cdev->offset);
if (ret < 0)
return ret;
- } else {
- return -ENOSYS;
}
return pos;
diff --git a/include/driver.h b/include/driver.h
index 7da184d3ab..bcb31afdc2 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -360,11 +360,6 @@ int dummy_probe(struct device_d *);
int generic_memmap_ro(struct cdev *dev, void **map, int flags);
int generic_memmap_rw(struct cdev *dev, void **map, int flags);
-static inline loff_t dev_lseek_default(struct cdev *cdev, loff_t ofs)
-{
- return ofs;
-}
-
static inline int dev_open_default(struct device_d *dev, struct filep *f)
{
return 0;