History log of /linux-master/drivers/pcmcia/pcmcia_resource.c
Revision Date Author Comments
# 99e25b17 15-Nov-2022 Dongliang Mu <dzm91@hust.edu.cn>

pcmcia: typo fix

themselfves -> themselves

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# fffbcee9 02-Jan-2022 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: make pcmcia_release_io() void, as no-one is interested in return value

As the only user of pcmcia_release_io() is not interested in its return
value, and we cannot do anything on failure, convert the function to return
void.

Reported-by: Jason Wang <wangborong@cdjrlc.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1d26d6f2 12-Mar-2021 Lee Jones <lee.jones@linaro.org>

pcmcia: pcmcia_resource: Fix some kernel-doc formatting/disparities and demote others

Fixes the following W=1 kernel build warning(s):

drivers/pcmcia/pcmcia_resource.c:160: warning: Function parameter or member 'p_dev' not described in 'pcmcia_access_config'
drivers/pcmcia/pcmcia_resource.c:160: warning: Function parameter or member 'where' not described in 'pcmcia_access_config'
drivers/pcmcia/pcmcia_resource.c:160: warning: Function parameter or member 'val' not described in 'pcmcia_access_config'
drivers/pcmcia/pcmcia_resource.c:160: warning: Function parameter or member 'accessf' not described in 'pcmcia_access_config'
drivers/pcmcia/pcmcia_resource.c:194: warning: Function parameter or member 'p_dev' not described in 'pcmcia_read_config_byte'
drivers/pcmcia/pcmcia_resource.c:194: warning: Function parameter or member 'where' not described in 'pcmcia_read_config_byte'
drivers/pcmcia/pcmcia_resource.c:194: warning: Function parameter or member 'val' not described in 'pcmcia_read_config_byte'
drivers/pcmcia/pcmcia_resource.c:207: warning: Function parameter or member 'p_dev' not described in 'pcmcia_write_config_byte'
drivers/pcmcia/pcmcia_resource.c:207: warning: Function parameter or member 'where' not described in 'pcmcia_write_config_byte'
drivers/pcmcia/pcmcia_resource.c:207: warning: Function parameter or member 'val' not described in 'pcmcia_write_config_byte'
drivers/pcmcia/pcmcia_resource.c:728: warning: Function parameter or member 'p_dev' not described in 'pcmcia_setup_isa_irq'
drivers/pcmcia/pcmcia_resource.c:728: warning: Function parameter or member 'type' not described in 'pcmcia_setup_isa_irq'
drivers/pcmcia/pcmcia_resource.c:793: warning: Function parameter or member 'p_dev' not described in 'pcmcia_setup_irq'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
[linux@dominikbrodowski.net: removed list of CCs]
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1b22dcf6 30-Jul-2018 Jia-Ju Bai <baijiaju1990@gmail.com>

pcmcia: pcmcia_resource: Replace mdelay() with msleep()

pcmcia_fixup_iowidth() and pcmcia_enable_device() are
never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 30779715 18-Aug-2018 Linus Torvalds <torvalds@linux-foundation.org>

pcmcia: remove long deprecated pcmcia_request_exclusive_irq() function

This function was created as a deprecated fallback case back in 2010 by
commit eb14120f743d ("pcmcia: re-work pcmcia_request_irq()") for legacy
cases.

Actual in-kernel users haven't been around for a long while. The last
in-kernel user was apparently removed four years ago by commit
5f5316fcd08e ("am2150: Update nmclan_cs.c to use update PCMCIA API").

Just remove it entirely.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# f2e6cf76 10-Oct-2014 Joe Perches <joe@perches.com>

pcmcia: Convert dev_printk to dev_<level>

Reduce object size a little by using dev_<level>
calls instead of dev_printk(KERN_<LEVEL>.

Other miscellanea:

o Coalesce formats
o Realign arguments
o Use pr_cont instead of naked printk
reorder test to use "%s\n"

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# e9c54999 27-Apr-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Revert wrong fixes for common misspellings

These changes were incorrectly fixed by codespell. They were now
manually corrected.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 33619f0d 18-Feb-2011 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: re-enable Zoomed Video support

Allow drivers to enable Zoomed Video support. Currently, this is only
used by out-of-tree drivers (L64020 DVB driver in particular).

CC: <stable@kernel.org> [for 2.6.37]
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# ff10fca5 22-Oct-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: IOCARD is also required for using IRQs

Dave Hinds pointed out to me that 37979e1546a7 will break b43 and
ray_cs, as IOCARD is not -- as the name would suggest -- only needed
for cards using IO ports. Instead, as it re-deines several pins, it
is also required for using interrupts.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1c4a77bf 18-Sep-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: add a few debug statements

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 9485ee14 30-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: Documentation update

Fill in missing descriptions and update some others for functions in
pcmcia_resource.c.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1ac71e5a 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: convert pcmcia_request_configuration to pcmcia_enable_device

pcmcia_enable_device() now replaces pcmcia_request_configuration().
Instead of config_req_t, all necessary flags are either passed as
a parameter to pcmcia_enable_device(), or (in rare circumstances)
set in struct pcmcia_device -> flags.

With the last remaining user of include/pcmcia/cs.h gone, remove
all references.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 7feabb64 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: move config_{base,index,regs} to struct pcmcia_device

Several drivers prefer to explicitly set config_{base,index,regs},
formerly known as ConfigBase, ConfigIndex and Present. Instead of
passing these values inside config_req_t, store it in struct
pcmcia_device.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 37979e15 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: simplify IntType

IntType was only set to INT_MEMORY (driver pcmciamtd) or INT_MEMORY_AND_IO
(all other drivers). As this flags seems to relate to ioport access, make
it conditional to the driver having requested IO port access. There are two
drivers which do not request IO ports, but did set INT_MEMORY_AND_IO:
ray_cs and b43. For those, we consistently only set INT_MEMORY in future.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# fc301101 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: simplify Status, ExtStatus register access

The Status (CISREG_CCSR) and ExtStatus (CISREG_ESR) registers were
only accessed to enable audio output for some drivers and IRQ for
serial_cs.c. The former also required setting config_req_t.Attributes
to CONF_ENABLE_SPKR; the latter can be simplified to setting this
field to CONF_ENABLE_ESR.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: linux-scsi@vger.kernel.org
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1a4a0460 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove Pin, Copy configuration register access

The "Pin" and "Copy" configuration registers (CISREG_SCR, CISREG_PPR)
do not seem to be utilized anywhere. If a device would request a
write to these registers, "0" would be written. Continue to do so, but
warn of unexpected behavior -- and remove the "Pin" and "Copy" entries
from config_req_t.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# e8405f0f 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: move Vpp setup to struct pcmcia_device

Some drivers prefer to explicitly set Vpp. Instead of passing the
voltage inside config_req_t, store it in struct pcmcia_device.

CC: linux-ide@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-mtd@lists.infradead.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# fb49fa53 29-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: split up modify_configuration() into two fixup functions

pcmcia_modify_configuration() was only used by two drivers to fix up
one issue each: setting the Vpp to a different value, and reducing
the IO width to 8 bit. Introduce two explicitly named functions
handling these things, and remove one further typedef.

CC: netdev@vger.kernel.org
CC: linux-mtd@lists.infradead.org
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# cdb13808 28-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: do not use win_req_t when calling pcmcia_request_window()

Instead of win_req_t, drivers are now requested to fill out
struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four iomem
ranges. After a call to pcmcia_request_window(), the windows found there
are reserved and may be used until pcmcia_release_window() is called.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-mtd@lists.infradead.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 7cdffc86 18-Sep-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: preserve configuration information if request_io fails partly

If pcmcia_request_io() only fails partly -- for the second of two
requested resources -- preserve the configuration settings for the
first one.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# eb838fe1 13-Sep-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: per-device, not per-socket debug messages

As the iomem / ioport setup differs per device, it is much better
to print out the device instead of the socket.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 127c03cd 03-Aug-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq

NR_IRQS may be as low as 16, causing a (harmless?) buffer overflow in
pcmcia_setup_isa_irq():

static u8 pcmcia_used_irq[NR_IRQS];

...

if ((try < 32) && pcmcia_used_irq[irq])
continue;

This is read-only, so if this address would be non-zero, it would just
mean we would not attempt an IRQ >= NR_IRQS -- which would fail anyway!
And as request_irq() fails for an irq >= NR_IRQS, the setting code path:

pcmcia_used_irq[irq]++;

is never reached as well.

Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
CC: stable@kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>


# ad0c7be2 25-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: insert PCMCIA device resources into resource tree

Insert PCMCIA device resources into the resource tree. However, this is
currently only implemented for sockets which do not statically map the
resources.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 0ca724d3 24-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: use struct resource for PCMCIA devices, part 2

Use struct resource * also for iomem resources.

CC: linux-mtd@lists.infradead.org
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# b5cb259e 24-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove memreq_t

Page already had to be set to 0; Offset can easily be passed as
parameter to pcmcia_map_mem_page.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: linux-bluetooth@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 90abdc3b 24-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: do not use io_req_t when calling pcmcia_request_io()

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.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 2ce4905e 24-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: use struct resource for PCMCIA devices

Introduce a new field into struct pcmcia_device named "resource" and of
type struct resource *, which contains the IO port ranges allocated for
this device. Memory window ranges and registration with the resource
trees will follow at a later date.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1d5cc192 23-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: use pcmica_{read,write}_config_byte

Use pcmcia_read_config_byte and pcmcia_write_config_byte instead
of pcmcia_access_configuration_register.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# ac8b4228 21-Jul-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove cs_types.h

Remove cs_types.h which is no longer needed: Most definitions aren't
used at all, a few can be made away with, and two remaining definitions
(typedefs, unfortunatley) may be moved to more specific places.

CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/)
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 418c5278 20-Jul-2010 Patrick McHardy <kaber@trash.net>

pcmcia: fix 'driver ... did not release config properly' warning

Up to 2.6.34 pcmcia_release_irq() reset p_dev->_irq to 0 after releasing
the irq. The IRQ is now released in pcmcia_disable_device(), however
p_dev->_irq is not reset, triggering a warning in pcmcia_device_remove().

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 059f667d 30-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: call pcmcia_{read,write}_cis_mem with ops_mutex held

This avoids multiple lock takings in several codepaths.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# b19a7275 20-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: clarify alloc_io_space, move it to resource handlers

Clean up the alloc_io_space() function by moving most of it to
the actual resource_ops. This allows for a bit less re-directions.
Future cleanups will follow, and will make up for the code
duplication currently present between rsrc_iodyn and rsrc_nonstatic
(which are hardly ever built at the same time anyway, therefore no
increase in built size).

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 5c128e84 20-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: move high level CIS access code to separate file

No code changes.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# eb14120f 06-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: re-work pcmcia_request_irq()

Instead of the old pcmcia_request_irq() interface, drivers may now
choose between:

- calling request_irq/free_irq directly. Use the IRQ from *p_dev->irq.

- use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
clean up automatically on calls to pcmcia_disable_device() or
device ejection.

- drivers still not capable of IRQF_SHARED (or not telling us so) may
use the deprecated pcmcia_request_exclusive_irq() for the time
being; they might receive a shared IRQ nonetheless.

CC: linux-bluetooth@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: linux-usb@vger.kernel.org
CC: linux-ide@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# a7debe78 07-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: pass FORCED_PULSE parameter in pcmcia_request_configuration()

As it's only used there it makes no sense relying on pcmcia_request_irq().

CC: alsa-devel@alsa-project.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 6f840afb 07-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: replace struct irq with uint pcmcia_irq in struct pcmcia_socket

As we don't need the "Config" counter any more, we can simplify
struct pcmcia_socket.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 6f0f38c4 08-Apr-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: setup IRQ to be used by PCMCIA drivers at card insert

Setup the IRQ to be used by PCMCIA drivers already during the device
registration stage, making use of a new function pcmcia_setup_irq().
This will allow us to get rid of quite a lot of indirection in the
future.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 0cb3c49c 06-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove unused IRQ modification feature

The IRQ modification feature was unused, and I see no reason to keep it.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# d3e03f4e 07-Apr-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: use previously assigned IRQ for all card functions

Use a previously assigned IRQ for all card functions, not only if
CONFIG_PCMCIA_PROBE is set.

Reported-by: Alexander Kurz <linux@kbdbabel.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 4e06e240 16-Mar-2010 Jiri Slaby <jirislaby@kernel.org>

PCMCIA: resource, fix lock imbalance

Stanse found that one error path (when alloc_skb fails) in netdev_tx
omits to unlock hw_priv->hwlock. Fix that by moving away from unlock in
each fail path. Unlock at one place instead.

Introduced in 94a819f80297e1f635a7cde4ed5317612e512ba7
(pcmcia: assert locking to struct pcmcia_device)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# b416cd8e 09-Mar-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: revert "irq probe can be done without risking an IRQ storm"

This reverts commit 635416ef393e8cec5a89fc6c1de710ee9596a51e. The
argument passed to request_irq() only affects action->flags (IRQF_*),
but IRQ_NOAUTOEN relates to desc->status.

Reported-by: Jan Beulich <JBeulich@novell.com>
CC: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 94a819f8 17-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: assert locking to struct pcmcia_device

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 64d8d46f 15-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: properly lock skt->irq, skt->irq_mask

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 9e86749c 15-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: lock ops->set_socket

As a side effect,
socket_state_t socket;
u_int state;
u_int suspended_state;
are properly protected now.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 8533ee31 12-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: lock ops->set_io_map()

As a side effect,
io_window_t io[MAX_IO_WIN];
is explicitely protected now.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 6b8e087b 12-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: add locking to set_mem_map()

Protect the pccard_operations callback "set_mem_map" by a new
mutex ops_mutex. This mutex also protects the following values
in struct pcmcia_socket:

pccard_mem_map win[]
pccard_mem_map cis_mem
void __iomem *cis_virt

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# a3ac9af5 06-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove remaining rsrc_mgr indirections

Move rsrc_mgr indirections only used by the pcmcia module to the
pcmcia module.

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# f9c316f4 06-Jan-2010 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove some rsrc_mgr indirections

Remove rsrc_mgr indirections only used by pcmcia_resource.c

Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 9fea84f4 07-Dec-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: CodingStyle fixes

Fix several CodingStyle issues in drivers/pcmcia/ . checkpatch.pl no longer
reports errors in the PCMCIA core. The remaining warnings mostly relate to
wrong indent -- PCMCIA historically used 4 spaces --, to lines over 80
characters and to hundreds of typedefs. The cleanup of those will follow
in the future.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 5fa9167a 08-Nov-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: rework the irq_req_t typedef

Most of the irq_req_t typedef'd struct can be re-worked quite
easily:

(1) IRQInfo2 was unused in any case, so drop it.

(2) IRQInfo1 was used write-only, so drop it.

(3) Instance (private data to be passed to the IRQ handler):
Most PCMCIA drivers using pcmcia_request_irq() to actually
register an IRQ handler set the "dev_id" to the same pointer
as the "priv" pointer in struct pcmcia_device. Modify the two
exceptions (ipwireless, ibmtr_cs) to also work this waym and
set the IRQ handler's "dev_id" to p_dev->priv unconditionally.

(4) Handler is to be of type irq_handler_t.

(5) Handler != NULL already tells whether an IRQ handler is present.
Therefore, we do not need the IRQ_HANDLER_PRESENT flag in
irq_req_t.Attributes.

CC: netdev@vger.kernel.org
CC: linux-bluetooth@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-scsi@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: Jaroslav Kysela <perex@perex.cz>
CC: Jiri Kosina <jkosina@suse.cz>
CC: Karsten Keil <isdn@linux-pingi.de>
for the Bluetooth parts: Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 6838b03f 02-Nov-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: pcmcia_request_window() doesn't need a pointer to a pointer

pcmcia_request_window() only needs a pointer to struct pcmcia_device, not
a pointer to a pointer.

CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-scsi@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
Acked-by: Karsten Keil <keil@b1-systems.de> (for ISDN)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 82f88e36 02-Nov-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove unused "window_t" typedef

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# d7b0364b 02-Nov-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: move some window-related code to pcmcia_ioctl.c

pcmcia_get_window() and pcmcia_get_mem_page() were only called from
pcmcia_ioctl.c. Therefore, move these functions to that file, and
remove the useless EXPORTs.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 0bdf9b3d 13-Dec-2006 Magnus Damm <damm@opensource.se>

pcmcia: Change window_handle_t logic to unsigned long

Logic changes based on top of the other patches:

This set of patches changed window_handle_t from being a pointer to an
unsigned long. The unsigned long is now a simple index into socket->win[].
Going from a pointer to unsigned long should leave the user space interface
unchanged unless I'm mistaken.

This change results in code that is less error prone and a user space
interface which is much cleaner and safer. A nice side effect is that we
are also are able to remove all members except one from window_t.

[ linux@dominikbrodowski.net:
Update to 2.6.31. Also, a plain "index" to socket->win[] does not
work, as several codepaths rely on "window_handle_t" being
non-zero if used. Therefore, set the window_handle_t to the
socket->win[] index + 1. ]

CC: netdev@vger.kernel.org
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 16456eba 13-Dec-2006 Magnus Damm <damm@opensource.se>

pcmcia: Pass struct pcmcia_socket to pcmcia_get_mem_page()

No logic changes, just pass struct pcmcia_socket to pcmcia_get_mem_page()

[linux@dominikbrodowski.net: update to 2.6.31]
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 868575d1 13-Dec-2006 Magnus Damm <damm@opensource.se>

pcmcia: Pass struct pcmcia_device to pcmcia_map_mem_page()

No logic changes, just pass struct pcmcia_device to pcmcia_map_mem_page()

[linux@dominikbrodowski.net: update to 2.6.31]
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-scsi@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
Acked-by: Karsten Keil <keil@b1-systems.de> (for ISDN)
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# f5560da5 13-Dec-2006 Magnus Damm <damm@opensource.se>

pcmcia: Pass struct pcmcia_device to pcmcia_release_window()

No logic changes, just pass struct pcmcia_device to pcmcia_release_window().

[linux@dominikbrodowski.net: update to 2.6.31]
CC: netdev@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 6d9a299f 23-Oct-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: extend error reporting and debug messages in core

Add a few more error and debug messages to the PCMCIA core.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# d50dbec3 22-Oct-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: use dynamic debug instead of custom infrastructure

Use the generic "dynamic debug" infrastructure instead of
CONIG_PCMCIA_DEBUG in the PCMCIA core (pcmcia.ko and pcmcia_core.ko). To
enable debugging, enable CONFIG_DYNAMIC_DEBUG, mount debugfs and

$ echo -n 'module pcmcia_core +p' > /sys/kernel/debug/dynamic_debug/control

for the complete module "pcmcia_core", for example. For more detailled
instructions, please see Documentation/dynamic-debug-howto.txt

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 91284224 18-Oct-2009 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: add new CIS access helpers

As a replacement to pcmcia_get_{first,next}_tuple() and
pcmcia_get_tuple_data(), three new -- and easier to use --
functions are added:

- pcmcia_get_tuple() to get the very first CIS entry of one
type.

- pcmcia_loop_tuple() to loop over all CIS entries of one type.

- pcmcia_get_mac_from_cis() to read out the hardware MAC address
from CISTPL_FUNCE.

Only a handful of drivers need these functions anyway, as most
CIS access is already handled by pcmcia_loop_config(), which
now shares the same backed (pccard_loop_tuple()) with
pcmcia_loop_tuple().

A pcmcia_get_mac_from_cis() bug noted by Komuro
<komurojun-mbn@nifty.com> has been fixed in this revision.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 889c2774 29-Jul-2009 Wolfram Sang <wsa@kernel.org>

pcmcia: document return value of pcmcia_loop_config

Hopefully it will be harder to get it wrong now. Also fix an unneeded
initialization while we are here.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d598de02 28-Jun-2009 Joe Perches <joe@perches.com>

pcmcia: drivers/pcmcia/pcmcia_resource.c: Remove unnecessary semicolons

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 60df3de8 30-Oct-2008 Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

pcmcia: fix indentation & braces disagreement - add braces

Broken by d8b0a49da4f2 (pcmcia: deprecate CS_BAD_VCC and
CS_BAD_VPP).

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 7bbfd39b 05-Oct-2008 Alan Cox <alan@redhat.com>

pcmcia: Whine harder about use of EXCLUSIVE

The exclusive IRQ line support is a legacy and any remaining drivers that
cannot share interrupts need tidying up so whine harder about them.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 2f3061eb 31-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: remove unused argument to pcmcia_parse_tuple()

Since we're just parsing the tuple being passed to this function, we don't
need any device-specific information.

Also, remove the call to pcmcia_validate_cis() from pcmciamtd.c, since it
is already called by the PCMCIA core.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# b60a5ede 25-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: merge ds_internal.h into cs_internal.h

Merge ds_internal.c into cs_internal.h.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 926c5402 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_BAD_ARGS

CS_BAD_ARGS mean a badly written driver or invalid userspace ioctl access,
so translate that to -EINVAL.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 69ba4433 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE

These four error values mostly mean a badly written driver, so ds_dbg()
output and -EINVAL seems to be enough.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 610e2374 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE

CS_BAD_TYPE was only used in cs.c and already properly annotated by error
messages. CS_BAD_ATTRIBUTE and CS_BAD_PAGE mean a badly written driver, so
ds_dbg() output and -EINVAL seems to be enough.

(includes bugfix from and
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 635d19be 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_NO_MORE_ITEMS

CS_NO_MORE_ITEMS is returned by the CIS tuple reading and parsing code if
the end of a tuple chain is reached. As at least one PCMCIA driver relies
on matching this return value, replace it with -ENOSPC which is now
uniquely used for this purpose within the in-kernel pcmcia subsystem.

CC: Russell King <rmk+kernel@arm.linux.org.uk>
CC: linux-serial@vger.kernel.org
CC: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# f958095e 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_IN_USE

If a resource is already in use, mark it with -EBUSY. Same for cards already
asleep.

(includes a fix for a bug found by Larry Finger -- thanks!)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 943f70f1 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_CONFIGURATION_LOCKED

This error code meant that trying to change the configuration after the
initialization phase is forbidden.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# ffb8da20 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_BAD_HANDLE

CS_BAD_HANDLE means that something went badly wrong: no parameter was passed,
or the paramater passed wasn't the correct one. Therefore, replace it with
-EINVAL.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 3939c1ef 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_NO_CARD

It means that no card can be detected in the socket, so return -ENODEV

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# d8b0a49d 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_BAD_VCC and CS_BAD_VPP

They were either used to report that changing voltage is not allowed, or that
changing voltage failed.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# de6405e9 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_UNSUPPORTED_*

CS_UNSUPPORTED_MODE and CS_UNSUPPORTED_FUNCTION were mostly used to denote
trying to use PCMCIA functions on CardBus cards.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1168386a 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_OUT_OF_RESOURCE

CS_OUT_OF_RESOURCE was almost only used to note -ENOMEM situations.
Therefore, use -ENOMEM explicitely, and also print out warnings.

CC: netdev@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 4c89e88b 03-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: deprecate CS_SUCCESS

Instead of using own error or success codes, the PCMCIA code should rely on
the generic return values. Therefore, replace all occurrences of CS_SUCCESS
with 0.

CC: netdev@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 64f34642 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: move pccard_get_configuration_info to ioctl

With the PCMCIA ioctl being the only remaining user of
_get_configuration_info, move the function to pcmcia_ioctl.c

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 7d16b658 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: don't add extra DEBUG cflag

Use CONFIG_PCMCIA_DEBUG instead of DEBUG so that dev_dbg() and other tricks
work properly.

(includes bugfixes from and
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
)

Signed-off-by: Dominik Broodwski <linux@dominikbrodowski.net>


# ac449d6e 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: use dev_printk in module pcmcia

(includes bugfix from and
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
)

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# ad913c11 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: pcmcia_config_loop() improvement by passing vcc

By passing the current Vcc setting to the pcmcia_config_loop callback
function, we can remove pcmcia_get_configuration_info() calls from many
drivers.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 8e2fc39d 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: pcmcia_config_loop() default CIS entry handling

Many drivers use the default CIS entry within their pcmcia_config_loop()
callback function. Therefore, factor the default CIS entry handling out.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 498ac189 02-Aug-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: pcmcia_config_loop() ConfigIndex unification

Almost all drivers set p_dev->conf.ConfigIndex to cfg->index in
the pcmcia_config_loop() callback function. Therefore, factor it out.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# a804b574 29-Jul-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: add pcmcia_loop_config() helper

By calling pcmcia_loop_config(), a pcmcia driver can iterate over all
available configuration options. During a driver's probe() phase, one
doesn't need to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data
and pcmcia_parse_tuple directly in most if not all cases.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 4aeba013 20-Jun-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: (re)move {pcmcia,pccard}_get_status

Except for one debug message in a driver marked BROKEN, pcmcia_get_status is
only used by the ioctl. Therefore, move it to pcmcia_ioctl.c and unexport it.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 6351a71c 16-Apr-2008 Adrian Bunk <bunk@kernel.org>

pcmcia: kill IN_CARD_SERVICES

IN_CARD_SERVICES was #define'd but not used, so let's remove it.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# ae49ec92 19-Jun-2008 Magnus Damm <damm@opensource.se>

pcmcia: remove unused bulkmem.h

The code in include/pcmcia/bulkmem.h was only kept for compatibility reasons.
Therefore, move the remaining region_info_t definition to ds.h

[linux@dominikbrodowski.net: do not modify the IOCTL, move definition to
ds.h, and update changelog]
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 635416ef 16-Jun-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

pcmcia: irq probe can be done without risking an IRQ storm

Nowdays you can ask for an IRQ to be allocated but not enabled, when PCMCIA
was written this was not true and this feature is thus not used

[linux@dominikbrodowski.net: add comment and ifdef to avoid compilation
breakage at least on alpha]
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# c1ac0228 14-Jun-2008 Dominik Brodowski <linux@dominikbrodowski.net>

pcmcia: check for pointer instead of pointer address

Bug noted by Michael Buesch: checking for the pointer address is always true.
This didn't matter much, for the very first check in pcmcia_release_window()
was for the pointer pointing to something, and the return value is ignored
here. Nonetheless, fix it.

CC: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# ecb8a847 04-Feb-2008 Olof Johansson <olof@lixom.net>

pcmcia: convert some internal-only ioaddr_t to unsigned int

Convert the io_req_t members to unsigned int, to allow use on machines with
more than 16 bits worth of IO ports (i.e. secondary busses on ppc64, etc).

There was only a couple of places in drivers where a change was needed. I
left printk formats alone (there are lots of %04x-style formats in there),
mostly to not change the format on the platforms that only have 16-bit io
addresses, but also because the padding doesn't really add all that much value
most of the time.

I found only one sprintf of an address, and upsized the string accordingly (I
doubt anyone will have anywhere near INT_MAX as irq value, but at least
there's room for it now).

Signed-off-by: Olof Johansson <olof@lixom.net>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 87373318 12-Sep-2006 Greg Kroah-Hartman <gregkh@suse.de>

Driver core: convert pcmcia code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Cc: <linux-pcmcia@lists.infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 4708b5fa 20-Oct-2006 Kaustav Majumdar <kaustav.majumdar@wipro.com>

[PATCH] pcmcia: update alloc_io_space for conflict checking for multifunction PC card

Some PCMCIA cards do not mention specific IO addresses in the CIS. In that
case, inside the alloc_io_space function, conflicts are detected (the
function returns 1) for the second function of a multifunction card unless
the length of IO address range required is greater than 0x100.

The following patch will remove this conflict checking for a PCMCIA
function which had not mentioned any specific IO address to be mapped from.

The patch is tested for Linux kernel 2.6.15.4 and works fine in the above
case and is as suggested by Dave Hinds.

Signed-off-by: Kaustav Majumdar <kaustav.majumdar@wipro.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 7d12e780 05-Oct-2006 David Howells <dhowells@redhat.com>

IRQ: Maintain regs pointer globally rather than passing to IRQ handlers

Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.

(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.

(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)


# 47a31976 30-Jul-2006 Daniel Ritz <daniel.ritz-ml@swissonline.ch>

[PATCH] pcmcia: fix ioctl GET_CONFIGURATION_INFO for pcmcia_cards

Values displayed when by cardctl config are horribly wrong for 16bit cards.
this fixes it up by not using memcpy() since source and target struct are
very different.

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# dace1453 01-Jul-2006 Thomas Gleixner <tglx@linutronix.de>

[PATCH] irq-flags: misc drivers: Use the new IRQF_ constants

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# c533120b 16-May-2006 Alan Cox <alan@lxorguk.ukuu.org.uk>

[PATCH] pcmcia: warn if driver requests exclusive, but gets a shared IRQ

The patch below cleans up the pcmcia code a bit on the IRQ side (I did
this while debugging the problem just so I could read wtf it was doing),
and also adds a warning and passes back the correct information when a
device asks for exclusive but gets given shared. This at least means the
dmesg dump of a problem triggered by this will have a signature to find.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 48b950ff 14-Apr-2006 Daniel Ritz <daniel.ritz-ml@swissonline.ch>

[PATCH] pcmcia/pcmcia_resource.c: fix crash when using Cardbus cards

Using the old ioctl interface together with cardbus card gives a NULL
pointer dereference since cardbus devices don't have a struct pcmcia_device.
also s->io[0].res can be NULL as well.

Fix is to move the pcmcia code after the cardbus code and to check for a null
pointer.

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 2aff541c 13-Apr-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: fix oops in static mapping case

As static maps do not have IO resources, this setting oopses. However, as
we do not ever read this value, we can safely remove it.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# a0aab143 04-Apr-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: do not set dev_node to NULL too early

If we set dev_node to NULL too early, some drivers which used this to
determine whether unregister_netdev() needs to be called fail when removing
a PCMCIA card.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# e2d40963 01-Mar-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: use bitfield instead of p_state and state

Instead of the two status values struct pcmcia_device->p_state and state,
use descriptive bitfields. Most value-checking in drivers was invalid, as
the core now only calls the ->remove() (a.k.a. detach) function in case the
attachement _and_ configuration was successful.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# b4c88400 19-Jan-2006 Adrian Bunk <bunk@stusta.de>

[PATCH] pcmcia: make pcmcia_release_{io,irq} static

We can now make pcmcia_release_{io,irq} static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# fd238232 05-Mar-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device

Embed dev_link_t into struct pcmcia_device(), as they basically address the
same entity. The actual contents of dev_link_t will be cleaned up step by step.
This patch includes a bugfix from and signed-off-by Andrew Morton.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# a78f4dd3 15-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: rename pcmcia_device.state

Rename pcmcia_device.state (which is used in very few places) to p_state
in order to avoid a namespace collision when moving the deprecated
dev_link_t into struct pcmcia_device

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 70294b46 14-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove unneeded Vcc pseudo setting

As we do not allow setting Vcc in the pcmcia core, and Vpp1 and
Vpp2 can only be set to the same value, a lot of code can be
streamlined.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 4bbed523 15-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove export of pcmcia_release_configuration

Handle the _modifying_ operation sm91c92_cs requires in
pcmcia_modify_configuration, so that the only remaining users
of pcmcia_release_configuration() are within the pcmcia core
module.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 50db3fdb 15-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: convert remaining users of pcmcia_release_io and _irq

Convert the remaining drivers which use pcmcia_release_io or
pcmcia_release_irq, and remove the EXPORT of these symbols.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 5f2a71fc 15-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: add pcmcia_disable_device

pcmcia_disable_device(struct pcmcia_device *p_dev) performs the necessary
cleanups upon device or driver removal: it calls the appropriate
pcmcia_release_* functions, and can replace (most) of the current drivers'
_release() functions.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# c7d00693 15-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove duplicate fields in io_window_t

BasePort, NumPorts and Attributes are or can be embedded in
struct resource, so remove them.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# e904663b 10-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove include of config.h

Remove the inclusion of include/config.h as it isn't needed any longer.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 855cdf13 10-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: always use device pointer to config_t

Update the remaining users using the static lookup table of the PCMCIA
function configuration to use the struct pcmcia_device-contained pointer.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# dbb22f0d 10-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: access config_t using pointer instead of array

Access the PCMCIA config_t struct (one per device function) using
a pointer in struct pcmcia_device, instead of looking them up in
an array.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# 1ae9c7d8 10-Jan-2006 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove unused field Present from config_t

config_t.Present is set to the same value as CardValues, which isn't modified
anywhere. Therefore, we can use only one of these two objects.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>


# bd65a685 09-Sep-2005 Brice Goglin <Brice.Goglin@ens-lyon.org>

[PATCH] pcmcia: add pcmcia to IRQ information

Add a devname parameter to the pcmcia_device structure, fills it with
"pcmcia<bus_id>" in pcmcia_device_add, and passes it to request_irq in
pcmcia_request_irq.

Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 71ed90d8 09-Sep-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove unused Vpp1, Vpp2 and Vcc

config_t->Vpp1, Vpp2 and Vcc are never read, so remove them.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# c181e0e0 09-Sep-2005 Daniel Ritz <daniel.ritz@gmx.ch>

[PATCH] fix pcmcia_request_irq() for multifunction card

multifunction cards need to have the same irq assigned to both functions.
the code tries that but fails because ret is still set to CS_IN_USE which
results in the function having the CB irq assigned. yenta_set_socket then
just changes the irq routing to use the PCI interrupt but the first
functions irq handler is registered on an ISA interrupt. boom.

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 531e5ca6 23-Aug-2005 Al Viro <viro@www.linux.org.uk>

[PATCH] missing include in pcmcia_resource.c

missing include of asm/irq.h

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# a1b274fb 28-Jul-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: fix sharing IRQs and request_irq without IRQ_HANDLE_PRESENT

Debugging and description from: Noah Misch <noah@cs.caltech.edu>

When a driver calls pcmcia_request_irq with IRQ_HANDLE_PRESENT unset, it looks
for an open IRQ by request_irq()ing with a dummy handler and NULL dev_info.
free_irq uses dev_info as a key for identifying the handler to free among
those sharing an IRQ, so request_irq returns -EINVAL if dev_info is NULL and
the IRQ may be shared. That unknown error code is the -EINVAL.

It looks like only pcnet_cs and axnet_cs are affected. Most other drivers let
pcmcia_request_irq install their interrupt handlers. sym53c500_cs requests
its IRQ manually, but it cannot share an IRQ.

The appended patch changes pcmcia_request_irq to pass an arbitrary, unique,
non-NULL dev_info with the dummy handler.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 44670d2b 07-Jul-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove references to pcmcia/version.h

As a follow-up, remove the inclusion of pcmcia/version.h in many files.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 2bc5a9bd 07-Jul-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: reduce client_handle_t usage

Reduce the occurences of "client_handle_t" which is nothing else than a
pointer to struct pcmcia_device by now.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# e12a9a93 07-Jul-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: remove client_t usage

Reduce the occurences of "client_handle_t" which is nothing else than a
pointer to struct pcmcia_device by now.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 57b6281c 27-Jun-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: 8 and 16 bit access for static_map

The PCMCIA card services layer is never setting the i/o map attributes when
SS_CAP_STATIC_MAP is specified. Net result, sockets' set_io_map() calls
always see requests with most flags clear, meaning 8 bit access.

For hardware that always autosizes, that won't matter; and all current
STATIC_MAP drivers ignore those attributes. A new driver (for at91rm9200)
suffers badly from this, since this forces everything into 8 bit mode and
that breaks both (a) cards requiring 16 bit access, and (b) ide-cs; but of
course 8-bit cards work OK (as does accessing card attributes).

So this patch arranges to pass the attributes down, matching the behavior
for non-static mappings (using the first/only I/O window).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 3448139b 27-Jun-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: ds.c cleanup

Clean up ds.c

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 1a8d4663 27-Jun-2005 Dominik Brodowski <linux@dominikbrodowski.net>

[PATCH] pcmcia: move pcmcia resource handling out of cs.c

Move the 16-bit PCMICA resource handling from pcmcia_core.o to pcmcia.o.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>