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>
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>
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>
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>
pccard_read_tuple(), which is only used by the PCMCIA core, should
handle TUPLE_RETURN_COMMON more sensibly: If a specific function (which
may be 0) is requested, set tuple.Attributes = 0 as was done in all
PCMCIA drivers. If, however, BIND_FN_ALL is requested, return the
"common" tuple. As to the callers of pccard_read_tuple():
- All calls to pcmcia_validate_cis() had set the "function" parameter to
BIND_FN_ALL. Therefore, remove the "function" parameter and make the
parameter to pccard_read_tuple explicit.
- Calls to CISTPL_VERS_1 and CISTPL_MANFID now set BIND_FN_ALL. This was
already the case for calls to CISTPL_LONGLINK_MFC.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Sparse asked whether these could be static.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
There are some places to be able to use printk_once instead of hard coding.
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
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>
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>
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>
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
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>
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>
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>
As cisinfo_t only contains one unsigned_int, pccard_validate_cis can
be simplified by passing that around directly.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Let pcmcia_ioctl interact with rsrc_nonstatic using functions which
rsrc_nonstatic.c has to use anyway.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
argh. A hunk got lost from "proc: remove proc_bus"
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Many struct file_operations in the kernel can be "const". Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data. In addition it'll catch accidental writes at compile time to
these shared resources.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
Handle __copy_from_user() return value.
drivers/pcmcia/pcmcia_ioctl.c:597: warning: ignoring return value of '__copy_from_user', declared with attribute warn_unused_result
Noticed and first fix by Randy Dunlap.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
the p_dev == NULL checks are wrong. the called functions handle a NULL
p_dev on their own. w/o this patch output of cardcctl status and cardctl
config is broken for cardbus cards or when the slot is empty.
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>
Fix some NULL dereferences in the pcmcia code when using old userland
tools.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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>
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>
Use mutexes in the PCMICA core, as they suffice for what needs to be done.
Includes a bugfix from and Signed-off-by Andrew Morton.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
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>
More visible user information of scheduled feature removal.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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>
The Linux PCMCIA code has some data that was apparently used (or meant to be
used) to ensure that only proper client drivers are loaded. This is now
ensured (to a certain degree) by the fact that the most client drivers are
part of the kernel. Also, the version information has not been updated
despite major changes in PCMCIA API. This has made it meaningless.
This patch removes servinfo_t and pcmcia_get_card_services_info. They are not
used in any userspace utilities such as pcmcia-cs and pcmciautils.
drivers/pcmcia/pcmcia_ioctl.c is adjusted accordingly.
CS_RELEASE and CS_RELEASE_CODE are removed. include/pcmcia/version.h is empty
now. It will be removed later, but for now it's left in the tree to avoid
touching all PCMCIA clients.
The only driver that needs to be changed is drivers/scsi/pcmcia/nsp_cs.c,
which uses CS_RELEASE_CODE.
Signed-off-by: Pavel Roskin <proski@gnu.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>
register_chrdev() can return errors (negative) other then -EBUSY, so check
for any negative error code.
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>