mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
rk: get rid of legacy 'get_ds()' function
According to commit 736706bee3 ("get rid of legacy 'get_ds()' function")
Every in-kernel use of this function defined it to KERNEL_DS (either as
an actual define, or as an inline function). It's an entirely
historical artifact, and long long long ago used to actually read the
segment selector valueof '%ds' on x86.
Which in the kernel is always KERNEL_DS.
Inspired by a patch from Jann Horn that just did this for a very small
subset of users (the ones in fs/), along with Al who suggested a script.
I then just took it to the logical extreme and removed all the remaining
gunk.
Roughly scripted with
git grep -l '(get_ds())' -- :^tools/ | xargs sed -i 's/(get_ds())/(KERNEL_DS)/'
git grep -lw 'get_ds' -- :^tools/ | xargs sed -i '/^#define get_ds()/d'
plus manual fixups to remove a few unusual usage patterns, the couple of
inline function cases and to fix up a comment that had become stale.
The 'get_ds()' function remains in an x86 kvm selftest, since in user
space it actually does something relevant.
Change-Id: I4b8e3436c958b7745059ea7ef4367f3fd4a0ebbe
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
@@ -230,7 +230,7 @@ dev_wlc_ioctl(
|
||||
ifr.ifr_data = (caddr_t) &ioc;
|
||||
|
||||
fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
#else
|
||||
|
||||
@@ -300,7 +300,7 @@ dev_wlc_ioctl(
|
||||
ifr.ifr_data = (caddr_t) &ioc;
|
||||
|
||||
fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
#else
|
||||
|
||||
@@ -301,7 +301,7 @@ dev_wlc_ioctl(
|
||||
ifr.ifr_data = (caddr_t) &ioc;
|
||||
|
||||
fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
#else
|
||||
|
||||
@@ -301,7 +301,7 @@ dev_wlc_ioctl(
|
||||
ifr.ifr_data = (caddr_t) &ioc;
|
||||
|
||||
fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#if defined(WL_USE_NETDEV_OPS)
|
||||
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
#else
|
||||
|
||||
@@ -2205,7 +2205,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2247,7 +2247,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2286,7 +2286,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -2205,7 +2205,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2247,7 +2247,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2286,7 +2286,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -1996,7 +1996,7 @@ static int isFileReadable(char *path)
|
||||
ret = PTR_ERR(fp);
|
||||
}
|
||||
else {
|
||||
oldfs = get_fs(); set_fs(get_ds());
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
|
||||
if(1!=readFile(fp, &buf, 1))
|
||||
ret = PTR_ERR(fp);
|
||||
@@ -2024,7 +2024,7 @@ static int retriveFromFile(char *path, u8* buf, u32 sz)
|
||||
if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){
|
||||
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||
|
||||
oldfs = get_fs(); set_fs(get_ds());
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
ret=readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
@@ -2058,7 +2058,7 @@ static int storeToFile(char *path, u8* buf, u32 sz)
|
||||
if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
|
||||
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||
|
||||
oldfs = get_fs(); set_fs(get_ds());
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
ret=writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
|
||||
@@ -2205,7 +2205,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2247,7 +2247,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2286,7 +2286,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -2055,7 +2055,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
ret = PTR_ERR(fp);
|
||||
else {
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
ret = PTR_ERR(fp);
|
||||
@@ -2093,7 +2093,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
|
||||
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
@@ -2128,7 +2128,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
|
||||
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
|
||||
@@ -1957,7 +1957,7 @@ static int isFileReadable(char *path)
|
||||
ret = PTR_ERR(fp);
|
||||
}
|
||||
else {
|
||||
oldfs = get_fs(); set_fs(get_ds());
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
|
||||
if(1!=readFile(fp, &buf, 1))
|
||||
ret = PTR_ERR(fp);
|
||||
@@ -1985,7 +1985,7 @@ static int retriveFromFile(char *path, u8* buf, u32 sz)
|
||||
if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){
|
||||
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||
|
||||
oldfs = get_fs(); set_fs(get_ds());
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
ret=readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
@@ -2019,7 +2019,7 @@ static int storeToFile(char *path, u8* buf, u32 sz)
|
||||
if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
|
||||
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||
|
||||
oldfs = get_fs(); set_fs(get_ds());
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
ret=writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
|
||||
@@ -2507,7 +2507,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2549,7 +2549,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2588,7 +2588,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -2243,7 +2243,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2285,7 +2285,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2324,7 +2324,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -2508,7 +2508,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2550,7 +2550,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2589,7 +2589,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -2015,7 +2015,7 @@ static int isFileReadable(char *path)
|
||||
ret = PTR_ERR(fp);
|
||||
else {
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
ret = PTR_ERR(fp);
|
||||
@@ -2045,7 +2045,7 @@ static int retriveFromFile(char *path, u8 *buf, u32 sz)
|
||||
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
|
||||
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
@@ -2080,7 +2080,7 @@ static int storeToFile(char *path, u8 *buf, u32 sz)
|
||||
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
|
||||
|
||||
oldfs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
closeFile(fp);
|
||||
|
||||
@@ -2232,7 +2232,7 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
@@ -2274,7 +2274,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
@@ -2313,7 +2313,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
|
||||
set_fs(KERNEL_DS);
|
||||
#else
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
|
||||
@@ -214,7 +214,7 @@ int get_flash_info(struct ssv_softc *sc)
|
||||
}
|
||||
|
||||
fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
fp->f_op->read(fp, (char *)pflash_cfg, sizeof(flash_cfg), &fp->f_pos);
|
||||
set_fs(fs);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void sta_cfg_set(char *stacfgpath)
|
||||
memset(cfg_cmd, '\0', sizeof(cfg_cmd));
|
||||
memset(cfg_value, '\0', sizeof(cfg_value));
|
||||
fs = get_fs();
|
||||
set_fs(get_ds());
|
||||
set_fs(KERNEL_DS);
|
||||
read_len = read_line(fp, buf, MAX_CHARS_PER_LINE);
|
||||
set_fs(fs);
|
||||
sscanf(buf, "%s = %s", cfg_cmd, cfg_value);
|
||||
|
||||
Reference in New Issue
Block a user