diff mbox

[RFC,v2,01/24] macintosh/nvram: Remove as unused

Message ID 20150614074607.524658883@telegraphics.com.au (mailing list archive)
State Accepted
Delegated to: Michael Ellerman
Headers show

Commit Message

Finn Thain June 14, 2015, 7:46 a.m. UTC
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

---
 drivers/macintosh/nvram.c |  130 ----------------------------------------------
 1 file changed, 130 deletions(-)

Comments

Michael Ellerman June 15, 2015, 6:41 a.m. UTC | #1
On Sun, 2015-14-06 at 07:46:08 UTC, Finn Thain wrote:
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  drivers/macintosh/nvram.c |  130 ----------------------------------------------
>  1 file changed, 130 deletions(-)

This seems uncontroversial, so I'll take it via powerpc for 4.1.

In future please include the details on how/why it's unused in the changelog.

Geert did the digging for you:

  Removal seems to be forgotten by full-history-linux
  commit 17c6f4635bea74e110ab3558d408c9cd218c568a
  Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  Date:   Fri Feb 6 14:20:56 2004 +1100
  
      ppc32: Rework nvram management
  
      move drivers/macintosh/nvram.c to drivers/char/generic_nvram.c,
      update platform hooks,
      fix powermac nvram driver for newer machines


I'll fold that into the changelog.

cheers
diff mbox

Patch

Index: linux/drivers/macintosh/nvram.c
===================================================================
--- linux.orig/drivers/macintosh/nvram.c	2015-06-14 17:45:34.000000000 +1000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,130 +0,0 @@ 
-/*
- * /dev/nvram driver for Power Macintosh.
- */
-
-#define NVRAM_VERSION "1.0"
-
-#include <linux/module.h>
-
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/fcntl.h>
-#include <linux/nvram.h>
-#include <linux/init.h>
-#include <asm/uaccess.h>
-#include <asm/nvram.h>
-
-#define NVRAM_SIZE	8192
-
-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_SIZE;
-		break;
-	default:
-		offset = -1;
-	}
-	if (offset < 0)
-		return -EINVAL;
-
-	file->f_pos = offset;
-	return file->f_pos;
-}
-
-static ssize_t read_nvram(struct file *file, char __user *buf,
-			  size_t count, loff_t *ppos)
-{
-	unsigned int i;
-	char __user *p = buf;
-
-	if (!access_ok(VERIFY_WRITE, buf, count))
-		return -EFAULT;
-	if (*ppos >= NVRAM_SIZE)
-		return 0;
-	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
-		if (__put_user(nvram_read_byte(i), p))
-			return -EFAULT;
-	*ppos = i;
-	return p - buf;
-}
-
-static ssize_t write_nvram(struct file *file, const char __user *buf,
-			   size_t count, loff_t *ppos)
-{
-	unsigned int i;
-	const char __user *p = buf;
-	char c;
-
-	if (!access_ok(VERIFY_READ, buf, count))
-		return -EFAULT;
-	if (*ppos >= NVRAM_SIZE)
-		return 0;
-	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
-		if (__get_user(c, p))
-			return -EFAULT;
-		nvram_write_byte(c, i);
-	}
-	*ppos = i;
-	return p - buf;
-}
-
-static long nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
-	switch(cmd) {
-		case PMAC_NVRAM_GET_OFFSET:
-		{
-			int part, offset;
-			if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0)
-				return -EFAULT;
-			if (part < pmac_nvram_OF || part > pmac_nvram_NR)
-				return -EINVAL;
-			offset = pmac_get_partition(part);
-			if (copy_to_user((void __user*)arg, &offset, sizeof(offset)) != 0)
-				return -EFAULT;
-			break;
-		}
-
-		default:
-			return -EINVAL;
-	}
-
-	return 0;
-}
-
-const struct file_operations nvram_fops = {
-	.owner		= THIS_MODULE,
-	.llseek		= nvram_llseek,
-	.read		= read_nvram,
-	.write		= write_nvram,
-	.unlocked_ioctl	= nvram_ioctl,
-};
-
-static struct miscdevice nvram_dev = {
-	NVRAM_MINOR,
-	"nvram",
-	&nvram_fops
-};
-
-int __init nvram_init(void)
-{
-	printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n",
-		NVRAM_VERSION);
-	return misc_register(&nvram_dev);
-}
-
-void __exit nvram_cleanup(void)
-{
-        misc_deregister( &nvram_dev );
-}
-
-module_init(nvram_init);
-module_exit(nvram_cleanup);
-MODULE_LICENSE("GPL");