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>
Komuro pointed out that IRQ_FIRST_SHARED is not used at all in the
PCMCIA subsystem, so remove it. Also, remove two bogus assignments.
CC: Karsten Keil <keil@b1-systems.de>
CC: netdev@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: Komuro <komurojun-mbn@nifty.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
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>
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>
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>
As all in-tree drivers have been converted to not use cs_error() any more,
drop these functions and definitions, and update the Documentation.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
Commit 0c570cdeb8
(PM / yenta: Fix cardbus suspend/resume regression) caused resume to
fail on systems with two CardBus bridges. While the exact nature
of the failure is not known at the moment, it can be worked around by
splitting the yenta resume into an early part, executed during the
early phase of resume, that will only resume the socket and power it
up if there was a card in it during suspend, and a late part,
executed during "regular" resume, that will carry out all of the
remaining yenta resume operations.
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=14334, which is a
listed regression from 2.6.31.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reported-by: Stephen J. Gowdy <gowdy@cern.ch>
Tested-by: Jose Marino <braket@hotmail.com>
pcmcia_socket_dev_suspend() doesn't use its second argument, so it
may be dropped safely.
This change is necessary for the subsequent yenta suspend/resume fix.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: stable@kernel.org
Physical addresses are currently represented as int or long types.
However, this does not work for processors like the PPC440EPx, which
is a 32-bit processor with a 36-bit address space. This patch uses
the phys_addr_t type, which correctly holds a 36-bit address on
this processor.
Signed-off-by: Steven A. Falco <sfalco@harris.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
cisinfo_t and cs_status_t are only used by the (deprecated) PCMCIA
ioctl. Therefore, move them out of the way.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
16-bit PCMCIA device handling function definitions are moved to ds.h,
internal definitions to cs_internal.h.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Wrap in #ifdef to include header just once, and wrap in another #ifdef
to avoid it being used in userspace. Also, format the header similar to
the other PCMCIA header files.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
By now, ioaddr_t should only be used by the deprecated ioctl, as it does not
correctly reflect the maximum ioport range at least on some architectures.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
The header file primarily used for (in-kernel) PCMCIA device drivers
also deserved a major cleanup. This header file also serves as the dumping
ground for all typedefs and definitions only used by the deprecated PCMCIA
ioctl and the deprecated PCMCIA userspace tools using this ioctl.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
The header file for use by (in-kernel) PCMCIA sockets deserved a major
cleanup. Some stuff only used by the pcmcia core modules was moved to
cs_internal.h
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Use dev_printk() in cs_error()-based error reporting. While this
function-turned-macro will hopefully go away soon, using dev_printk
simplifies the code much.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Remoe the CS_ error codes. Drivers are expected to use default
error definitions (errno.h etc.).
Only one CS_ error code -- CS_IN_USE -- is used internally by the
(deprecated) pcmcia-cs userspace package. Therefore, keep this one
around so that it still compiles.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
CS_BAD_TUPLE was used to denote a bad tuple being passed to the parse
function. Therefore, replace it with -EINVAL and a verbose message.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
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>
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>
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>
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>
This error code meant that trying to change the configuration after the
initialization phase is forbidden.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
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>
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>
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>
Deprecate unused CS_ error codes by replacing their definitions with
generic error messages, and removing them from the error_t lookup table.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
* pcmcia-config-loop:
pcmcia: pcmcia_config_loop() improvement by passing vcc
pcmcia: pcmcia_config_loop() default CIS entry handling
pcmcia: pcmcia_config_loop() ConfigIndex unification
pcmcia: use pcmcia_loop_config in misc pcmcia drivers
pcmcia: use pcmcia_loop_config in net pcmcia drivers
pcmcia: use pcmcia_loop_config in ISDN pcmcia drivers
pcmcia: use pcmcia_loop_config in scsi pcmcia drivers
pcmcia: use pcmcia_loop_config in bluetooth drivers
pcmcia: use pcmcia_loop_config in pata and ide drivers
pcmcia: add pcmcia_loop_config() helper
* pcmcia-printk:
pcmcia: don't add extra DEBUG cflag
pcmcia: remove unused cs_socket_name() definition
pcmcia: use dev_printk in module rsrc_nonstatic
pcmcia: use dev_printk in module pcmcia
pcmcia: use dev_printk in module pcmcia_core
pcmcia: use dev_printk and dev_dbg in yenta_socket
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>
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>
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>
Instead of copying CIS override data in socket_sysfs.c or ds.c, and then again
in cistpl.c, only do so once. Also, cisdump_t is now only used by the
deprecated ioctl.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>