Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
b808b1d6
Commit
b808b1d6
authored
Dec 05, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't open-code generic_file_llseek_size()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
e1a63bbc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
74 deletions
+12
-74
arch/powerpc/kernel/nvram_64.c
arch/powerpc/kernel/nvram_64.c
+3
-16
drivers/char/generic_nvram.c
drivers/char/generic_nvram.c
+3
-18
drivers/char/mbcs.c
drivers/char/mbcs.c
+3
-25
drivers/char/nvram.c
drivers/char/nvram.c
+3
-15
No files found.
arch/powerpc/kernel/nvram_64.c
View file @
b808b1d6
...
...
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/kmsg_dump.h>
#include <linux/pagemap.h>
#include <linux/pstore.h>
#include <linux/zlib.h>
#include <asm/uaccess.h>
...
...
@@ -733,24 +734,10 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
static
loff_t
dev_nvram_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
origin
)
{
int
size
;
if
(
ppc_md
.
nvram_size
==
NULL
)
return
-
ENODEV
;
size
=
ppc_md
.
nvram_size
();
switch
(
origin
)
{
case
1
:
offset
+=
file
->
f_pos
;
break
;
case
2
:
offset
+=
size
;
break
;
}
if
(
offset
<
0
)
return
-
EINVAL
;
file
->
f_pos
=
offset
;
return
file
->
f_pos
;
return
generic_file_llseek_size
(
file
,
offset
,
origin
,
MAX_LFS_FILESIZE
,
ppc_md
.
nvram_size
());
}
...
...
drivers/char/generic_nvram.c
View file @
b808b1d6
...
...
@@ -20,6 +20,7 @@
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <asm/uaccess.h>
#include <asm/nvram.h>
#ifdef CONFIG_PPC_PMAC
...
...
@@ -33,24 +34,8 @@ static ssize_t nvram_len;
static
loff_t
nvram_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
origin
)
{
switch
(
origin
)
{
case
0
:
break
;
case
1
:
offset
+=
file
->
f_pos
;
break
;
case
2
:
offset
+=
nvram_len
;
break
;
default:
offset
=
-
1
;
}
if
(
offset
<
0
)
return
-
EINVAL
;
file
->
f_pos
=
offset
;
return
file
->
f_pos
;
return
generic_file_llseek_size
(
file
,
offset
,
origin
,
MAX_LFS_FILESIZE
,
nvram_len
);
}
static
ssize_t
read_nvram
(
struct
file
*
file
,
char
__user
*
buf
,
...
...
drivers/char/mbcs.c
View file @
b808b1d6
...
...
@@ -26,6 +26,7 @@
#include <linux/uio.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/pagemap.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
...
...
@@ -451,31 +452,8 @@ mbcs_sram_write(struct file * fp, const char __user *buf, size_t len, loff_t * o
static
loff_t
mbcs_sram_llseek
(
struct
file
*
filp
,
loff_t
off
,
int
whence
)
{
loff_t
newpos
;
switch
(
whence
)
{
case
SEEK_SET
:
newpos
=
off
;
break
;
case
SEEK_CUR
:
newpos
=
filp
->
f_pos
+
off
;
break
;
case
SEEK_END
:
newpos
=
MBCS_SRAM_SIZE
+
off
;
break
;
default:
/* can't happen */
return
-
EINVAL
;
}
if
(
newpos
<
0
)
return
-
EINVAL
;
filp
->
f_pos
=
newpos
;
return
newpos
;
return
generic_file_llseek_size
(
filp
,
off
,
whence
,
MAX_LFS_FILESIZE
,
MBCS_SRAM_SIZE
);
}
static
uint64_t
mbcs_pioaddr
(
struct
mbcs_soft
*
soft
,
uint64_t
offset
)
...
...
drivers/char/nvram.c
View file @
b808b1d6
...
...
@@ -110,6 +110,7 @@
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
static
DEFINE_MUTEX
(
nvram_mutex
);
...
...
@@ -213,21 +214,8 @@ void nvram_set_checksum(void)
static
loff_t
nvram_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
origin
)
{
switch
(
origin
)
{
case
0
:
/* nothing to do */
break
;
case
1
:
offset
+=
file
->
f_pos
;
break
;
case
2
:
offset
+=
NVRAM_BYTES
;
break
;
default:
return
-
EINVAL
;
}
return
(
offset
>=
0
)
?
(
file
->
f_pos
=
offset
)
:
-
EINVAL
;
return
generic_file_llseek_size
(
file
,
offset
,
origin
,
MAX_LFS_FILESIZE
,
NVRAM_BYTES
);
}
static
ssize_t
nvram_read
(
struct
file
*
file
,
char
__user
*
buf
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment