Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42c59208 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (23 commits)
  pcmcia: Fix ide-cs sparse warning
  pcmcia: ide-cs debugging bugfix
  pcmcia: allow for longer CIS firmware files
  pcmcia: cm40x0 cdev lock_kernel() pushdown
  pcmcia: (re)move {pcmcia,pccard}_get_status
  pcmcia: kill IN_CARD_SERVICES
  pcmcia: Remove unused header file code
  pcmcia: remove unused bulkmem.h
  pcmcia: simplify pccard_validate_cis
  pcmcia: carve out ioctl adjust function to pcmcia_ioctl
  pcmcia: irq probe can be done without risking an IRQ storm
  pcmcia: Fix ti12xx_2nd_slot_empty always failing
  pcmcia: check for pointer instead of pointer address
  pcmcia: switch cm4000_cs.c to unlocked_ioctl
  pcmcia: simplify rsrc_nonstatic attributes
  pcmcia: add support CompactFlash PCMCIA support for Blackfin.
  pcmcia: remove version.h
  pcmcia: cs: kill thread_wait
  pcmcia: i82365.c: check request_irq return value
  pcmcia: fix Alchemy warnings
  ...
parents dddec01e 727c6742
Loading
Loading
Loading
Loading
+75 −43
Original line number Diff line number Diff line
@@ -32,8 +32,9 @@
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/bitrev.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/smp_lock.h>
#include <linux/uaccess.h>
#include <linux/io.h>

#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
@@ -1405,11 +1406,11 @@ static void stop_monitor(struct cm4000_dev *dev)
	DEBUGP(3, dev, "<- stop_monitor\n");
}

static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
		     unsigned long arg)
static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
	struct cm4000_dev *dev = filp->private_data;
	unsigned int iobase = dev->p_dev->io.BasePort1;
	struct inode *inode = filp->f_path.dentry->d_inode;
	struct pcmcia_device *link;
	int size;
	int rc;
@@ -1426,38 +1427,42 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
	DEBUGP(3, dev, "cmm_ioctl(device=%d.%d) %s\n", imajor(inode),
	       iminor(inode), ioctl_names[_IOC_NR(cmd)]);

	lock_kernel();
	rc = -ENODEV;
	link = dev_table[iminor(inode)];
	if (!pcmcia_dev_present(link)) {
		DEBUGP(4, dev, "DEV_OK false\n");
		return -ENODEV;
		goto out;
	}

	if (test_bit(IS_CMM_ABSENT, &dev->flags)) {
		DEBUGP(4, dev, "CMM_ABSENT flag set\n");
		return -ENODEV;
		goto out;
	}
	rc = EINVAL;

	if (_IOC_TYPE(cmd) != CM_IOC_MAGIC) {
		DEBUGP(4, dev, "ioctype mismatch\n");
		return -EINVAL;
		goto out;
	}
	if (_IOC_NR(cmd) > CM_IOC_MAXNR) {
		DEBUGP(4, dev, "iocnr mismatch\n");
		return -EINVAL;
		goto out;
	}
	size = _IOC_SIZE(cmd);
	rc = 0;
	rc = -EFAULT;
	DEBUGP(4, dev, "iocdir=%.4x iocr=%.4x iocw=%.4x iocsize=%d cmd=%.4x\n",
	      _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd);

	if (_IOC_DIR(cmd) & _IOC_READ) {
		if (!access_ok(VERIFY_WRITE, argp, size))
			return -EFAULT;
			goto out;
	}
	if (_IOC_DIR(cmd) & _IOC_WRITE) {
		if (!access_ok(VERIFY_READ, argp, size))
			return -EFAULT;
			goto out;
	}
	rc = 0;

	switch (cmd) {
	case CM_IOCGSTATUS:
@@ -1477,9 +1482,9 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			if (test_bit(IS_BAD_CARD, &dev->flags))
				status |= CM_BAD_CARD;
			if (copy_to_user(argp, &status, sizeof(int)))
				return -EFAULT;
				rc = -EFAULT;
		}
		return 0;
		break;
	case CM_IOCGATR:
		DEBUGP(4, dev, "... in CM_IOCGATR\n");
		{
@@ -1492,25 +1497,29 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			      || (test_bit(IS_ATR_PRESENT, (void *)&dev->flags)
				  != 0)))) {
				if (filp->f_flags & O_NONBLOCK)
					return -EAGAIN;
				return -ERESTARTSYS;
					rc = -EAGAIN;
				else
					rc = -ERESTARTSYS;
				break;
			}

			rc = -EFAULT;
			if (test_bit(IS_ATR_VALID, &dev->flags) == 0) {
				tmp = -1;
				if (copy_to_user(&(atreq->atr_len), &tmp,
						 sizeof(int)))
					return -EFAULT;
					break;
			} else {
				if (copy_to_user(atreq->atr, dev->atr,
						 dev->atr_len))
					return -EFAULT;
					break;

				tmp = dev->atr_len;
				if (copy_to_user(&(atreq->atr_len), &tmp, sizeof(int)))
					return -EFAULT;
					break;
			}
			return 0;
			rc = 0;
			break;
		}
	case CM_IOCARDOFF:

@@ -1538,8 +1547,10 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			      || (test_and_set_bit(LOCK_IO, (void *)&dev->flags)
				  == 0)))) {
				if (filp->f_flags & O_NONBLOCK)
					return -EAGAIN;
				return -ERESTARTSYS;
					rc = -EAGAIN;
				else
					rc = -ERESTARTSYS;
				break;
			}
			/* Set Flags0 = 0x42 */
			DEBUGP(4, dev, "Set Flags0=0x42 \n");
@@ -1554,8 +1565,10 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			      || (test_bit(IS_ATR_VALID, (void *)&dev->flags) !=
				  0)))) {
				if (filp->f_flags & O_NONBLOCK)
					return -EAGAIN;
				return -ERESTARTSYS;
					rc = -EAGAIN;
				else
					rc = -ERESTARTSYS;
				break;
			}
		}
		/* release lock */
@@ -1568,8 +1581,10 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			struct ptsreq krnptsreq;

			if (copy_from_user(&krnptsreq, argp,
					   sizeof(struct ptsreq)))
				return -EFAULT;
					   sizeof(struct ptsreq))) {
				rc = -EFAULT;
				break;
			}

			rc = 0;
			DEBUGP(4, dev, "... in CM_IOCSPTS\n");
@@ -1580,8 +1595,10 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			      || (test_bit(IS_ATR_PRESENT, (void *)&dev->flags)
				  != 0)))) {
				if (filp->f_flags & O_NONBLOCK)
					return -EAGAIN;
				return -ERESTARTSYS;
					rc = -EAGAIN;
				else
					rc = -ERESTARTSYS;
				break;
			}
			/* get IO lock */
			if (wait_event_interruptible
@@ -1590,8 +1607,10 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			      || (test_and_set_bit(LOCK_IO, (void *)&dev->flags)
				  == 0)))) {
				if (filp->f_flags & O_NONBLOCK)
					return -EAGAIN;
				return -ERESTARTSYS;
					rc = -EAGAIN;
				else
					rc = -ERESTARTSYS;
				break;
			}

			if ((rc = set_protocol(dev, &krnptsreq)) != 0) {
@@ -1604,7 +1623,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
			wake_up_interruptible(&dev->ioq);

		}
		return rc;
		break;
#ifdef PCMCIA_DEBUG
	case CM_IOSDBGLVL:	/* set debug log level */
		{
@@ -1612,18 +1631,20 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,

			old_pc_debug = pc_debug;
			if (copy_from_user(&pc_debug, argp, sizeof(int)))
				return -EFAULT;

			if (old_pc_debug != pc_debug)
				rc = -EFAULT;
			else if (old_pc_debug != pc_debug)
				DEBUGP(0, dev, "Changed debug log level "
				       "to %i\n", pc_debug);
		}
		return rc;
		break;
#endif
	default:
		DEBUGP(4, dev, "... in default (unknown IOCTL code)\n");
		return -EINVAL;
		rc = -ENOTTY;
	}
out:
	unlock_kernel();
	return rc;
}

static int cmm_open(struct inode *inode, struct file *filp)
@@ -1631,16 +1652,22 @@ static int cmm_open(struct inode *inode, struct file *filp)
	struct cm4000_dev *dev;
	struct pcmcia_device *link;
	int minor = iminor(inode);
	int ret;

	if (minor >= CM4000_MAX_DEV)
		return -ENODEV;

	lock_kernel();
	link = dev_table[minor];
	if (link == NULL || !pcmcia_dev_present(link))
		return -ENODEV;
	if (link == NULL || !pcmcia_dev_present(link)) {
		ret = -ENODEV;
		goto out;
	}

	if (link->open)
		return -EBUSY;
	if (link->open) {
		ret = -EBUSY;
		goto out;
	}

	dev = link->priv;
	filp->private_data = dev;
@@ -1660,8 +1687,10 @@ static int cmm_open(struct inode *inode, struct file *filp)
	 * vaild = block until valid (or card
	 * inserted)
	 */
	if (filp->f_flags & O_NONBLOCK)
		return -EAGAIN;
	if (filp->f_flags & O_NONBLOCK) {
		ret = -EAGAIN;
		goto out;
	}

	dev->mdelay = T_50MSEC;

@@ -1671,7 +1700,10 @@ static int cmm_open(struct inode *inode, struct file *filp)
	link->open = 1;		/* only one open per device */

	DEBUGP(2, dev, "<- cmm_open\n");
	return nonseekable_open(inode, filp);
	ret = nonseekable_open(inode, filp);
out:
	unlock_kernel();
	return ret;
}

static int cmm_close(struct inode *inode, struct file *filp)
@@ -1897,7 +1929,7 @@ static const struct file_operations cm4000_fops = {
	.owner	= THIS_MODULE,
	.read	= cmm_read,
	.write	= cmm_write,
	.ioctl	= cmm_ioctl,
	.unlocked_ioctl	= cmm_ioctl,
	.open	= cmm_open,
	.release= cmm_close,
};
+17 −6
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <linux/smp_lock.h>
#include <linux/wait.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -448,23 +449,30 @@ static int cm4040_open(struct inode *inode, struct file *filp)
	struct reader_dev *dev;
	struct pcmcia_device *link;
	int minor = iminor(inode);
	int ret;

	if (minor >= CM_MAX_DEV)
		return -ENODEV;

	lock_kernel();
	link = dev_table[minor];
	if (link == NULL || !pcmcia_dev_present(link))
		return -ENODEV;
	if (link == NULL || !pcmcia_dev_present(link)) {
		ret = -ENODEV;
		goto out;
	}

	if (link->open)
		return -EBUSY;
	if (link->open) {
		ret = -EBUSY;
		goto out;
	}

	dev = link->priv;
	filp->private_data = dev;

	if (filp->f_flags & O_NONBLOCK) {
		DEBUGP(4, dev, "filep->f_flags O_NONBLOCK set\n");
		return -EAGAIN;
		ret = -EAGAIN;
		goto out;
	}

	link->open = 1;
@@ -473,7 +481,10 @@ static int cm4040_open(struct inode *inode, struct file *filp)
	mod_timer(&dev->poll_timer, jiffies + POLL_PERIOD);

	DEBUGP(2, dev, "<- cm4040_open (successfully)\n");
	return nonseekable_open(inode, filp);
	ret = nonseekable_open(inode, filp);
out:
	unlock_kernel();
	return ret;
}

static int cm4040_close(struct inode *inode, struct file *filp)
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
#include <linux/sched.h>
#include <linux/slab.h>

#include <pcmcia/version.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/device_id.h>
#include <pcmcia/ss.h>
+5 −5
Original line number Diff line number Diff line
@@ -63,11 +63,11 @@ MODULE_LICENSE("Dual MPL/GPL");

#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)

#ifdef PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
#ifdef CONFIG_PCMCIA_DEBUG
INT_MODULE_PARM(pc_debug, 0);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
"ide-cs.c 1.3 2002/10/26 05:45:31 (David Hinds)";
/*static char *version =
"ide-cs.c 1.3 2002/10/26 05:45:31 (David Hinds)";*/
#else
#define DEBUG(n, args...)
#endif
@@ -375,7 +375,7 @@ failed:

======================================================================*/

void ide_release(struct pcmcia_device *link)
static void ide_release(struct pcmcia_device *link)
{
    ide_info_t *info = link->priv;
    ide_hwif_t *hwif = info->hwif;
+0 −4
Original line number Diff line number Diff line
@@ -130,10 +130,6 @@ typedef struct partition_t {
    u_int16_t		DataUnits;
    u_int32_t		BlocksPerUnit;
    erase_unit_header_t	header;
#if 0
    region_info_t	region;
    memory_handle_t	handle;
#endif
} partition_t;

/* Partition state flags */
Loading