Staging: ipack: implement ipack device table.

The modaliases look like ipack:fXvNdM, where X is the format version (8
bit) and N and M are the vendor and device ID represented as 32 bit
hexadecimal numbers each. Using 32 bits allows us to define IPACK_ANY_ID
as (~0) without interfering with the valid ids.

The resulting modalias string for ipoctal.ko looks like this (once
ipoctal provides a device table):
alias:          ipack:f01v000000F0d00000048*
alias:          ipack:f01v000000F0d0000002A*
alias:          ipack:f01v000000F0d00000022*
(output from modinfo)

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jens Taprogge 2012-09-04 17:01:13 +02:00 committed by Greg Kroah-Hartman
parent 1f43d7bfac
commit 849e0ad257
4 changed files with 75 additions and 0 deletions

View file

@ -966,6 +966,21 @@ static int do_isapnp_entry(const char *filename,
}
ADD_TO_DEVTABLE("isapnp", struct isapnp_device_id, do_isapnp_entry);
/* Looks like: "ipack:fNvNdN". */
static int do_ipack_entry(const char *filename,
struct ipack_device_id *id, char *alias)
{
id->vendor = TO_NATIVE(id->vendor);
id->device = TO_NATIVE(id->device);
strcpy(alias, "ipack:");
ADD(alias, "f", id->format != IPACK_ANY_ID, id->format);
ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor);
ADD(alias, "d", id->device != IPACK_ANY_ID, id->device);
add_wildcard(alias);
return 1;
}
ADD_TO_DEVTABLE("ipack", struct ipack_device_id, do_ipack_entry);
/*
* Append a match expression for a single masked hex digit.
* outp points to a pointer to the character at which to append.