diff mbox

arch: parisc: kernel: sys_parisc: Remove some unused functions

Message ID 1420222190-32621-1-git-send-email-rickard_strandqvist@spectrumdigital.se (mailing list archive)
State Rejected
Headers show

Commit Message

Rickard Strandqvist Jan. 2, 2015, 6:09 p.m. UTC
Removes some functions that are not used anywhere:
parisc_personality() parisc_fallocate() parisc_sync_file_range()
parisc_fadvise64_64() parisc_readahead() parisc_pwrite64() parisc_pread64()
parisc_ftruncate64() parisc_truncate64()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 arch/parisc/kernel/sys_parisc.c |   81 ---------------------------------------
 1 file changed, 81 deletions(-)

Comments

Helge Deller Jan. 2, 2015, 6:12 p.m. UTC | #1
On 01/02/2015 07:09 PM, Rickard Strandqvist wrote:
> Removes some functions that are not used anywhere:
> parisc_personality() parisc_fallocate() parisc_sync_file_range()
> parisc_fadvise64_64() parisc_readahead() parisc_pwrite64() parisc_pread64()
> parisc_ftruncate64() parisc_truncate64()
>
> This was partially found by using a static code analysis program called cppcheck.

NAK.

Those functions implement syscalls specific to the parisc ABI.
They are referenced in the syscall table which gets generated by the ENTRY_OURS()
macro in arch/parisc/kernel/syscall_table.S

Helge

>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>   arch/parisc/kernel/sys_parisc.c |   81 ---------------------------------------
>   1 file changed, 81 deletions(-)
>
> diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
> index e1ffea2..65ab69d 100644
> --- a/arch/parisc/kernel/sys_parisc.c
> +++ b/arch/parisc/kernel/sys_parisc.c
> @@ -283,18 +283,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
>   /* Fucking broken ABI */
>
>   #ifdef CONFIG_64BIT
> -asmlinkage long parisc_truncate64(const char __user * path,
> -					unsigned int high, unsigned int low)
> -{
> -	return sys_truncate(path, (long)high << 32 | low);
> -}
> -
> -asmlinkage long parisc_ftruncate64(unsigned int fd,
> -					unsigned int high, unsigned int low)
> -{
> -	return sys_ftruncate(fd, (long)high << 32 | low);
> -}
> -
>   /* stubs for the benefit of the syscall_table since truncate64 and truncate
>    * are identical on LP64 */
>   asmlinkage long sys_truncate64(const char __user * path, unsigned long length)
> @@ -309,62 +297,8 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
>   {
>   	return sys_fcntl(fd, cmd, arg);
>   }
> -#else
> -
> -asmlinkage long parisc_truncate64(const char __user * path,
> -					unsigned int high, unsigned int low)
> -{
> -	return sys_truncate64(path, (loff_t)high << 32 | low);
> -}
> -
> -asmlinkage long parisc_ftruncate64(unsigned int fd,
> -					unsigned int high, unsigned int low)
> -{
> -	return sys_ftruncate64(fd, (loff_t)high << 32 | low);
> -}
>   #endif
>
> -asmlinkage ssize_t parisc_pread64(unsigned int fd, char __user *buf, size_t count,
> -					unsigned int high, unsigned int low)
> -{
> -	return sys_pread64(fd, buf, count, (loff_t)high << 32 | low);
> -}
> -
> -asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf,
> -			size_t count, unsigned int high, unsigned int low)
> -{
> -	return sys_pwrite64(fd, buf, count, (loff_t)high << 32 | low);
> -}
> -
> -asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low,
> -		                    size_t count)
> -{
> -	return sys_readahead(fd, (loff_t)high << 32 | low, count);
> -}
> -
> -asmlinkage long parisc_fadvise64_64(int fd,
> -			unsigned int high_off, unsigned int low_off,
> -			unsigned int high_len, unsigned int low_len, int advice)
> -{
> -	return sys_fadvise64_64(fd, (loff_t)high_off << 32 | low_off,
> -			(loff_t)high_len << 32 | low_len, advice);
> -}
> -
> -asmlinkage long parisc_sync_file_range(int fd,
> -			u32 hi_off, u32 lo_off, u32 hi_nbytes, u32 lo_nbytes,
> -			unsigned int flags)
> -{
> -	return sys_sync_file_range(fd, (loff_t)hi_off << 32 | lo_off,
> -			(loff_t)hi_nbytes << 32 | lo_nbytes, flags);
> -}
> -
> -asmlinkage long parisc_fallocate(int fd, int mode, u32 offhi, u32 offlo,
> -				u32 lenhi, u32 lenlo)
> -{
> -        return sys_fallocate(fd, mode, ((u64)offhi << 32) | offlo,
> -                             ((u64)lenhi << 32) | lenlo);
> -}
> -
>   asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag)
>   {
>   	return -ENOMEM;
> @@ -374,18 +308,3 @@ asmlinkage int sys_free_hugepages(unsigned long addr)
>   {
>   	return -EINVAL;
>   }
> -
> -long parisc_personality(unsigned long personality)
> -{
> -	long err;
> -
> -	if (personality(current->personality) == PER_LINUX32
> -	    && personality(personality) == PER_LINUX)
> -		personality = (personality & ~PER_MASK) | PER_LINUX32;
> -
> -	err = sys_personality(personality);
> -	if (personality(err) == PER_LINUX32)
> -		err = (err & ~PER_MASK) | PER_LINUX;
> -
> -	return err;
> -}
>

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Al Viro Jan. 2, 2015, 6:14 p.m. UTC | #2
On Fri, Jan 02, 2015 at 07:09:50PM +0100, Rickard Strandqvist wrote:
> Removes some functions that are not used anywhere:
> parisc_personality() parisc_fallocate() parisc_sync_file_range()
> parisc_fadvise64_64() parisc_readahead() parisc_pwrite64() parisc_pread64()
> parisc_ftruncate64() parisc_truncate64()
> 
> This was partially found by using a static code analysis program called cppcheck.

... which program has ended up missing
#define ENTRY_OURS(_name_) .word parisc_##_name_
and tons of lines like this
        ENTRY_OURS(sync_file_range)
in arch/parisc/kernel/syscall_table.S
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index e1ffea2..65ab69d 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -283,18 +283,6 @@  asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
 /* Fucking broken ABI */
 
 #ifdef CONFIG_64BIT
-asmlinkage long parisc_truncate64(const char __user * path,
-					unsigned int high, unsigned int low)
-{
-	return sys_truncate(path, (long)high << 32 | low);
-}
-
-asmlinkage long parisc_ftruncate64(unsigned int fd,
-					unsigned int high, unsigned int low)
-{
-	return sys_ftruncate(fd, (long)high << 32 | low);
-}
-
 /* stubs for the benefit of the syscall_table since truncate64 and truncate 
  * are identical on LP64 */
 asmlinkage long sys_truncate64(const char __user * path, unsigned long length)
@@ -309,62 +297,8 @@  asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
 {
 	return sys_fcntl(fd, cmd, arg);
 }
-#else
-
-asmlinkage long parisc_truncate64(const char __user * path,
-					unsigned int high, unsigned int low)
-{
-	return sys_truncate64(path, (loff_t)high << 32 | low);
-}
-
-asmlinkage long parisc_ftruncate64(unsigned int fd,
-					unsigned int high, unsigned int low)
-{
-	return sys_ftruncate64(fd, (loff_t)high << 32 | low);
-}
 #endif
 
-asmlinkage ssize_t parisc_pread64(unsigned int fd, char __user *buf, size_t count,
-					unsigned int high, unsigned int low)
-{
-	return sys_pread64(fd, buf, count, (loff_t)high << 32 | low);
-}
-
-asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf,
-			size_t count, unsigned int high, unsigned int low)
-{
-	return sys_pwrite64(fd, buf, count, (loff_t)high << 32 | low);
-}
-
-asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low,
-		                    size_t count)
-{
-	return sys_readahead(fd, (loff_t)high << 32 | low, count);
-}
-
-asmlinkage long parisc_fadvise64_64(int fd,
-			unsigned int high_off, unsigned int low_off,
-			unsigned int high_len, unsigned int low_len, int advice)
-{
-	return sys_fadvise64_64(fd, (loff_t)high_off << 32 | low_off,
-			(loff_t)high_len << 32 | low_len, advice);
-}
-
-asmlinkage long parisc_sync_file_range(int fd,
-			u32 hi_off, u32 lo_off, u32 hi_nbytes, u32 lo_nbytes,
-			unsigned int flags)
-{
-	return sys_sync_file_range(fd, (loff_t)hi_off << 32 | lo_off,
-			(loff_t)hi_nbytes << 32 | lo_nbytes, flags);
-}
-
-asmlinkage long parisc_fallocate(int fd, int mode, u32 offhi, u32 offlo,
-				u32 lenhi, u32 lenlo)
-{
-        return sys_fallocate(fd, mode, ((u64)offhi << 32) | offlo,
-                             ((u64)lenhi << 32) | lenlo);
-}
-
 asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag)
 {
 	return -ENOMEM;
@@ -374,18 +308,3 @@  asmlinkage int sys_free_hugepages(unsigned long addr)
 {
 	return -EINVAL;
 }
-
-long parisc_personality(unsigned long personality)
-{
-	long err;
-
-	if (personality(current->personality) == PER_LINUX32
-	    && personality(personality) == PER_LINUX)
-		personality = (personality & ~PER_MASK) | PER_LINUX32;
-
-	err = sys_personality(personality);
-	if (personality(err) == PER_LINUX32)
-		err = (err & ~PER_MASK) | PER_LINUX;
-
-	return err;
-}