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

Commit 1685e633 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
  pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq
  pcmcia: do not request windows if you don't need to
  pcmcia: insert PCMCIA device resources into resource tree
  pcmcia: export resource information to sysfs
  pcmcia: use struct resource for PCMCIA devices, part 2
  pcmcia: remove memreq_t
  pcmcia: move local definitions out of include/pcmcia/cs.h
  pcmcia: do not use io_req_t when calling pcmcia_request_io()
  pcmcia: do not use io_req_t after call to pcmcia_request_io()
  pcmcia: use struct resource for PCMCIA devices
  pcmcia: clean up cs.h
  pcmcia: use pcmica_{read,write}_config_byte
  pcmcia: remove cs_types.h
  pcmcia: remove unused flag, simplify headers
  pcmcia: remove obsolete CS_EVENT_ definitions
  pcmcia: split up central event handler
  pcmcia: simplify event callback
  pcmcia: remove obsolete ioctl

Conflicts in:
 - drivers/staging/comedi/drivers/*
 - drivers/staging/wlags49_h2/wl_cs.c
due to dev_info_t and whitespace changes
parents 1cfd2bda 127c03cd
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -116,29 +116,6 @@ Who: Mauro Carvalho Chehab <mchehab@infradead.org>

---------------------------

What:	PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl])
When:	2.6.35/2.6.36
Files:	drivers/pcmcia/: pcmcia_ioctl.c
Why:	With the 16-bit PCMCIA subsystem now behaving (almost) like a
	normal hotpluggable bus, and with it using the default kernel
	infrastructure (hotplug, driver core, sysfs) keeping the PCMCIA
	control ioctl needed by cardmgr and cardctl from pcmcia-cs is
	unnecessary and potentially harmful (it does not provide for
	proper locking), and makes further cleanups and integration of the
	PCMCIA subsystem into the Linux kernel device driver model more
	difficult. The features provided by cardmgr and cardctl are either
	handled by the kernel itself now or are available in the new
	pcmciautils package available at
	http://kernel.org/pub/linux/utils/kernel/pcmcia/

	For all architectures except ARM, the associated config symbol
	has been removed from kernel 2.6.34; for ARM, it will be likely
	be removed from kernel 2.6.35. The actual code will then likely
	be removed from kernel 2.6.36.
Who:	Dominik Brodowski <linux@dominikbrodowski.net>

---------------------------

What:	sys_sysctl
When:	September 2010
Option: CONFIG_SYSCTL_SYSCALL
+12 −0
Original line number Diff line number Diff line
This file details changes in 2.6 which affect PCMCIA card driver authors:
* pcmcia_request_io changes (as of 2.6.36)
   Instead of io_req_t, drivers are now requested to fill out
   struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
   ranges. After a call to pcmcia_request_io(), the ports found there
   are reserved, after calling pcmcia_request_configuration(), they may
   be used.

* No dev_info_t, no cs_types.h (as of 2.6.36)
   dev_info_t and a few other typedefs are removed. No longer use them
   in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as
   this file is gone.

* No dev_node_t (as of 2.6.35)
   There is no more need to fill out a "dev_node_t" structure.

+19 −19
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
#include <linux/ata.h>
#include <linux/libata.h>

#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
@@ -201,23 +200,25 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,

	if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
		cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
		pdev->io.BasePort1 = io->win[0].base;
		pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
		if (!(io->flags & CISTPL_IO_16BIT))
			pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
		pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
		pdev->resource[0]->start = io->win[0].base;
		if (!(io->flags & CISTPL_IO_16BIT)) {
			pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
			pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
		}
		if (io->nwin == 2) {
			pdev->io.NumPorts1 = 8;
			pdev->io.BasePort2 = io->win[1].base;
			pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
			if (pcmcia_request_io(pdev, &pdev->io) != 0)
			pdev->resource[0]->end = 8;
			pdev->resource[1]->start = io->win[1].base;
			pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
			if (pcmcia_request_io(pdev) != 0)
				return -ENODEV;
			stk->ctl_base = pdev->io.BasePort2;
			stk->ctl_base = pdev->resource[1]->start;
		} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
			pdev->io.NumPorts1 = io->win[0].len;
			pdev->io.NumPorts2 = 0;
			if (pcmcia_request_io(pdev, &pdev->io) != 0)
			pdev->resource[0]->end = io->win[0].len;
			pdev->resource[1]->end = 0;
			if (pcmcia_request_io(pdev) != 0)
				return -ENODEV;
			stk->ctl_base = pdev->io.BasePort1 + 0x0e;
			stk->ctl_base = pdev->resource[0]->start + 0x0e;
		} else
			return -ENODEV;
		/* If we've got this far, we're done */
@@ -246,9 +247,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
	struct ata_port_operations *ops = &pcmcia_port_ops;

	/* Set up attributes in order to probe card and get resources */
	pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
	pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
	pdev->io.IOAddrLines = 3;
	pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
	pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
	pdev->conf.Attributes = CONF_ENABLE_IRQ;
	pdev->conf.IntType = INT_MEMORY_AND_IO;

@@ -271,7 +271,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
		if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
			goto failed; /* No suitable config found */
	}
	io_base = pdev->io.BasePort1;
	io_base = pdev->resource[0]->start;
	ctl_base = stk->ctl_base;
	if (!pdev->irq)
		goto failed;
@@ -294,7 +294,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)

	/* FIXME: Could be more ports at base + 0x10 but we only deal with
	   one right now */
	if (pdev->io.NumPorts1 >= 0x20)
	if (resource_size(pdev->resource[0]) >= 0x20)
		n_ports = 2;

	if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620)
+15 −17
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include <linux/skbuff.h>
#include <linux/io.h>

#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
@@ -160,7 +159,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev);
static void bluecard_activity_led_timeout(u_long arg)
{
	bluecard_info_t *info = (bluecard_info_t *)arg;
	unsigned int iobase = info->p_dev->io.BasePort1;
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
		return;
@@ -177,7 +176,7 @@ static void bluecard_activity_led_timeout(u_long arg)

static void bluecard_enable_activity_led(bluecard_info_t *info)
{
	unsigned int iobase = info->p_dev->io.BasePort1;
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
		return;
@@ -233,7 +232,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
	}

	do {
		register unsigned int iobase = info->p_dev->io.BasePort1;
		register unsigned int iobase = info->p_dev->resource[0]->start;
		register unsigned int offset;
		register unsigned char command;
		register unsigned long ready_bit;
@@ -380,7 +379,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
		return;
	}

	iobase = info->p_dev->io.BasePort1;
	iobase = info->p_dev->resource[0]->start;

	if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
		bluecard_enable_activity_led(info);
@@ -509,7 +508,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
	if (!test_bit(CARD_READY, &(info->hw_state)))
		return IRQ_HANDLED;

	iobase = info->p_dev->io.BasePort1;
	iobase = info->p_dev->resource[0]->start;

	spin_lock(&(info->lock));

@@ -623,7 +622,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
static int bluecard_hci_open(struct hci_dev *hdev)
{
	bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
	unsigned int iobase = info->p_dev->io.BasePort1;
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
		bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
@@ -643,7 +642,7 @@ static int bluecard_hci_open(struct hci_dev *hdev)
static int bluecard_hci_close(struct hci_dev *hdev)
{
	bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
	unsigned int iobase = info->p_dev->io.BasePort1;
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
		return 0;
@@ -710,7 +709,7 @@ static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned l

static int bluecard_open(bluecard_info_t *info)
{
	unsigned int iobase = info->p_dev->io.BasePort1;
	unsigned int iobase = info->p_dev->resource[0]->start;
	struct hci_dev *hdev;
	unsigned char id;

@@ -829,7 +828,7 @@ static int bluecard_open(bluecard_info_t *info)

static int bluecard_close(bluecard_info_t *info)
{
	unsigned int iobase = info->p_dev->io.BasePort1;
	unsigned int iobase = info->p_dev->resource[0]->start;
	struct hci_dev *hdev = info->hdev;

	if (!hdev)
@@ -866,9 +865,6 @@ static int bluecard_probe(struct pcmcia_device *link)
	info->p_dev = link;
	link->priv = info;

	link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
	link->io.NumPorts1 = 8;

	link->conf.Attributes = CONF_ENABLE_IRQ;
	link->conf.IntType = INT_MEMORY_AND_IO;

@@ -891,12 +887,14 @@ static int bluecard_config(struct pcmcia_device *link)
	int i, n;

	link->conf.ConfigIndex = 0x20;
	link->io.NumPorts1 = 64;
	link->io.IOAddrLines = 6;

	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	link->resource[0]->end = 64;
	link->io_lines = 6;

	for (n = 0; n < 0x400; n += 0x40) {
		link->io.BasePort1 = n ^ 0x300;
		i = pcmcia_request_io(link, &link->io);
		link->resource[0]->start = n ^ 0x300;
		i = pcmcia_request_io(link);
		if (i == 0)
			break;
	}
+13 −14
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@
#include <linux/device.h>
#include <linux/firmware.h>

#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ciscode.h>
@@ -189,7 +188,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
		return;

	do {
		register unsigned int iobase = info->p_dev->io.BasePort1;
		register unsigned int iobase = info->p_dev->resource[0]->start;
		register struct sk_buff *skb;
		register int len;

@@ -227,7 +226,7 @@ static void bt3c_receive(bt3c_info_t *info)
		return;
	}

	iobase = info->p_dev->io.BasePort1;
	iobase = info->p_dev->resource[0]->start;

	avail = bt3c_read(iobase, 0x7006);
	//printk("bt3c_cs: receiving %d bytes\n", avail);
@@ -348,7 +347,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
		/* our irq handler is shared */
		return IRQ_NONE;

	iobase = info->p_dev->io.BasePort1;
	iobase = info->p_dev->resource[0]->start;

	spin_lock(&(info->lock));

@@ -481,7 +480,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware,
	unsigned int iobase, size, addr, fcs, tmp;
	int i, err = 0;

	iobase = info->p_dev->io.BasePort1;
	iobase = info->p_dev->resource[0]->start;

	/* Reset */
	bt3c_io_write(iobase, 0x8040, 0x0404);
@@ -658,8 +657,8 @@ static int bt3c_probe(struct pcmcia_device *link)
	info->p_dev = link;
	link->priv = info;

	link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
	link->io.NumPorts1 = 8;
	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
	link->resource[0]->end = 8;

	link->conf.Attributes = CONF_ENABLE_IRQ;
	link->conf.IntType = INT_MEMORY_AND_IO;
@@ -684,14 +683,14 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
{
	unsigned long try = (unsigned long) priv_data;

	p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;

	if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
		p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
	if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
	    (cf->io.win[0].base != 0)) {
		p_dev->io.BasePort1 = cf->io.win[0].base;
		p_dev->io.IOAddrLines = (try == 0) ? 16 :
			cf->io.flags & CISTPL_IO_LINES_MASK;
		if (!pcmcia_request_io(p_dev, &p_dev->io))
		p_dev->resource[0]->start = cf->io.win[0].base;
		if (!pcmcia_request_io(p_dev))
			return 0;
	}
	return -ENODEV;
@@ -708,9 +707,9 @@ static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,

	if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
		for (j = 0; j < 5; j++) {
			p_dev->io.BasePort1 = base[j];
			p_dev->io.IOAddrLines = base[j] ? 16 : 3;
			if (!pcmcia_request_io(p_dev, &p_dev->io))
			p_dev->resource[0]->start = base[j];
			p_dev->io_lines = base[j] ? 16 : 3;
			if (!pcmcia_request_io(p_dev))
				return 0;
		}
	}
Loading