FYI: Userland breakage caused by udev bind commit

2018-12-23 Thread Marcus Meissner
Hi,

I am the maintainer of libmtp and libgphoto2

Some months ago I was made aware of this bug:
https://bugs.kde.org/show_bug.cgi?id=387454

This was fallout identified to come from this kernel commit:

commit 1455cf8dbfd06aa7651dcfccbadb7a093944ca65
Author: Dmitry Torokhov 
Date:   Wed Jul 19 17:24:30 2017 -0700

If distributions would be using libmtp and libgphoto2 udev rules
that just triggered on "add" events, and not the new "bind" events,
the missing "attribute tagging" of the "bind" events would confused the
KDE Solid device detection and make the devices no longer detected.

This did not affect distributions that rely on the newer "hwdb"
device detection method.

I have released fixed libmtp and libgphoto2 versions in November, so
this is under control, but wanted to bring this up as a "kernel caused
userland breakage".

Ciao, Marcus


Re: [kernel-hardening] Re: [PATCH v5 next 5/5] net: modules: use request_module_cap() to load 'netdev-%s' modules

2017-12-01 Thread Marcus Meissner
On Tue, Nov 28, 2017 at 06:49:20PM -0500, Theodore Ts'o wrote:
> On Tue, Nov 28, 2017 at 03:29:01PM -0800, Kees Cook wrote:
> > > So in these two cases, if the kernel was built w/o modules, and HDLC
> > > and DCCP was built-in, you'd be screwed, then?
> > 
> > Sure, but that's not the common situation.
> > 
> > > Is the goal here to protect people using distro kernels which build
> > > the world as modules, including dodgy pieces of kernel code that are
> > > bug-ridden?
> > 
> > The bulk of the risk comes from distro kernels, yes. (Though "bug
> > ridden" is a strong statement. There are and will be bugs, scattered
> > across a wide portion of the kernel, it's just that modules tend to
> > cover most of that attack surface.)
> 
> OK, but if the goal is to protect users who are running distro
> kernels, then a kernel config that breaks some percentage of users is
> highly unlikely to be enabled by Red Hat and SuSE, right?  And
> many of these users either can't (from a skills perspective) or won't
> (because they lose all support from the enterprise distro's help desk)
> recompile their kernel to enable an "might break 3% of all users ---
> oh, well" config option.

Yes, breaking customers is not seen lightly.

I also (not related to this thread here, more to SLAB hardening et.al)
have a hard time getting performance losses caused by hardening features 
approved.
 
> Which argues for being extremely conservative about making something
> that has an extremely low probability of breaking users, and it points
> out why Geo Kozey's "who cares about breaking users; security is
> IMPORTANT" argument is so wrong-headed.
> 
> If the goal is to protect distro kernels, but a sloppy approach
> guarantees that distro kernels will never enable it, is it really
> worth it?
> 
>- Ted
> 
> P.S.  This is where it might be useful to get some input from the Red
> Hat and SuSE support teams.  How many angry user calls to their help
> desk are they willing to field before they'll just turn off the kernel
> config option for their kernels?

Speaking for SUSE ... If something that worked for people before and
it breaks, we do get feedback. If no one used it however, we won't.

For our last major product we went over the network module list and 
disabled some for building. e.g. DCCP is no longer built. We did
not receive any complaints about missing DCCP to my knowledge.

We also seperate our modules into "regular supported" and "unsupported"
in different RPMs. The "unsupported" module packages are not shipped on
the Server product. They were shipped on the desktop as some of the WiFi
drivers were requested by customers but were considered not supportable.

We do review this supportable list between kernel version jumps.

Ciao, Marcus


Re: [kernel-hardening] Re: [PATCH v5 next 5/5] net: modules: use request_module_cap() to load 'netdev-%s' modules

2017-12-01 Thread Marcus Meissner
On Tue, Nov 28, 2017 at 06:49:20PM -0500, Theodore Ts'o wrote:
> On Tue, Nov 28, 2017 at 03:29:01PM -0800, Kees Cook wrote:
> > > So in these two cases, if the kernel was built w/o modules, and HDLC
> > > and DCCP was built-in, you'd be screwed, then?
> > 
> > Sure, but that's not the common situation.
> > 
> > > Is the goal here to protect people using distro kernels which build
> > > the world as modules, including dodgy pieces of kernel code that are
> > > bug-ridden?
> > 
> > The bulk of the risk comes from distro kernels, yes. (Though "bug
> > ridden" is a strong statement. There are and will be bugs, scattered
> > across a wide portion of the kernel, it's just that modules tend to
> > cover most of that attack surface.)
> 
> OK, but if the goal is to protect users who are running distro
> kernels, then a kernel config that breaks some percentage of users is
> highly unlikely to be enabled by Red Hat and SuSE, right?  And
> many of these users either can't (from a skills perspective) or won't
> (because they lose all support from the enterprise distro's help desk)
> recompile their kernel to enable an "might break 3% of all users ---
> oh, well" config option.

Yes, breaking customers is not seen lightly.

I also (not related to this thread here, more to SLAB hardening et.al)
have a hard time getting performance losses caused by hardening features 
approved.
 
> Which argues for being extremely conservative about making something
> that has an extremely low probability of breaking users, and it points
> out why Geo Kozey's "who cares about breaking users; security is
> IMPORTANT" argument is so wrong-headed.
> 
> If the goal is to protect distro kernels, but a sloppy approach
> guarantees that distro kernels will never enable it, is it really
> worth it?
> 
>- Ted
> 
> P.S.  This is where it might be useful to get some input from the Red
> Hat and SuSE support teams.  How many angry user calls to their help
> desk are they willing to field before they'll just turn off the kernel
> config option for their kernels?

Speaking for SUSE ... If something that worked for people before and
it breaks, we do get feedback. If no one used it however, we won't.

For our last major product we went over the network module list and 
disabled some for building. e.g. DCCP is no longer built. We did
not receive any complaints about missing DCCP to my knowledge.

We also seperate our modules into "regular supported" and "unsupported"
in different RPMs. The "unsupported" module packages are not shipped on
the Server product. They were shipped on the desktop as some of the WiFi
drivers were requested by customers but were considered not supportable.

We do review this supportable list between kernel version jumps.

Ciao, Marcus


Re: [oss-security] Linux kernel ping socket / AF_LLC connect() sin_family race

2017-04-04 Thread Marcus Meissner
Hi,

did anyone request a CVE yet?

Ciao, Marcus
On Sat, Mar 25, 2017 at 01:10:57AM +0100, Solar Designer wrote:
> On Fri, Mar 24, 2017 at 03:21:06PM -0700, Eric Dumazet wrote:
> > Looks easy enough to fix ?
> 
> Oh.  Probably.  Thanks.  Need to test, but I guess you already did?
> 
> > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> > index
> > 2af6244b83e27ae384e96cf071c10c5a89674804..ccfbce13a6333a65dab64e4847dd510dfafb1b43
> > 100644
> > --- a/net/ipv4/ping.c
> > +++ b/net/ipv4/ping.c
> > @@ -156,17 +156,18 @@ int ping_hash(struct sock *sk)
> >  void ping_unhash(struct sock *sk)
> >  {
> > struct inet_sock *isk = inet_sk(sk);
> > +
> > pr_debug("ping_unhash(isk=%p,isk->num=%u)\n", isk, isk->inet_num);
> > +   write_lock_bh(_table.lock);
> > if (sk_hashed(sk)) {
> > -   write_lock_bh(_table.lock);
> > hlist_nulls_del(>sk_nulls_node);
> > sk_nulls_node_init(>sk_nulls_node);
> > sock_put(sk);
> > isk->inet_num = 0;
> > isk->inet_sport = 0;
> > sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
> > -   write_unlock_bh(_table.lock);
> > }
> > +   write_unlock_bh(_table.lock);
> >  }
> >  EXPORT_SYMBOL_GPL(ping_unhash);
> 
> FWIW, in Pavel's original implementation for 2.4.32 (unused), this was:
> 
> static void ping_v4_unhash(struct sock *sk)
> {
>   DEBUG(("ping_v4_unhash(sk=%p,sk->num=%u)\n", sk, sk->num));
>   write_lock_bh(_hash_lock);
>   if (sk->pprev) {
>   if (sk->next)
>  sk->next->pprev = sk->pprev;
>   *sk->pprev = sk->next;
>   sk->pprev = NULL;
>   sk->num = 0;
>   sock_prot_dec_use(sk->prot);
>   __sock_put(sk);
>   }
>   write_unlock_bh(_hash_lock);
> }
> 
> Looks like the erroneous optimization (not expecting concurrent activity
> on the same socket?) was introduced during conversion to 2.6's hlists.
> 
> So far this cursed function had 3 bugs, two of them security (including
> this one) and one probably benign (or if not, then effectively a subset
> of this bug as it performed some unneeded / stale debugging work before
> acquiring the lock), with all 3 introduced in forward-porting.  Maybe
> the nature of forward-porting activity makes people relatively
> inattentive ("compiles with the new interfaces and still works? must be
> correct"), compared to when writing new code.
> 
> Anyhow, I share some responsibility for this mess, for having advocated
> this patch being forward-ported and merged back then.  I still like
> having this functionality and its userspace security benefits... but I
> don't like the kernel bugs.
> 
> Alexander
> 

-- 
Marcus Meissner,SUSE LINUX GmbH; Maxfeldstrasse 5; D-90409 Nuernberg; Zi. 
3.1-33,+49-911-740 53-432,,serv=loki,mail=wotan,type=real <meiss...@suse.de>


Re: [oss-security] Linux kernel ping socket / AF_LLC connect() sin_family race

2017-04-04 Thread Marcus Meissner
Hi,

did anyone request a CVE yet?

Ciao, Marcus
On Sat, Mar 25, 2017 at 01:10:57AM +0100, Solar Designer wrote:
> On Fri, Mar 24, 2017 at 03:21:06PM -0700, Eric Dumazet wrote:
> > Looks easy enough to fix ?
> 
> Oh.  Probably.  Thanks.  Need to test, but I guess you already did?
> 
> > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> > index
> > 2af6244b83e27ae384e96cf071c10c5a89674804..ccfbce13a6333a65dab64e4847dd510dfafb1b43
> > 100644
> > --- a/net/ipv4/ping.c
> > +++ b/net/ipv4/ping.c
> > @@ -156,17 +156,18 @@ int ping_hash(struct sock *sk)
> >  void ping_unhash(struct sock *sk)
> >  {
> > struct inet_sock *isk = inet_sk(sk);
> > +
> > pr_debug("ping_unhash(isk=%p,isk->num=%u)\n", isk, isk->inet_num);
> > +   write_lock_bh(_table.lock);
> > if (sk_hashed(sk)) {
> > -   write_lock_bh(_table.lock);
> > hlist_nulls_del(>sk_nulls_node);
> > sk_nulls_node_init(>sk_nulls_node);
> > sock_put(sk);
> > isk->inet_num = 0;
> > isk->inet_sport = 0;
> > sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
> > -   write_unlock_bh(_table.lock);
> > }
> > +   write_unlock_bh(_table.lock);
> >  }
> >  EXPORT_SYMBOL_GPL(ping_unhash);
> 
> FWIW, in Pavel's original implementation for 2.4.32 (unused), this was:
> 
> static void ping_v4_unhash(struct sock *sk)
> {
>   DEBUG(("ping_v4_unhash(sk=%p,sk->num=%u)\n", sk, sk->num));
>   write_lock_bh(_hash_lock);
>   if (sk->pprev) {
>   if (sk->next)
>  sk->next->pprev = sk->pprev;
>   *sk->pprev = sk->next;
>   sk->pprev = NULL;
>   sk->num = 0;
>   sock_prot_dec_use(sk->prot);
>   __sock_put(sk);
>   }
>   write_unlock_bh(_hash_lock);
> }
> 
> Looks like the erroneous optimization (not expecting concurrent activity
> on the same socket?) was introduced during conversion to 2.6's hlists.
> 
> So far this cursed function had 3 bugs, two of them security (including
> this one) and one probably benign (or if not, then effectively a subset
> of this bug as it performed some unneeded / stale debugging work before
> acquiring the lock), with all 3 introduced in forward-porting.  Maybe
> the nature of forward-porting activity makes people relatively
> inattentive ("compiles with the new interfaces and still works? must be
> correct"), compared to when writing new code.
> 
> Anyhow, I share some responsibility for this mess, for having advocated
> this patch being forward-ported and merged back then.  I still like
> having this functionality and its userspace security benefits... but I
> don't like the kernel bugs.
> 
> Alexander
> 

-- 
Marcus Meissner,SUSE LINUX GmbH; Maxfeldstrasse 5; D-90409 Nuernberg; Zi. 
3.1-33,+49-911-740 53-432,,serv=loki,mail=wotan,type=real 


authenc methods vs FIPS in light of unencrypted associated data

2016-06-02 Thread Marcus Meissner
Hi,

In February I already tagged some authenc ciphers for FIPS compatibility.

I currently revisit this to get testmgr running all the tests in strict FIPS 
mode.

The authenc() class is troublesome.

There is a HASH + ENC part of this method, but you can also add associated data,
which is not encrypted. (using the ctx->null cipher in crypto/authenc.c)

But in FIPS mode the crypto_authenc_init_tfm does:

null = crypto_get_default_null_skcipher();

which results in error, as the crypto_alloc_blkcipher("ecb(cipher_null)", 0, 0);
results in failure due to "ecb(cipher_null)" not FIPS compliant.

How to handle this?

I think GCM also does not encrypt, just hashes, the associated data, it just 
does
copy the content itself and does not use a virtual cipher.

Ciao, Marcus


authenc methods vs FIPS in light of unencrypted associated data

2016-06-02 Thread Marcus Meissner
Hi,

In February I already tagged some authenc ciphers for FIPS compatibility.

I currently revisit this to get testmgr running all the tests in strict FIPS 
mode.

The authenc() class is troublesome.

There is a HASH + ENC part of this method, but you can also add associated data,
which is not encrypted. (using the ctx->null cipher in crypto/authenc.c)

But in FIPS mode the crypto_authenc_init_tfm does:

null = crypto_get_default_null_skcipher();

which results in error, as the crypto_alloc_blkcipher("ecb(cipher_null)", 0, 0);
results in failure due to "ecb(cipher_null)" not FIPS compliant.

How to handle this?

I think GCM also does not encrypt, just hashes, the associated data, it just 
does
copy the content itself and does not use a virtual cipher.

Ciao, Marcus


[PATCH] crypto: allow rfc3686 aes-ctr variants in fips mode.

2016-02-19 Thread Marcus Meissner
RFC 3686 CTR in various authenc methods.

rfc3686(ctr(aes)) is already marked fips compliant,
so these should be fine.

Signed-off-by: Marcus Meissner <meiss...@suse.de>
---
 crypto/testmgr.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 190a290..5316d59 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2167,6 +2167,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha1),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha224),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2239,6 +2243,10 @@ static const struct alg_test_desc alg_test_descs[] = {
.test = alg_test_null,
.fips_allowed = 1,
}, {
+   .alg = "authenc(hmac(sha256),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2270,6 +2278,10 @@ static const struct alg_test_desc alg_test_descs[] = {
.test = alg_test_null,
.fips_allowed = 1,
}, {
+   .alg = "authenc(hmac(sha384),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha512),cbc(aes))",
.fips_allowed = 1,
.test = alg_test_aead,
@@ -2315,6 +2327,10 @@ static const struct alg_test_desc alg_test_descs[] = {
.test = alg_test_null,
.fips_allowed = 1,
}, {
+   .alg = "authenc(hmac(sha512),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "cbc(aes)",
.test = alg_test_skcipher,
.fips_allowed = 1,
-- 
2.1.4



[PATCH] crypto: allow rfc3686 aes-ctr variants in fips mode.

2016-02-19 Thread Marcus Meissner
RFC 3686 CTR in various authenc methods.

rfc3686(ctr(aes)) is already marked fips compliant,
so these should be fine.

Signed-off-by: Marcus Meissner 
---
 crypto/testmgr.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 190a290..5316d59 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2167,6 +2167,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha1),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha224),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2239,6 +2243,10 @@ static const struct alg_test_desc alg_test_descs[] = {
.test = alg_test_null,
.fips_allowed = 1,
}, {
+   .alg = "authenc(hmac(sha256),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2270,6 +2278,10 @@ static const struct alg_test_desc alg_test_descs[] = {
.test = alg_test_null,
.fips_allowed = 1,
}, {
+   .alg = "authenc(hmac(sha384),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha512),cbc(aes))",
.fips_allowed = 1,
.test = alg_test_aead,
@@ -2315,6 +2327,10 @@ static const struct alg_test_desc alg_test_descs[] = {
.test = alg_test_null,
.fips_allowed = 1,
}, {
+   .alg = "authenc(hmac(sha512),rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "cbc(aes)",
.test = alg_test_skcipher,
.fips_allowed = 1,
-- 
2.1.4



[PATCH] crypto: fips: allow more ipsec related methods

2016-02-09 Thread Marcus Meissner
IPSEC for aes-ctr requests:

authenc(digest_null,rfc3686(ctr(aes)))

which can be used in FIPS mode.

rfc3686(ctr(aes)) is already allowed for FIPS usage.

I also allowed "digest_null" for FIPS usage.

Signed-off-by: Marcus Meissner 
---
 crypto/testmgr.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 190a290..6ad8ba2 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2089,6 +2089,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(digest_null,rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(md5),ecb(cipher_null))",
.test = alg_test_aead,
.suite = {
@@ -2768,6 +2772,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "digest_null",
.test = alg_test_null,
+   .fips_allowed = 1,
}, {
.alg = "drbg_nopr_ctr_aes128",
.test = alg_test_drbg,
-- 
2.1.4



[PATCH] crypto: fips: allow more ipsec related methods

2016-02-09 Thread Marcus Meissner
IPSEC for aes-ctr requests:

authenc(digest_null,rfc3686(ctr(aes)))

which can be used in FIPS mode.

rfc3686(ctr(aes)) is already allowed for FIPS usage.

I also allowed "digest_null" for FIPS usage.

Signed-off-by: Marcus Meissner <meiss...@suse.de>
---
 crypto/testmgr.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 190a290..6ad8ba2 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2089,6 +2089,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(digest_null,rfc3686(ctr(aes)))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(md5),ecb(cipher_null))",
.test = alg_test_aead,
.suite = {
@@ -2768,6 +2772,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "digest_null",
.test = alg_test_null,
+   .fips_allowed = 1,
}, {
.alg = "drbg_nopr_ctr_aes128",
.test = alg_test_drbg,
-- 
2.1.4



[PATCH] crypto: mark authenticated ctr(aes) also as FIPS able

2016-02-06 Thread Marcus Meissner
(2nd try that adds missing , to build.)

Signed-off-by: Marcus Meissner 
---
 crypto/testmgr.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ae8c57fd..7d66cf8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2143,6 +2143,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha1),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha1),ecb(cipher_null))",
.test = alg_test_aead,
.suite = {
@@ -2227,6 +2231,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha256),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2253,6 +2261,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha384),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha512),cbc(aes))",
.test = alg_test_aead,
.suite = {
@@ -2292,6 +2304,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha512),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "cbc(aes)",
.test = alg_test_skcipher,
.fips_allowed = 1,
-- 
2.1.4



[PATCH] crypto: mark authenticated ctr(aes) also as FIPS able

2016-02-06 Thread Marcus Meissner
(2nd try that adds missing , to build.)

Signed-off-by: Marcus Meissner <meiss...@suse.de>
---
 crypto/testmgr.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ae8c57fd..7d66cf8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2143,6 +2143,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha1),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha1),ecb(cipher_null))",
.test = alg_test_aead,
.suite = {
@@ -2227,6 +2231,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha256),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2253,6 +2261,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha384),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha512),cbc(aes))",
.test = alg_test_aead,
.suite = {
@@ -2292,6 +2304,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha512),ctr(aes))",
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "cbc(aes)",
.test = alg_test_skcipher,
.fips_allowed = 1,
-- 
2.1.4



Re: [PATCH 2/2] crypto: testmgr: mark more algorithms as FIPS compliant

2016-02-05 Thread Marcus Meissner
On Fri, Feb 05, 2016 at 02:41:01PM +0100, Stephan Mueller wrote:
> Am Freitag, 5. Februar 2016, 14:22:25 schrieb Marcus Meissner:
> 
> Hi Marcus,
> 
> >Some more authenc() wrapped algorithms are FIPS compliant, tag
> >them as such.
> 
> Is this patch a duplication of the first one?

yes, I mistakenly sent it as part of a series, while it is not.

Ciao, Marcus


[PATCH] crypto: testmgr: mark more algorithms as FIPS compliant

2016-02-05 Thread Marcus Meissner
Some more authenc() wrapped algorithms are FIPS compliant, tag
them as such.

Signed-off-by: Marcus Meissner 
---
 crypto/testmgr.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ff6a799..b0cbad8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2132,6 +2132,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha1),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2181,6 +2182,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha224),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2194,6 +2196,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(aes))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2220,6 +2223,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2250,6 +2254,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha384),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2266,6 +2271,7 @@ static const struct alg_test_desc alg_test_descs[] = {
.fips_allowed = 1,
}, {
.alg = "authenc(hmac(sha512),cbc(aes))",
+   .fips_allowed = 1,
.test = alg_test_aead,
.suite = {
.aead = {
@@ -2293,6 +2299,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha512),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
-- 
2.1.4



[PATCH 2/2] crypto: testmgr: mark more algorithms as FIPS compliant

2016-02-05 Thread Marcus Meissner
Some more authenc() wrapped algorithms are FIPS compliant, tag
them as such.

Signed-off-by: Marcus Meissner 
---
 crypto/testmgr.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ff6a799..b0cbad8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2132,6 +2132,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha1),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2181,6 +2182,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha224),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2194,6 +2196,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(aes))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2220,6 +2223,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2250,6 +2254,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha384),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2266,6 +2271,7 @@ static const struct alg_test_desc alg_test_descs[] = {
.fips_allowed = 1,
}, {
.alg = "authenc(hmac(sha512),cbc(aes))",
+   .fips_allowed = 1,
.test = alg_test_aead,
.suite = {
.aead = {
@@ -2293,6 +2299,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha512),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
-- 
2.1.4



[PATCH 2/2] crypto: testmgr: mark more algorithms as FIPS compliant

2016-02-05 Thread Marcus Meissner
Some more authenc() wrapped algorithms are FIPS compliant, tag
them as such.

Signed-off-by: Marcus Meissner <meiss...@suse.de>
---
 crypto/testmgr.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ff6a799..b0cbad8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2132,6 +2132,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha1),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2181,6 +2182,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha224),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2194,6 +2196,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(aes))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2220,6 +2223,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2250,6 +2254,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha384),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2266,6 +2271,7 @@ static const struct alg_test_desc alg_test_descs[] = {
.fips_allowed = 1,
}, {
.alg = "authenc(hmac(sha512),cbc(aes))",
+   .fips_allowed = 1,
.test = alg_test_aead,
.suite = {
.aead = {
@@ -2293,6 +2299,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha512),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
-- 
2.1.4



[PATCH] crypto: testmgr: mark more algorithms as FIPS compliant

2016-02-05 Thread Marcus Meissner
Some more authenc() wrapped algorithms are FIPS compliant, tag
them as such.

Signed-off-by: Marcus Meissner <meiss...@suse.de>
---
 crypto/testmgr.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ff6a799..b0cbad8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2132,6 +2132,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha1),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2181,6 +2182,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha224),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2194,6 +2196,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(aes))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2220,6 +2223,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha256),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2250,6 +2254,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha384),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
@@ -2266,6 +2271,7 @@ static const struct alg_test_desc alg_test_descs[] = {
.fips_allowed = 1,
}, {
.alg = "authenc(hmac(sha512),cbc(aes))",
+   .fips_allowed = 1,
.test = alg_test_aead,
.suite = {
.aead = {
@@ -2293,6 +2299,7 @@ static const struct alg_test_desc alg_test_descs[] = {
}, {
.alg = "authenc(hmac(sha512),cbc(des3_ede))",
.test = alg_test_aead,
+   .fips_allowed = 1,
.suite = {
.aead = {
.enc = {
-- 
2.1.4



Re: [PATCH 2/2] crypto: testmgr: mark more algorithms as FIPS compliant

2016-02-05 Thread Marcus Meissner
On Fri, Feb 05, 2016 at 02:41:01PM +0100, Stephan Mueller wrote:
> Am Freitag, 5. Februar 2016, 14:22:25 schrieb Marcus Meissner:
> 
> Hi Marcus,
> 
> >Some more authenc() wrapped algorithms are FIPS compliant, tag
> >them as such.
> 
> Is this patch a duplication of the first one?

yes, I mistakenly sent it as part of a series, while it is not.

Ciao, Marcus


[PATCH] crypto: mark authenticated ctr(aes) also as FIPS able

2016-02-04 Thread Marcus Meissner
Signed-off-by: Marcus Meissner 
---
 crypto/testmgr.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ae8c57fd..ff6a799 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2143,6 +2143,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha1),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha1),ecb(cipher_null))",
.test = alg_test_aead,
.suite = {
@@ -2227,6 +2231,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha256),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2253,6 +2261,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha384),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha512),cbc(aes))",
.test = alg_test_aead,
.suite = {
@@ -2292,6 +2304,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha512),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "cbc(aes)",
.test = alg_test_skcipher,
.fips_allowed = 1,
-- 
2.1.4



[PATCH] crypto: mark authenticated ctr(aes) also as FIPS able

2016-02-04 Thread Marcus Meissner
Signed-off-by: Marcus Meissner <meiss...@suse.de>
---
 crypto/testmgr.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ae8c57fd..ff6a799 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2143,6 +2143,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha1),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha1),ecb(cipher_null))",
.test = alg_test_aead,
.suite = {
@@ -2227,6 +2231,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha256),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.suite = {
@@ -2253,6 +2261,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha384),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "authenc(hmac(sha512),cbc(aes))",
.test = alg_test_aead,
.suite = {
@@ -2292,6 +2304,10 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "authenc(hmac(sha512),ctr(aes))"
+   .test = alg_test_null,
+   .fips_allowed = 1,
+   }, {
.alg = "cbc(aes)",
.test = alg_test_skcipher,
.fips_allowed = 1,
-- 
2.1.4



PATCH: scsi: make scsi reset permissions more relaxed (RFC)

2013-08-30 Thread Marcus Meissner
Hi folks,

cdrecord wants to whack the CD drive with a SCSI RESET ...

So far SCSI RESET can be done at 4 levels (target, device, bus, host)
and all 4 are checked for CAP_SYS_ADMIN / CAP_SYS_RAWIO.


As the cdrecord author wants special permissions for cdrecord, readcd ,
cdda2wav to allow it to send SCSI RESET commands I was wondering if
relaxing the permission is a potential idea?

This would allow SCSI reset on target/device if a local user
gets regular access to a SCSI device (via udev acls etc.)


(I know that the actual reset code will fall back into the chain
 target -> device -> bus -> host resetting if one fails.)

Signed-off-by: Marcus Meissner 

Ciao, Marcus
---
 drivers/scsi/scsi_ioctl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index d9564fb..770720e 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -306,22 +306,26 @@ int scsi_nonblockable_ioctl(struct scsi_device *sdev, int 
cmd,
return 0;
switch (val) {
case SG_SCSI_RESET_DEVICE:
+   /* allowed if you can send scsi commands to the device 
*/
val = SCSI_TRY_RESET_DEVICE;
break;
case SG_SCSI_RESET_TARGET:
+   /* allowed if you can send scsi commands to the device 
*/
val = SCSI_TRY_RESET_TARGET;
break;
case SG_SCSI_RESET_BUS:
+   if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
+   return -EACCES;
val = SCSI_TRY_RESET_BUS;
break;
case SG_SCSI_RESET_HOST:
+   if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
+   return -EACCES;
val = SCSI_TRY_RESET_HOST;
break;
default:
return -EINVAL;
}
-   if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
-   return -EACCES;
return (scsi_reset_provider(sdev, val) ==
SUCCESS) ? 0 : -EIO;
}
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


PATCH: scsi: make scsi reset permissions more relaxed (RFC)

2013-08-30 Thread Marcus Meissner
Hi folks,

cdrecord wants to whack the CD drive with a SCSI RESET ...

So far SCSI RESET can be done at 4 levels (target, device, bus, host)
and all 4 are checked for CAP_SYS_ADMIN / CAP_SYS_RAWIO.


As the cdrecord author wants special permissions for cdrecord, readcd ,
cdda2wav to allow it to send SCSI RESET commands I was wondering if
relaxing the permission is a potential idea?

This would allow SCSI reset on target/device if a local user
gets regular access to a SCSI device (via udev acls etc.)


(I know that the actual reset code will fall back into the chain
 target - device - bus - host resetting if one fails.)

Signed-off-by: Marcus Meissner meiss...@suse.de

Ciao, Marcus
---
 drivers/scsi/scsi_ioctl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index d9564fb..770720e 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -306,22 +306,26 @@ int scsi_nonblockable_ioctl(struct scsi_device *sdev, int 
cmd,
return 0;
switch (val) {
case SG_SCSI_RESET_DEVICE:
+   /* allowed if you can send scsi commands to the device 
*/
val = SCSI_TRY_RESET_DEVICE;
break;
case SG_SCSI_RESET_TARGET:
+   /* allowed if you can send scsi commands to the device 
*/
val = SCSI_TRY_RESET_TARGET;
break;
case SG_SCSI_RESET_BUS:
+   if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
+   return -EACCES;
val = SCSI_TRY_RESET_BUS;
break;
case SG_SCSI_RESET_HOST:
+   if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
+   return -EACCES;
val = SCSI_TRY_RESET_HOST;
break;
default:
return -EINVAL;
}
-   if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
-   return -EACCES;
return (scsi_reset_provider(sdev, val) ==
SUCCESS) ? 0 : -EIO;
}
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tokenring/3c359.c: fixed array index problem

2007-10-13 Thread Marcus Meissner
Hi,

I tried to send this to netdev and various maintainers, but
they seem not to have seen it.

Please add to -mm and have it merged somewhere.


The xl_laa array is just 6 bytes long, so we should substract
10 from the index, like is also done some lines above already.

Signed-Off-By: Marcus Meissner <[EMAIL PROTECTED]>
---
 drivers/net/tokenring/3c359.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 7224d36..5d31519 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -760,7 +760,7 @@ static int xl_open_hw(struct net_device *dev)
if (xl_priv->xl_laa[0]) {  /* If using a LAA address */
for (i=10;i<16;i++) { 
writel( (MEM_BYTE_WRITE | 0xD | xl_priv->srb) + i, 
xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-   writeb(xl_priv->xl_laa[i],xl_mmio + MMIO_MACDATA) ; 
+   writeb(xl_priv->xl_laa[i-10],xl_mmio + MMIO_MACDATA) ;
}
memcpy(dev->dev_addr,xl_priv->xl_laa,dev->addr_len) ; 
} else { /* Regular hardware address */ 
-- 
1.5.2.4

-- 
Working, but not speaking, for the following german company:
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tokenring/3c359.c: fixed array index problem

2007-10-13 Thread Marcus Meissner
Hi,

I tried to send this to netdev and various maintainers, but
they seem not to have seen it.

Please add to -mm and have it merged somewhere.


The xl_laa array is just 6 bytes long, so we should substract
10 from the index, like is also done some lines above already.

Signed-Off-By: Marcus Meissner [EMAIL PROTECTED]
---
 drivers/net/tokenring/3c359.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 7224d36..5d31519 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -760,7 +760,7 @@ static int xl_open_hw(struct net_device *dev)
if (xl_priv-xl_laa[0]) {  /* If using a LAA address */
for (i=10;i16;i++) { 
writel( (MEM_BYTE_WRITE | 0xD | xl_priv-srb) + i, 
xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-   writeb(xl_priv-xl_laa[i],xl_mmio + MMIO_MACDATA) ; 
+   writeb(xl_priv-xl_laa[i-10],xl_mmio + MMIO_MACDATA) ;
}
memcpy(dev-dev_addr,xl_priv-xl_laa,dev-addr_len) ; 
} else { /* Regular hardware address */ 
-- 
1.5.2.4

-- 
Working, but not speaking, for the following german company:
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [2.6 patch] kernel/audit.c: change the exports to EXPORT_SYMBOL_GPL

2007-07-29 Thread Marcus Meissner
On Sun, Jul 29, 2007 at 11:40:33AM -0700, Arjan van de Ven wrote:
> On Sun, 2007-07-29 at 17:02 +0200, Adrian Bunk wrote:
> > This patch changes some completely unused audit exports from 
> > EXPORT_SYMBOL to EXPORT_SYMBOL_GPL.
> > 
> > They are still completely unused, but hopefully some of the theoretical 
> > code that might use it will appear in the kernel in the near future...

AppArmor uses the audit_log_* functions. (But it is GPL, so no worries).

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [2.6 patch] kernel/audit.c: change the exports to EXPORT_SYMBOL_GPL

2007-07-29 Thread Marcus Meissner
On Sun, Jul 29, 2007 at 11:40:33AM -0700, Arjan van de Ven wrote:
 On Sun, 2007-07-29 at 17:02 +0200, Adrian Bunk wrote:
  This patch changes some completely unused audit exports from 
  EXPORT_SYMBOL to EXPORT_SYMBOL_GPL.
  
  They are still completely unused, but hopefully some of the theoretical 
  code that might use it will appear in the kernel in the near future...

AppArmor uses the audit_log_* functions. (But it is GPL, so no worries).

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH try #3] security: Convert LSM into a static interface

2007-06-25 Thread Marcus Meissner
In article <[EMAIL PROTECTED]> you wrote:
> Convert LSM into a static interface, as the ability to unload a security
> module is not required by in-tree users and potentially complicates the
> overall security architecture.
> 
> Needlessly exported LSM symbols have been unexported, to help reduce API
> abuse.
> 
> Parameters for the capability and root_plug modules are now specified
> at boot.
> 
> The SECURITY_FRAMEWORK_VERSION macro has also been removed.
> 
> Signed-off-by: James Morris <[EMAIL PROTECTED]>

NAK.

First, such an interface should be obsoleted by first making an entry
to Documentation/feature-removal-schedule.txt and waiting for some months.

Second, security modules that cannot be loaded/unloaded can just marked
so and the LSM interface kept as-is.

You are aware of the out of tree users, like AppArmor and other security
modules and there are also several antivirus modules like dazuko, mcafee
(got riddance for the latter, but in general) using LSM.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH try #3] security: Convert LSM into a static interface

2007-06-25 Thread Marcus Meissner
In article [EMAIL PROTECTED] you wrote:
 Convert LSM into a static interface, as the ability to unload a security
 module is not required by in-tree users and potentially complicates the
 overall security architecture.
 
 Needlessly exported LSM symbols have been unexported, to help reduce API
 abuse.
 
 Parameters for the capability and root_plug modules are now specified
 at boot.
 
 The SECURITY_FRAMEWORK_VERSION macro has also been removed.
 
 Signed-off-by: James Morris [EMAIL PROTECTED]

NAK.

First, such an interface should be obsoleted by first making an entry
to Documentation/feature-removal-schedule.txt and waiting for some months.

Second, security modules that cannot be loaded/unloaded can just marked
so and the LSM interface kept as-is.

You are aware of the out of tree users, like AppArmor and other security
modules and there are also several antivirus modules like dazuko, mcafee
(got riddance for the latter, but in general) using LSM.

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: revert PIE randomization?

2007-01-06 Thread Marcus Meissner
On Sat, Jan 06, 2007 at 10:45:05PM +0100, Ingo Molnar wrote:
> 
> * Marcus Meissner <[EMAIL PROTECTED]> wrote:
> 
> > > You're right. I'm inclined to just revert it, modulo some comments 
> > > from others. Marcus?
> > 
> > After thinking about this, yes.
> > 
> > I would rather have a working range used here (perhaps like Hugh 
> > suggested), but feel free to revert the original patch if you are not 
> > confident with it.
> 
> i'm wondering why you had to try to reinvent the wheel, instead of 
> picking up exec-shield's remaining bits of randomization implementation 
> from Fedora, which was tested for a long time and achieves PIE 
> randomization and more?

Because it is i386 only last time I checked.

And it requires relaying out the heap (which you did only for i386), with
architecture specific code, which I was too afraid to touch.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: revert PIE randomization?

2007-01-06 Thread Marcus Meissner
On Sat, Jan 06, 2007 at 01:04:02PM -0800, Linus Torvalds wrote:
> 
> 
> On Sat, 6 Jan 2007, Hugh Dickins wrote:
> > 
> > Isn't that randomization, anywhere from 0x1 to ELF_ET_DYN_BASE,
> > sure to place the ET_DYN from time to time just where the comment says
> > it's trying to avoid?  I assume that somehow results in the error reported.
> 
> Hmm.. It's certainly the case that it would appear that the randomization 
> might put the binary just under the heap, and cause conflicts with brk 
> and the mmap heap.
> 
> You're right. I'm inclined to just revert it, modulo some comments from 
> others. Marcus?

After thinking about this, yes.

I would rather have a working range used here (perhaps like Hugh suggested),
but feel free to revert the original patch if you are not confident with it.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: revert PIE randomization?

2007-01-06 Thread Marcus Meissner
On Sat, Jan 06, 2007 at 01:04:02PM -0800, Linus Torvalds wrote:
 
 
 On Sat, 6 Jan 2007, Hugh Dickins wrote:
  
  Isn't that randomization, anywhere from 0x1 to ELF_ET_DYN_BASE,
  sure to place the ET_DYN from time to time just where the comment says
  it's trying to avoid?  I assume that somehow results in the error reported.
 
 Hmm.. It's certainly the case that it would appear that the randomization 
 might put the binary just under the heap, and cause conflicts with brk 
 and the mmap heap.
 
 You're right. I'm inclined to just revert it, modulo some comments from 
 others. Marcus?

After thinking about this, yes.

I would rather have a working range used here (perhaps like Hugh suggested),
but feel free to revert the original patch if you are not confident with it.

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: revert PIE randomization?

2007-01-06 Thread Marcus Meissner
On Sat, Jan 06, 2007 at 10:45:05PM +0100, Ingo Molnar wrote:
 
 * Marcus Meissner [EMAIL PROTECTED] wrote:
 
   You're right. I'm inclined to just revert it, modulo some comments 
   from others. Marcus?
  
  After thinking about this, yes.
  
  I would rather have a working range used here (perhaps like Hugh 
  suggested), but feel free to revert the original patch if you are not 
  confident with it.
 
 i'm wondering why you had to try to reinvent the wheel, instead of 
 picking up exec-shield's remaining bits of randomization implementation 
 from Fedora, which was tested for a long time and achieves PIE 
 randomization and more?

Because it is i386 only last time I checked.

And it requires relaying out the heap (which you did only for i386), with
architecture specific code, which I was too afraid to touch.

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


PATCH: cciss small pci id table patch

2001-06-28 Thread Marcus Meissner

Hi,

The cciss driver in 2.4.5-ac19 is missing the terminating {0,}.

Ciao, Marcus

Index: drivers/block/cciss.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/block/cciss.c,v
retrieving revision 1.23
diff -u -r1.23 cciss.c
--- drivers/block/cciss.c   2001/05/27 18:05:54 1.23
+++ drivers/block/cciss.c   2001/06/28 15:27:34
@@ -63,6 +63,7 @@
 0x0E11, 0x4080, 0, 0, 0},
{ PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSB,
 0x0E11, 0x4082, 0, 0, 0},
+   {0,}
 };
 MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Why we need LDT at all in 2.2 kernels ??

2001-06-28 Thread Marcus Meissner

In article <[EMAIL PROTECTED]> you wrote:
> Hi,
>  In 2.2 kernel do we really need its own LDT (not default_ldt) for every
> process (no mm sharing) ??

> In what circumstances a process may need its own LDT ??

When using the Windows Emulator WINE and related projects (WordPerfect 2000)
for instance.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Why we need LDT at all in 2.2 kernels ??

2001-06-28 Thread Marcus Meissner

In article [EMAIL PROTECTED] you wrote:
 Hi,
  In 2.2 kernel do we really need its own LDT (not default_ldt) for every
 process (no mm sharing) ??

 In what circumstances a process may need its own LDT ??

When using the Windows Emulator WINE and related projects (WordPerfect 2000)
for instance.

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: cciss small pci id table patch

2001-06-28 Thread Marcus Meissner

Hi,

The cciss driver in 2.4.5-ac19 is missing the terminating {0,}.

Ciao, Marcus

Index: drivers/block/cciss.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/block/cciss.c,v
retrieving revision 1.23
diff -u -r1.23 cciss.c
--- drivers/block/cciss.c   2001/05/27 18:05:54 1.23
+++ drivers/block/cciss.c   2001/06/28 15:27:34
@@ -63,6 +63,7 @@
 0x0E11, 0x4080, 0, 0, 0},
{ PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSB,
 0x0E11, 0x4082, 0, 0, 0},
+   {0,}
 };
 MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



BUG: 2.4.x NFS client mmap race

2001-06-02 Thread Marcus Meissner

Hi,

While debugging a rather strange WINE problem I came across a 2.4.x 
NFS race condition.

I trimmed down the WINE code to a very small testcase, attached below, 
which has following test patterns:

ext2 local  : SUCCESS
2.4.5-ac6  -> 2.2.10 (unfsd): FAIL
2.4.2-ac26 -> 2.4.2ac26 (knfsd) : FAIL
2.2.14 -> 2.4.2ac26 (knfsd) : SUCCESS

For me this looks like there is a problem in the 2.4 NFS client.

The sleep() appears to be a key part. If we only sleep 1 second the
test usually succeeds. With 5 it always fails.

I am using the default mount options for nfs.

Ciao, Marcus

#include 
#include 
#include 
#include 
#include 
#include 
#include 

main() {
int fd;
unsigned char *ptr;
char buf[10];

memset(buf,'0',10);

fd = open("/home/lstcore/mm/test.out",O_RDWR|O_CREAT|O_TRUNC,0644);
assert(fd!=-1);


ftruncate(fd,512);
ptr=mmap(NULL,512,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0);
ptr[0]=0x42;
munmap(ptr,512);

sleep(5);

ftruncate(fd,69632);
ptr=mmap(NULL,69632,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0);
assert(ptr[0]==0x42);

fprintf(stderr,"There was no race. Lucky you!\n");
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



BUG: 2.4.x NFS client mmap race

2001-06-02 Thread Marcus Meissner

Hi,

While debugging a rather strange WINE problem I came across a 2.4.x 
NFS race condition.

I trimmed down the WINE code to a very small testcase, attached below, 
which has following test patterns:

ext2 local  : SUCCESS
2.4.5-ac6  - 2.2.10 (unfsd): FAIL
2.4.2-ac26 - 2.4.2ac26 (knfsd) : FAIL
2.2.14 - 2.4.2ac26 (knfsd) : SUCCESS

For me this looks like there is a problem in the 2.4 NFS client.

The sleep() appears to be a key part. If we only sleep 1 second the
test usually succeeds. With 5 it always fails.

I am using the default mount options for nfs.

Ciao, Marcus

#include stdio.h
#include assert.h
#include fcntl.h
#include unistd.h
#include sys/types.h
#include sys/mman.h
#include sys/stat.h

main() {
int fd;
unsigned char *ptr;
char buf[10];

memset(buf,'0',10);

fd = open(/home/lstcore/mm/test.out,O_RDWR|O_CREAT|O_TRUNC,0644);
assert(fd!=-1);


ftruncate(fd,512);
ptr=mmap(NULL,512,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0);
ptr[0]=0x42;
munmap(ptr,512);

sleep(5);

ftruncate(fd,69632);
ptr=mmap(NULL,69632,PROT_WRITE|PROT_READ,MAP_SHARED,fd,0);
assert(ptr[0]==0x42);

fprintf(stderr,There was no race. Lucky you!\n);
}
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: ns558 bugfix / CSC ids

2001-06-01 Thread Marcus Meissner

Hi,

I have added two CSC function ids to the ISAPNP joystick probing.
CSC cards use a lot of varying ids for the functions, but in my
set of data, 0010 and 0110 are always 'CTL'Game Controllers.

One bugfix: port->size must be set, or the release_region on rmmod ns558
fails badly.

Tested on IBM Netfinity 3500.

Ciao, Marcus

Index: drivers/char/joystick/ns558.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/char/joystick/ns558.c,v
retrieving revision 1.16
diff -u -r1.16 ns558.c
--- drivers/char/joystick/ns558.c   2001/06/01 11:33:11 1.16
+++ drivers/char/joystick/ns558.c   2001/06/01 15:31:09
@@ -178,6 +178,8 @@
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','T','L'), 
ISAPNP_DEVICE(0x7001), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','T','L'), 
ISAPNP_DEVICE(0x7002), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), 
ISAPNP_DEVICE(0x0b35), 0 },
+   { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), 
+ISAPNP_DEVICE(0x0010), 0 },
+   { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), 
+ISAPNP_DEVICE(0x0110), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('P','N','P'), 
ISAPNP_DEVICE(0xb02f), 0 },
{ 0, },
 };
@@ -217,6 +219,7 @@
port->next = next;
port->type = NS558_PNP;
port->gameport.io = ioport;
+   port->size = iolen;
port->dev = dev;
 
gameport_register_port(>gameport);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: ns558 bugfix / CSC ids

2001-06-01 Thread Marcus Meissner

Hi,

I have added two CSC function ids to the ISAPNP joystick probing.
CSC cards use a lot of varying ids for the functions, but in my
set of data, 0010 and 0110 are always 'CTL'Game Controllers.

One bugfix: port-size must be set, or the release_region on rmmod ns558
fails badly.

Tested on IBM Netfinity 3500.

Ciao, Marcus

Index: drivers/char/joystick/ns558.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/char/joystick/ns558.c,v
retrieving revision 1.16
diff -u -r1.16 ns558.c
--- drivers/char/joystick/ns558.c   2001/06/01 11:33:11 1.16
+++ drivers/char/joystick/ns558.c   2001/06/01 15:31:09
@@ -178,6 +178,8 @@
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','T','L'), 
ISAPNP_DEVICE(0x7001), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','T','L'), 
ISAPNP_DEVICE(0x7002), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), 
ISAPNP_DEVICE(0x0b35), 0 },
+   { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), 
+ISAPNP_DEVICE(0x0010), 0 },
+   { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('C','S','C'), 
+ISAPNP_DEVICE(0x0110), 0 },
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('P','N','P'), 
ISAPNP_DEVICE(0xb02f), 0 },
{ 0, },
 };
@@ -217,6 +219,7 @@
port-next = next;
port-type = NS558_PNP;
port-gameport.io = ioport;
+   port-size = iolen;
port-dev = dev;
 
gameport_register_port(port-gameport);
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ln -s broken on 2.4.5

2001-05-30 Thread Marcus Meissner

On Wed, May 30, 2001 at 10:49:18PM +0100, Alan Cox wrote:
> > The problem is only there if you specify a directory for the linked to
> > component.
> > 
> > [marcus@wine /tmp]$ strace -f ln -s fupp/berk xxx
> > execve("/bin/ln", ["ln", "-s", "fupp/berk", "xxx"], [/* 39 vars */]) = 0
> > ... ld stuff ... locale stuff ... 
> 
> bash-2.04$ ln -s foo/frob eep
> bash-2.04$ ls -l eep
> lrwxrwxrwx1 alan users   8 May 30 22:19 eep -> foo/frob

*sigh*

I just rebooted and it is no longer reproducable.

Sorry for the confusion caused.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ln -s broken on 2.4.5

2001-05-30 Thread Marcus Meissner

In article <[EMAIL PROTECTED]> you wrote:
>> I downloaded the linux 2.4.5 sources and built and installed them on my
>> system.  Since then, I've noticed strange file system behavior:

> What file system. Its find on my 2.4.5-ac with ext2

100% reproducible on NFS and EXT2 here, with following:

$ ln -s fupp/bar bar
$ ls -la bar
lrwxrwxrwx   1 marcus   users   3 May 30 20:30 bar -> bar
$ 

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: 3c509 PNP80f7 id

2001-05-30 Thread Marcus Meissner

Hi,

This adds the PNP80f7 compat Id to 3c509.c, making it now autodetect my 
'3C509B EtherLink III'.

BTW, there is a problem there:

It has a card id of TCM5094 and a function id of PNP80f7, the cardid is
already there, but only probed as function id...

Anyway, I will let the dust settle on the ISAPNP module issue first before
fixing it ;)

Ciao, Marcus

Index: drivers/net/3c509.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/net/3c509.c,v
retrieving revision 1.17
diff -u -r1.17 3c509.c
--- drivers/net/3c509.c 2001/05/03 13:16:01 1.17
+++ drivers/net/3c509.c 2001/05/30 11:03:21
@@ -192,6 +191,9 @@
ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5098),
(long) "3Com Etherlink III (TPC)" },
{   ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+   ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f7),
+   (long) "3Com Etherlink III compatible" },
+   {   ISAPNP_ANY_ID, ISAPNP_ANY_ID,
ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f8),
(long) "3Com Etherlink III compatible" },
{ } /* terminate list */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: 3c509 PNP80f7 id

2001-05-30 Thread Marcus Meissner

Hi,

This adds the PNP80f7 compat Id to 3c509.c, making it now autodetect my 
'3C509B EtherLink III'.

BTW, there is a problem there:

It has a card id of TCM5094 and a function id of PNP80f7, the cardid is
already there, but only probed as function id...

Anyway, I will let the dust settle on the ISAPNP module issue first before
fixing it ;)

Ciao, Marcus

Index: drivers/net/3c509.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/net/3c509.c,v
retrieving revision 1.17
diff -u -r1.17 3c509.c
--- drivers/net/3c509.c 2001/05/03 13:16:01 1.17
+++ drivers/net/3c509.c 2001/05/30 11:03:21
@@ -192,6 +191,9 @@
ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5098),
(long) 3Com Etherlink III (TPC) },
{   ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+   ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f7),
+   (long) 3Com Etherlink III compatible },
+   {   ISAPNP_ANY_ID, ISAPNP_ANY_ID,
ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f8),
(long) 3Com Etherlink III compatible },
{ } /* terminate list */
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ln -s broken on 2.4.5

2001-05-30 Thread Marcus Meissner

In article [EMAIL PROTECTED] you wrote:
 I downloaded the linux 2.4.5 sources and built and installed them on my
 system.  Since then, I've noticed strange file system behavior:

 What file system. Its find on my 2.4.5-ac with ext2

100% reproducible on NFS and EXT2 here, with following:

$ ln -s fupp/bar bar
$ ls -la bar
lrwxrwxrwx   1 marcus   users   3 May 30 20:30 bar - bar
$ 

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ln -s broken on 2.4.5

2001-05-30 Thread Marcus Meissner

On Wed, May 30, 2001 at 10:49:18PM +0100, Alan Cox wrote:
  The problem is only there if you specify a directory for the linked to
  component.
  
  [marcus@wine /tmp]$ strace -f ln -s fupp/berk xxx
  execve(/bin/ln, [ln, -s, fupp/berk, xxx], [/* 39 vars */]) = 0
  ... ld stuff ... locale stuff ... 
 
 bash-2.04$ ln -s foo/frob eep
 bash-2.04$ ls -l eep
 lrwxrwxrwx1 alan users   8 May 30 22:19 eep - foo/frob

*sigh*

I just rebooted and it is no longer reproducable.

Sorry for the confusion caused.

Ciao, Marcus
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Linux 2.4.4-ac15

2001-05-24 Thread Marcus Meissner

In article <[EMAIL PROTECTED]> you wrote:

>   ftp://ftp.kernel.org/pub/linux/kernel/people/alan/2.4/

>Intermediate diffs are available from
>   http://www.bzimage.org


> 2.4.4-ac15
> o Merge Linus 2.4.5pre5
>   | Also fixes a dumb bug in my mmx fixups I=20
>   | managed to forget to test and spot
> o Dump the ACPI changes - new ones are pending(me)
>   and the old ones are better than this lot
> o Revert serial incompatibility pending nice fix  (me)
> o Move a few other oddments to match Linus
> o Rip format conversion out of the pwc driver (me)
>   | It belongs in user space..

You appear to have reverted the DAC960 driver back to the previous version.
Was this intended?

Ciao, Marcus

diff -u -r1.10 -r1.11
--- Documentation/README.DAC960 2001/05/03 13:02:39 1.10
+++ Documentation/README.DAC960 2001/05/23 21:56:42 1.11
@@ -1,17 +1,17 @@
Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers

-   Version 2.2.10 for Linux 2.2.18
-   Version 2.4.10 for Linux 2.4.1
+   Version 2.2.9 for Linux 2.2.17
+   Version 2.4.9 for Linux 2.4.0

  PRODUCTION RELEASE

-  1 February 2001
+  7 September 2000

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Linux 2.4.4-ac15

2001-05-24 Thread Marcus Meissner

In article [EMAIL PROTECTED] you wrote:

   ftp://ftp.kernel.org/pub/linux/kernel/people/alan/2.4/

Intermediate diffs are available from
   http://www.bzimage.org


 2.4.4-ac15
 o Merge Linus 2.4.5pre5
   | Also fixes a dumb bug in my mmx fixups I=20
   | managed to forget to test and spot
 o Dump the ACPI changes - new ones are pending(me)
   and the old ones are better than this lot
 o Revert serial incompatibility pending nice fix  (me)
 o Move a few other oddments to match Linus
 o Rip format conversion out of the pwc driver (me)
   | It belongs in user space..

You appear to have reverted the DAC960 driver back to the previous version.
Was this intended?

Ciao, Marcus

diff -u -r1.10 -r1.11
--- Documentation/README.DAC960 2001/05/03 13:02:39 1.10
+++ Documentation/README.DAC960 2001/05/23 21:56:42 1.11
@@ -1,17 +1,17 @@
Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers

-   Version 2.2.10 for Linux 2.2.18
-   Version 2.4.10 for Linux 2.4.1
+   Version 2.2.9 for Linux 2.2.17
+   Version 2.4.9 for Linux 2.4.0

  PRODUCTION RELEASE

-  1 February 2001
+  7 September 2000

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: more esssolo1 cleanups

2001-05-22 Thread Marcus Meissner

Hi,

I did some more cleanups:
- changed PM to 2.4 pci module style
- removed global list of devices, now using pci device data.

I tried to add a pci_set_power_state(dev,3) in _remove, but this apparently
has no effect (amplifier stays switched on), so I did not submit this part.

Tested on IBM ThinkPad 390E.

Ciao, Marcus

Index: drivers/sound/esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.12
diff -u -r1.12 esssolo1.c
--- drivers/sound/esssolo1.c2001/05/18 08:06:38 1.12
+++ drivers/sound/esssolo1.c2001/05/22 12:28:54
@@ -79,6 +79,9 @@
  *   for abs. Bug report by Andrew Morton <[EMAIL PROTECTED]>
  *15.05.2001 pci_enable_device moved, return values in probe cleaned
  *   up. Marcus Meissner <[EMAIL PROTECTED]>
+ *22.05.2001   0.19  more cleanups, changed PM to PCI 2.4 style, got rid
+ *   of global list of devices, using pci device data.
+ *       Marcus Meissner <[EMAIL PROTECTED]>
  */
 
 /*/
@@ -94,7 +97,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -161,15 +163,14 @@
 
 #define FMODE_DMFM 0x10
 
+static struct pci_driver solo1_driver;
+
 /* - */
 
 struct solo1_state {
/* magic */
unsigned int magic;
 
-   /* list of esssolo1 devices */
-   struct list_head devs;
-   
/* the corresponding pci_dev structure */
struct pci_dev *dev;
 
@@ -244,10 +245,6 @@
 
 /* - */
 
-static LIST_HEAD(devs);
-
-/* - */
-
 extern inline void write_seq(struct solo1_state *s, unsigned char data)
 {
 int i;
@@ -939,16 +936,22 @@
 static int solo1_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct list_head *list;
-   struct solo1_state *s;
+   struct solo1_state *s = NULL;
+   struct pci_dev *pci_dev;
 
-   for (list = devs.next; ; list = list->next) {
-   if (list == )
-   return -ENODEV;
-   s = list_entry(list, struct solo1_state, devs);
+   pci_for_each_dev(pci_dev) {
+   struct pci_driver *drvr;
+   drvr = pci_dev_driver (pci_dev);
+   if (drvr != _driver)
+   continue;
+   s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+   if (!s)
+   continue;
if (s->dev_mixer == minor)
break;
}
+   if (!s)
+   return -ENODEV;
VALIDATE_STATE(s);
file->private_data = s;
return 0;
@@ -1611,16 +1614,23 @@
 {
int minor = MINOR(inode->i_rdev);
DECLARE_WAITQUEUE(wait, current);
-   struct list_head *list;
-   struct solo1_state *s;
+   struct solo1_state *s = NULL;
+   struct pci_dev *pci_dev;

-   for (list = devs.next; ; list = list->next) {
-   if (list == )
-   return -ENODEV;
-   s = list_entry(list, struct solo1_state, devs);
+   pci_for_each_dev(pci_dev) {
+   struct pci_driver *drvr;
+
+   drvr = pci_dev_driver(pci_dev);
+   if (drvr != _driver)
+   continue;
+   s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+   if (!s)
+   continue;
if (!((s->dev_audio ^ minor) & ~0xf))
break;
}
+   if (!s)
+   return -ENODEV;
VALIDATE_STATE(s);
file->private_data = s;
/* wait for device to become free */
@@ -1894,16 +1904,23 @@
int minor = MINOR(inode->i_rdev);
DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
-   struct list_head *list;
-   struct solo1_state *s;
+   struct solo1_state *s = NULL;
+   struct pci_dev *pci_dev;
+
+   pci_for_each_dev(pci_dev) {
+   struct pci_driver *drvr;
 
-   for (list = devs.next; ; list = list->next) {
-   if (list == )
-   return -ENODEV;
-   s = list_entry(list, struct solo1_state, devs);
+   drvr = pci_dev_driver(pci_dev);
+   if (drvr != _driver)
+   continue;
+   s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+   if (!s)
+   continue;
if (s->dev_midi == minor)
break;
}
+   if (!s)
+   return -

PATCH: more esssolo1 cleanups

2001-05-22 Thread Marcus Meissner

Hi,

I did some more cleanups:
- changed PM to 2.4 pci module style
- removed global list of devices, now using pci device data.

I tried to add a pci_set_power_state(dev,3) in _remove, but this apparently
has no effect (amplifier stays switched on), so I did not submit this part.

Tested on IBM ThinkPad 390E.

Ciao, Marcus

Index: drivers/sound/esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.12
diff -u -r1.12 esssolo1.c
--- drivers/sound/esssolo1.c2001/05/18 08:06:38 1.12
+++ drivers/sound/esssolo1.c2001/05/22 12:28:54
@@ -79,6 +79,9 @@
  *   for abs. Bug report by Andrew Morton [EMAIL PROTECTED]
  *15.05.2001 pci_enable_device moved, return values in probe cleaned
  *   up. Marcus Meissner [EMAIL PROTECTED]
+ *22.05.2001   0.19  more cleanups, changed PM to PCI 2.4 style, got rid
+ *   of global list of devices, using pci device data.
+ *   Marcus Meissner [EMAIL PROTECTED]
  */
 
 /*/
@@ -94,7 +97,6 @@
 #include linux/soundcard.h
 #include linux/pci.h
 #include linux/bitops.h
-#include linux/pm.h
 #include asm/io.h
 #include asm/dma.h
 #include linux/init.h
@@ -161,15 +163,14 @@
 
 #define FMODE_DMFM 0x10
 
+static struct pci_driver solo1_driver;
+
 /* - */
 
 struct solo1_state {
/* magic */
unsigned int magic;
 
-   /* list of esssolo1 devices */
-   struct list_head devs;
-   
/* the corresponding pci_dev structure */
struct pci_dev *dev;
 
@@ -244,10 +245,6 @@
 
 /* - */
 
-static LIST_HEAD(devs);
-
-/* - */
-
 extern inline void write_seq(struct solo1_state *s, unsigned char data)
 {
 int i;
@@ -939,16 +936,22 @@
 static int solo1_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct list_head *list;
-   struct solo1_state *s;
+   struct solo1_state *s = NULL;
+   struct pci_dev *pci_dev;
 
-   for (list = devs.next; ; list = list-next) {
-   if (list == devs)
-   return -ENODEV;
-   s = list_entry(list, struct solo1_state, devs);
+   pci_for_each_dev(pci_dev) {
+   struct pci_driver *drvr;
+   drvr = pci_dev_driver (pci_dev);
+   if (drvr != solo1_driver)
+   continue;
+   s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+   if (!s)
+   continue;
if (s-dev_mixer == minor)
break;
}
+   if (!s)
+   return -ENODEV;
VALIDATE_STATE(s);
file-private_data = s;
return 0;
@@ -1611,16 +1614,23 @@
 {
int minor = MINOR(inode-i_rdev);
DECLARE_WAITQUEUE(wait, current);
-   struct list_head *list;
-   struct solo1_state *s;
+   struct solo1_state *s = NULL;
+   struct pci_dev *pci_dev;

-   for (list = devs.next; ; list = list-next) {
-   if (list == devs)
-   return -ENODEV;
-   s = list_entry(list, struct solo1_state, devs);
+   pci_for_each_dev(pci_dev) {
+   struct pci_driver *drvr;
+
+   drvr = pci_dev_driver(pci_dev);
+   if (drvr != solo1_driver)
+   continue;
+   s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+   if (!s)
+   continue;
if (!((s-dev_audio ^ minor)  ~0xf))
break;
}
+   if (!s)
+   return -ENODEV;
VALIDATE_STATE(s);
file-private_data = s;
/* wait for device to become free */
@@ -1894,16 +1904,23 @@
int minor = MINOR(inode-i_rdev);
DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
-   struct list_head *list;
-   struct solo1_state *s;
+   struct solo1_state *s = NULL;
+   struct pci_dev *pci_dev;
+
+   pci_for_each_dev(pci_dev) {
+   struct pci_driver *drvr;
 
-   for (list = devs.next; ; list = list-next) {
-   if (list == devs)
-   return -ENODEV;
-   s = list_entry(list, struct solo1_state, devs);
+   drvr = pci_dev_driver(pci_dev);
+   if (drvr != solo1_driver)
+   continue;
+   s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+   if (!s)
+   continue;
if (s-dev_midi == minor)
break

Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

> > @@ -3406,7 +3429,7 @@
> > if(card == NULL)
> > {
> > printk(KERN_WARNING "maestro: out of memory\n");
> > -   return 0;
> > +   return -ENOMEM;
> 
> request_region is unbalanced in this return path.

Thanks! 

Fixed patch below.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 21:06:55
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner <[EMAIL PROTECTED]>
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff <[EMAIL PROTECTED]>
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox <[EMAIL PROTECTED]>
@@ -206,28 +210,6 @@
 #include 
 #include 
 #include 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->base_address[0] & 
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)->vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX()
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)->vm_pgoff)
-
-
-#endif
-
 #include 
 #include 
 #include 
@@ -251,6 +233,8 @@
 
 #include "maestro.h"
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR("Zach Brown <[EMAIL PROTECTED]>, Alan Cox <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("ESS Maestro Driver");
+#ifdef M_DEBUG
+MODULE_PARM(debug,"i");
+#endif
+MODULE_PARM(dsps_order,"i");
+MODULE_PARM(use_pm,"i");
+MODULE_PARM(clocking, "i");
+
 /* - */
-#define DRIVER_VERSION "0.14"
+#define DRIVER_VERSION "0.15"
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO "maestro: version " DRIVER_VERSION " time " __TIME__ " " __DATE__ "\n";
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *card = devs;
-
-   while (card && card->dev_mixer != minor)
-   card = card->next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == _pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card->dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file->private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma->vm_pgoff != 0)
goto out;
size = vma->vm_end - vma->vm_start;
if (size > (PAGE_SIZE << db->buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  

PATCH: toshoboe 2.4 PCI api

2001-05-21 Thread Marcus Meissner

Hi,

I cleaned up the Toshoboe IrDA driver:
- Ported to Linux 2.4 PCI API. Including PowerManagement this time.
- got rid of static dev array, using pci device data
- some misc cleanups.

Tested that IrDA still works on Toshiba Satellite 4080XCDT with irdadump
and a Siemens S25.

Ciao, Marcus

Index: drivers/net/irda/toshoboe.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/net/irda/toshoboe.c,v
retrieving revision 1.18
diff -u -r1.18 toshoboe.c
--- drivers/net/irda/toshoboe.c 2001/05/03 13:16:09 1.18
+++ drivers/net/irda/toshoboe.c 2001/05/21 16:14:13
@@ -43,9 +43,6 @@
 /* Define this to enable FIR and MIR support */
 #define ENABLE_FAST
 
-/* Number of ports this driver can support, you also need to edit dev_self below */
-#define NSELFS 4
-
 /* Size of IO window */
 #define CHIP_IO_EXTENT 0x1f
 
@@ -77,7 +74,6 @@
 #include 
 
 #include 
-static int toshoboe_pmproc (struct pm_dev *dev, pm_request_t rqst, void *data);
 
 #include 
 
@@ -92,8 +88,6 @@
 
 static const char *driver_name = "toshoboe";
 
-static struct toshoboe_cb *dev_self[NSELFS + 1];
-
 static int max_baud = 400;
 
 /* Shutdown the chip and point the taskfile reg somewhere else */
@@ -644,21 +638,20 @@
return ret;
 }
 
-#ifdef MODULE
-
 MODULE_DESCRIPTION("Toshiba OBOE IrDA Device Driver");
 MODULE_AUTHOR("James McKenzie <[EMAIL PROTECTED]>");
 MODULE_PARM (max_baud, "i");
 MODULE_PARM_DESC(max_baus, "Maximum baud rate");
 
-static int
-toshoboe_close (struct toshoboe_cb *self)
+static void
+toshoboe_remove (struct pci_dev *pci_dev)
 {
   int i;
+  struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
 
   IRDA_DEBUG (4, __FUNCTION__ "()\n");
 
-  ASSERT (self != NULL, return -1;
+  ASSERT (self != NULL, return;
 );
 
   if (!self->stopped)
@@ -693,16 +686,12 @@
   self->taskfilebuf = NULL;
   self->taskfile = NULL;
 
-  return (0);
+  return;
 
 }
 
-#endif
-
-
-
 static int
-toshoboe_open (struct pci_dev *pci_dev)
+toshoboe_probe (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
 {
   struct toshoboe_cb *self;
   struct net_device *dev;
@@ -713,15 +702,6 @@
 
   IRDA_DEBUG (4, __FUNCTION__ "()\n");
 
-  while (dev_self[i])
-i++;
-
-  if (i == NSELFS)
-{
-  printk (KERN_ERR "Oboe: No more instances available");
-  return -ENOMEM;
-}
-
   if ((err=pci_enable_device(pci_dev)))
  return err;
 
@@ -736,12 +716,10 @@
 
   memset (self, 0, sizeof (struct toshoboe_cb));
 
-  dev_self[i] = self;   /*This needs moving if we ever get more than one chip 
*/
-
   self->open = 0;
   self->stopped = 0;
   self->pdev = pci_dev;
-  self->base = pci_dev->resource[0].start;
+  self->base = pci_resource_start(pci_dev,0);
 
   self->io.sir_base = self->base;
   self->io.irq = pci_dev->irq;
@@ -749,19 +727,15 @@
   self->io.speed = 9600;
 
   /* Lock the port that we need */
-  i = check_region (self->io.sir_base, self->io.sir_ext);
-  if (i < 0)
+  if (NULL==request_region (self->io.sir_base, self->io.sir_ext, driver_name))
 {
   IRDA_DEBUG (0, __FUNCTION__ "(), can't get iobase of 0x%03x\n",
  self->io.sir_base);
-
-  dev_self[i] = NULL;
-  kfree (self);
 
-  return -ENODEV;
+  err = -EBUSY;
+  goto freeself;
 }
 
-
   irda_init_max_qos_capabilies (>qos);
   self->qos.baud_rate.bits = 0;
 
@@ -804,8 +778,8 @@
   if (!self->taskfilebuf)
 {
   printk (KERN_ERR "toshoboe: kmalloc for DMA failed()\n");
-  kfree (self);
-  return -ENOMEM;
+  err = -ENOMEM;
+  goto freeregion;
 }
 
 
@@ -839,25 +813,16 @@
   if (ok != RX_SLOTS + TX_SLOTS)
 {
   printk (KERN_ERR "toshoboe: kmalloc for buffers failed()\n");
-
-
-  for (i = 0; i < TX_SLOTS; ++i)
-if (self->xmit_bufs[i])
-  kfree (self->xmit_bufs[i]);
-  for (i = 0; i < RX_SLOTS; ++i)
-if (self->recv_bufs[i])
-  kfree (self->recv_bufs[i]);
-
-  kfree (self);
-  return -ENOMEM;
+  err = -ENOMEM;
+  goto freebufs;
 
-}
+  }
 
-  request_region (self->io.sir_base, self->io.sir_ext, driver_name);
 
   if (!(dev = dev_alloc("irda%d", ))) {
- ERROR(__FUNCTION__ "(), dev_alloc() failed!\n");
- return -ENOMEM;
+  ERROR(__FUNCTION__ "(), dev_alloc() failed!\n");
+  err = -ENOMEM;
+  goto freebufs;
   }
   dev->priv = (void *) self;
   self->netdev = dev;
@@ -875,12 +840,15 @@
   rtnl_unlock();
   if (err) {
  ERROR(__FUNCTION__ "(), register_netdev() failed!\n");
- return -1;
+ /* XXX there is not freeing for dev? */
+  goto freebufs;
   }
+  pci_set_drvdata(pci_dev,self);
 
-  pmdev = pm_register (PM_PCI_DEV, PM_PCI_ID(pci_dev), toshoboe_pmproc);
+/*  pmdev = pm_register (PM_PCI_DEV, PM_PCI_ID(pci_dev), toshoboe_pmproc);
   if (pmdev)
  pmdev->data = self;
+ */
 
   printk (KERN_WARNING "ToshOboe: Using ");
 #ifdef ONETASK
@@ -891,16 +859,30 @@
   printk 

PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

Hi,

I did following changes to maestro.c:
- ported to Linux 2.4 PCI API, PCI module based, cleaned up
  return values. (taking into account all the hints Jeff has given
  me ;)
- removed compat macros.
- removed global devs list, now using PCI driver data.
- did NOT change any power management support, since I don't know
  anything about power management.
- bumped version.

Tested with maestro chipset (Maestro 2E) on Toshiba Satellite 4080CXT laptop.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 15:12:17
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner <[EMAIL PROTECTED]>
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff <[EMAIL PROTECTED]>
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox <[EMAIL PROTECTED]>
@@ -206,28 +210,6 @@
 #include 
 #include 
 #include 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->base_address[0] & 
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)->vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX()
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)->vm_pgoff)
-
-
-#endif
-
 #include 
 #include 
 #include 
@@ -251,6 +233,8 @@
 
 #include "maestro.h"
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR("Zach Brown <[EMAIL PROTECTED]>, Alan Cox <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("ESS Maestro Driver");
+#ifdef M_DEBUG
+MODULE_PARM(debug,"i");
+#endif
+MODULE_PARM(dsps_order,"i");
+MODULE_PARM(use_pm,"i");
+MODULE_PARM(clocking, "i");
+
 /* - */
-#define DRIVER_VERSION "0.14"
+#define DRIVER_VERSION "0.15"
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO "maestro: version " DRIVER_VERSION " time " __TIME__ " " __DATE__ "\n";
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *card = devs;
-
-   while (card && card->dev_mixer != minor)
-   card = card->next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == _pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card->dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file->private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma->vm_pgoff != 0)
goto out;
size = vma->vm_end - vma->vm_start;
if (size > (PAGE_SIZE << db->buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *c = devs;
-   stru

PATCH: toshoboe 2.4 PCI api

2001-05-21 Thread Marcus Meissner

Hi,

I cleaned up the Toshoboe IrDA driver:
- Ported to Linux 2.4 PCI API. Including PowerManagement this time.
- got rid of static dev array, using pci device data
- some misc cleanups.

Tested that IrDA still works on Toshiba Satellite 4080XCDT with irdadump
and a Siemens S25.

Ciao, Marcus

Index: drivers/net/irda/toshoboe.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/net/irda/toshoboe.c,v
retrieving revision 1.18
diff -u -r1.18 toshoboe.c
--- drivers/net/irda/toshoboe.c 2001/05/03 13:16:09 1.18
+++ drivers/net/irda/toshoboe.c 2001/05/21 16:14:13
@@ -43,9 +43,6 @@
 /* Define this to enable FIR and MIR support */
 #define ENABLE_FAST
 
-/* Number of ports this driver can support, you also need to edit dev_self below */
-#define NSELFS 4
-
 /* Size of IO window */
 #define CHIP_IO_EXTENT 0x1f
 
@@ -77,7 +74,6 @@
 #include net/irda/irda_device.h
 
 #include linux/pm.h
-static int toshoboe_pmproc (struct pm_dev *dev, pm_request_t rqst, void *data);
 
 #include net/irda/toshoboe.h
 
@@ -92,8 +88,6 @@
 
 static const char *driver_name = toshoboe;
 
-static struct toshoboe_cb *dev_self[NSELFS + 1];
-
 static int max_baud = 400;
 
 /* Shutdown the chip and point the taskfile reg somewhere else */
@@ -644,21 +638,20 @@
return ret;
 }
 
-#ifdef MODULE
-
 MODULE_DESCRIPTION(Toshiba OBOE IrDA Device Driver);
 MODULE_AUTHOR(James McKenzie [EMAIL PROTECTED]);
 MODULE_PARM (max_baud, i);
 MODULE_PARM_DESC(max_baus, Maximum baud rate);
 
-static int
-toshoboe_close (struct toshoboe_cb *self)
+static void
+toshoboe_remove (struct pci_dev *pci_dev)
 {
   int i;
+  struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
 
   IRDA_DEBUG (4, __FUNCTION__ ()\n);
 
-  ASSERT (self != NULL, return -1;
+  ASSERT (self != NULL, return;
 );
 
   if (!self-stopped)
@@ -693,16 +686,12 @@
   self-taskfilebuf = NULL;
   self-taskfile = NULL;
 
-  return (0);
+  return;
 
 }
 
-#endif
-
-
-
 static int
-toshoboe_open (struct pci_dev *pci_dev)
+toshoboe_probe (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
 {
   struct toshoboe_cb *self;
   struct net_device *dev;
@@ -713,15 +702,6 @@
 
   IRDA_DEBUG (4, __FUNCTION__ ()\n);
 
-  while (dev_self[i])
-i++;
-
-  if (i == NSELFS)
-{
-  printk (KERN_ERR Oboe: No more instances available);
-  return -ENOMEM;
-}
-
   if ((err=pci_enable_device(pci_dev)))
  return err;
 
@@ -736,12 +716,10 @@
 
   memset (self, 0, sizeof (struct toshoboe_cb));
 
-  dev_self[i] = self;   /*This needs moving if we ever get more than one chip 
*/
-
   self-open = 0;
   self-stopped = 0;
   self-pdev = pci_dev;
-  self-base = pci_dev-resource[0].start;
+  self-base = pci_resource_start(pci_dev,0);
 
   self-io.sir_base = self-base;
   self-io.irq = pci_dev-irq;
@@ -749,19 +727,15 @@
   self-io.speed = 9600;
 
   /* Lock the port that we need */
-  i = check_region (self-io.sir_base, self-io.sir_ext);
-  if (i  0)
+  if (NULL==request_region (self-io.sir_base, self-io.sir_ext, driver_name))
 {
   IRDA_DEBUG (0, __FUNCTION__ (), can't get iobase of 0x%03x\n,
  self-io.sir_base);
-
-  dev_self[i] = NULL;
-  kfree (self);
 
-  return -ENODEV;
+  err = -EBUSY;
+  goto freeself;
 }
 
-
   irda_init_max_qos_capabilies (self-qos);
   self-qos.baud_rate.bits = 0;
 
@@ -804,8 +778,8 @@
   if (!self-taskfilebuf)
 {
   printk (KERN_ERR toshoboe: kmalloc for DMA failed()\n);
-  kfree (self);
-  return -ENOMEM;
+  err = -ENOMEM;
+  goto freeregion;
 }
 
 
@@ -839,25 +813,16 @@
   if (ok != RX_SLOTS + TX_SLOTS)
 {
   printk (KERN_ERR toshoboe: kmalloc for buffers failed()\n);
-
-
-  for (i = 0; i  TX_SLOTS; ++i)
-if (self-xmit_bufs[i])
-  kfree (self-xmit_bufs[i]);
-  for (i = 0; i  RX_SLOTS; ++i)
-if (self-recv_bufs[i])
-  kfree (self-recv_bufs[i]);
-
-  kfree (self);
-  return -ENOMEM;
+  err = -ENOMEM;
+  goto freebufs;
 
-}
+  }
 
-  request_region (self-io.sir_base, self-io.sir_ext, driver_name);
 
   if (!(dev = dev_alloc(irda%d, err))) {
- ERROR(__FUNCTION__ (), dev_alloc() failed!\n);
- return -ENOMEM;
+  ERROR(__FUNCTION__ (), dev_alloc() failed!\n);
+  err = -ENOMEM;
+  goto freebufs;
   }
   dev-priv = (void *) self;
   self-netdev = dev;
@@ -875,12 +840,15 @@
   rtnl_unlock();
   if (err) {
  ERROR(__FUNCTION__ (), register_netdev() failed!\n);
- return -1;
+ /* XXX there is not freeing for dev? */
+  goto freebufs;
   }
+  pci_set_drvdata(pci_dev,self);
 
-  pmdev = pm_register (PM_PCI_DEV, PM_PCI_ID(pci_dev), toshoboe_pmproc);
+/*  pmdev = pm_register (PM_PCI_DEV, PM_PCI_ID(pci_dev), toshoboe_pmproc);
   if (pmdev)
  pmdev-data = self;
+ */
 
   printk (KERN_WARNING ToshOboe: Using );
 #ifdef ONETASK
@@ -891,16 +859,30 @@
   printk ( tasks, 

PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

Hi,

I did following changes to maestro.c:
- ported to Linux 2.4 PCI API, PCI module based, cleaned up
  return values. (taking into account all the hints Jeff has given
  me ;)
- removed compat macros.
- removed global devs list, now using PCI driver data.
- did NOT change any power management support, since I don't know
  anything about power management.
- bumped version.

Tested with maestro chipset (Maestro 2E) on Toshiba Satellite 4080CXT laptop.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 15:12:17
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner [EMAIL PROTECTED]
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff [EMAIL PROTECTED]
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox [EMAIL PROTECTED]
@@ -206,28 +210,6 @@
 #include linux/sched.h
 #include linux/smp_lock.h
 #include linux/wrapper.h
-
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-base_address[0]  
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)-vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX(SEM)
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)-vm_pgoff)
-
-
-#endif
-
 #include linux/string.h
 #include linux/ctype.h
 #include linux/ioport.h
@@ -251,6 +233,8 @@
 
 #include maestro.h
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR(Zach Brown [EMAIL PROTECTED], Alan Cox [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(ESS Maestro Driver);
+#ifdef M_DEBUG
+MODULE_PARM(debug,i);
+#endif
+MODULE_PARM(dsps_order,i);
+MODULE_PARM(use_pm,i);
+MODULE_PARM(clocking, i);
+
 /* - */
-#define DRIVER_VERSION 0.14
+#define DRIVER_VERSION 0.15
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO maestro: version  DRIVER_VERSION  time  __TIME__   __DATE__ \n;
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *card = devs;
-
-   while (card  card-dev_mixer != minor)
-   card = card-next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == maestro_pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card-dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file-private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma-vm_pgoff != 0)
goto out;
size = vma-vm_end - vma-vm_start;
if (size  (PAGE_SIZE  db-buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  Scan

Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

  @@ -3406,7 +3429,7 @@
  if(card == NULL)
  {
  printk(KERN_WARNING maestro: out of memory\n);
  -   return 0;
  +   return -ENOMEM;
 
 request_region is unbalanced in this return path.

Thanks! 

Fixed patch below.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 21:06:55
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner [EMAIL PROTECTED]
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff [EMAIL PROTECTED]
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox [EMAIL PROTECTED]
@@ -206,28 +210,6 @@
 #include linux/sched.h
 #include linux/smp_lock.h
 #include linux/wrapper.h
-
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-base_address[0]  
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)-vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX(SEM)
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)-vm_pgoff)
-
-
-#endif
-
 #include linux/string.h
 #include linux/ctype.h
 #include linux/ioport.h
@@ -251,6 +233,8 @@
 
 #include maestro.h
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR(Zach Brown [EMAIL PROTECTED], Alan Cox [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(ESS Maestro Driver);
+#ifdef M_DEBUG
+MODULE_PARM(debug,i);
+#endif
+MODULE_PARM(dsps_order,i);
+MODULE_PARM(use_pm,i);
+MODULE_PARM(clocking, i);
+
 /* - */
-#define DRIVER_VERSION 0.14
+#define DRIVER_VERSION 0.15
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO maestro: version  DRIVER_VERSION  time  __TIME__   __DATE__ \n;
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *card = devs;
-
-   while (card  card-dev_mixer != minor)
-   card = card-next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == maestro_pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card-dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file-private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma-vm_pgoff != 0)
goto out;
size = vma-vm_end - vma-vm_start;
if (size  (PAGE_SIZE  db-buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  Scan the cards and find the channel. We only
 *  do this at open time so it is ok
 */
-
-   while (c!=NULL)
-   {
-   for(i=0;iNR_DSPS;i++)
-   {
-   sp=c-channels[i];
-   if(sp

PATCH: sonicvibes / pci_enabled_device and error returns

2001-05-18 Thread Marcus Meissner

Hi,

this moves pci_enable_device() before any resource access in probe() and
cleans up the error return values. No functional changes.

Ciao, Marcus

Index: drivers/sound/sonicvibes.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/sonicvibes.c,v
retrieving revision 1.10
diff -u -r1.10 sonicvibes.c
--- drivers/sound/sonicvibes.c  2001/05/03 13:16:27 1.10
+++ drivers/sound/sonicvibes.c  2001/05/18 10:32:32
@@ -92,7 +92,9 @@
  *   Tjeerd Mulder <[EMAIL PROTECTED]>
  *31.01.2001   0.29  Register/Unregister gameport
  *   Fix SETTRIGGER non OSS API conformity
+ *18.05.2001   0.30  PCI probing and error values cleaned up by Marcus
+ *   Meissner <[EMAIL PROTECTED]>
  *
  */
 
 /*/
@@ -2504,21 +2507,24 @@
static const char __initdata sv_ddma_name[] = "S3 Inc. SonicVibes DDMA 
Controller";
struct sv_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, ret;
char *ddmaname;
unsigned ddmanamelen;
 
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
+
if (!RSRCISIOREGION(pcidev, RESOURCE_SB) ||
!RSRCISIOREGION(pcidev, RESOURCE_ENH) ||
!RSRCISIOREGION(pcidev, RESOURCE_SYNTH) ||
!RSRCISIOREGION(pcidev, RESOURCE_MIDI) ||
!RSRCISIOREGION(pcidev, RESOURCE_GAME))
-   return -1;
+   return -ENODEV;
if (pcidev->irq == 0)
-   return -1;
+   return -ENODEV;
if (pci_set_dma_mask(pcidev, 0x00ff)) {
printk(KERN_WARNING "sonicvibes: architecture does not support 24bit 
PCI busmaster DMA\n");
-   return -1;
+   return -ENODEV;
}
/* try to allocate a DDMA resource if not already available */
if (!RSRCISIOREGION(pcidev, RESOURCE_DDMA)) {
@@ -2534,12 +2540,12 @@
pcidev->resource[RESOURCE_DDMA].name = NULL;
kfree(ddmaname);
printk(KERN_ERR "sv: cannot allocate DDMA controller io 
ports\n");
-   return -1;
+   return -EBUSY;
}
}
if (!(s = kmalloc(sizeof(struct sv_state), GFP_KERNEL))) {
printk(KERN_WARNING "sv: out of memory\n");
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct sv_state));
init_waitqueue_head(>dma_adc.wait);
@@ -2567,7 +2573,8 @@

/* hack */
pci_write_config_dword(pcidev, 0x60, wavetable_mem >> 12);  /* wavetable base 
address */
-   
+
+   ret = -EBUSY;
if (!request_region(s->ioenh, SV_EXTENT_ENH, "S3 SonicVibes PCM")) {
printk(KERN_ERR "sv: io ports %#lx-%#lx in use\n", s->ioenh, 
s->ioenh+SV_EXTENT_ENH-1);
goto err_region5;
@@ -2594,8 +2601,6 @@
printk(KERN_ERR "sv: gameport io ports in use\n");
s->gameport.io = s->gameport.size = 0;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
/* initialize codec registers */
outb(0x80, s->ioenh + SV_CODEC_CONTROL); /* assert reset */
udelay(50);
@@ -2619,21 +2624,29 @@
wrindir(s, SV_CIPCMSR1, ((8000 * 65536 / FULLRATE) >> 8) & 0xff);
wrindir(s, SV_CIADCOUTPUT, 0);
/* request irq */
-   if (request_irq(s->irq, sv_interrupt, SA_SHIRQ, "S3 SonicVibes", s)) {
+   if ((ret=request_irq(s->irq,sv_interrupt,SA_SHIRQ,"S3 SonicVibes",s))) {
printk(KERN_ERR "sv: irq %u in use\n", s->irq);
goto err_irq;
}
printk(KERN_INFO "sv: found adapter at io %#lx irq %u dmaa %#06x dmac %#06x 
revision %u\n",
   s->ioenh, s->irq, s->iodmaa, s->iodmac, rdindir(s, SV_CIREVISION));
/* register devices */
-   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0)
+   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0) {
+   ret = s->dev_audio;
goto err_dev1;
-   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0)
+   }
+   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0) {
+   ret = s->dev_mixer;
goto err_dev2;
-   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0)
+   }
+   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0) {
+   ret = s->dev_midi;
goto err_dev3;
-   if ((s->dev_dmfm = register_sound_special(_dmfm_fops, 15 /* ?? *

PATCH: sonicvibes / pci_enabled_device and error returns

2001-05-18 Thread Marcus Meissner

Hi,

this moves pci_enable_device() before any resource access in probe() and
cleans up the error return values. No functional changes.

Ciao, Marcus

Index: drivers/sound/sonicvibes.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/sonicvibes.c,v
retrieving revision 1.10
diff -u -r1.10 sonicvibes.c
--- drivers/sound/sonicvibes.c  2001/05/03 13:16:27 1.10
+++ drivers/sound/sonicvibes.c  2001/05/18 10:32:32
@@ -92,7 +92,9 @@
  *   Tjeerd Mulder [EMAIL PROTECTED]
  *31.01.2001   0.29  Register/Unregister gameport
  *   Fix SETTRIGGER non OSS API conformity
+ *18.05.2001   0.30  PCI probing and error values cleaned up by Marcus
+ *   Meissner [EMAIL PROTECTED]
  *
  */
 
 /*/
@@ -2504,21 +2507,24 @@
static const char __initdata sv_ddma_name[] = S3 Inc. SonicVibes DDMA 
Controller;
struct sv_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, ret;
char *ddmaname;
unsigned ddmanamelen;
 
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
+
if (!RSRCISIOREGION(pcidev, RESOURCE_SB) ||
!RSRCISIOREGION(pcidev, RESOURCE_ENH) ||
!RSRCISIOREGION(pcidev, RESOURCE_SYNTH) ||
!RSRCISIOREGION(pcidev, RESOURCE_MIDI) ||
!RSRCISIOREGION(pcidev, RESOURCE_GAME))
-   return -1;
+   return -ENODEV;
if (pcidev-irq == 0)
-   return -1;
+   return -ENODEV;
if (pci_set_dma_mask(pcidev, 0x00ff)) {
printk(KERN_WARNING sonicvibes: architecture does not support 24bit 
PCI busmaster DMA\n);
-   return -1;
+   return -ENODEV;
}
/* try to allocate a DDMA resource if not already available */
if (!RSRCISIOREGION(pcidev, RESOURCE_DDMA)) {
@@ -2534,12 +2540,12 @@
pcidev-resource[RESOURCE_DDMA].name = NULL;
kfree(ddmaname);
printk(KERN_ERR sv: cannot allocate DDMA controller io 
ports\n);
-   return -1;
+   return -EBUSY;
}
}
if (!(s = kmalloc(sizeof(struct sv_state), GFP_KERNEL))) {
printk(KERN_WARNING sv: out of memory\n);
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct sv_state));
init_waitqueue_head(s-dma_adc.wait);
@@ -2567,7 +2573,8 @@

/* hack */
pci_write_config_dword(pcidev, 0x60, wavetable_mem  12);  /* wavetable base 
address */
-   
+
+   ret = -EBUSY;
if (!request_region(s-ioenh, SV_EXTENT_ENH, S3 SonicVibes PCM)) {
printk(KERN_ERR sv: io ports %#lx-%#lx in use\n, s-ioenh, 
s-ioenh+SV_EXTENT_ENH-1);
goto err_region5;
@@ -2594,8 +2601,6 @@
printk(KERN_ERR sv: gameport io ports in use\n);
s-gameport.io = s-gameport.size = 0;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
/* initialize codec registers */
outb(0x80, s-ioenh + SV_CODEC_CONTROL); /* assert reset */
udelay(50);
@@ -2619,21 +2624,29 @@
wrindir(s, SV_CIPCMSR1, ((8000 * 65536 / FULLRATE)  8)  0xff);
wrindir(s, SV_CIADCOUTPUT, 0);
/* request irq */
-   if (request_irq(s-irq, sv_interrupt, SA_SHIRQ, S3 SonicVibes, s)) {
+   if ((ret=request_irq(s-irq,sv_interrupt,SA_SHIRQ,S3 SonicVibes,s))) {
printk(KERN_ERR sv: irq %u in use\n, s-irq);
goto err_irq;
}
printk(KERN_INFO sv: found adapter at io %#lx irq %u dmaa %#06x dmac %#06x 
revision %u\n,
   s-ioenh, s-irq, s-iodmaa, s-iodmac, rdindir(s, SV_CIREVISION));
/* register devices */
-   if ((s-dev_audio = register_sound_dsp(sv_audio_fops, -1))  0)
+   if ((s-dev_audio = register_sound_dsp(sv_audio_fops, -1))  0) {
+   ret = s-dev_audio;
goto err_dev1;
-   if ((s-dev_mixer = register_sound_mixer(sv_mixer_fops, -1))  0)
+   }
+   if ((s-dev_mixer = register_sound_mixer(sv_mixer_fops, -1))  0) {
+   ret = s-dev_mixer;
goto err_dev2;
-   if ((s-dev_midi = register_sound_midi(sv_midi_fops, -1))  0)
+   }
+   if ((s-dev_midi = register_sound_midi(sv_midi_fops, -1))  0) {
+   ret = s-dev_midi;
goto err_dev3;
-   if ((s-dev_dmfm = register_sound_special(sv_dmfm_fops, 15 /* ?? */))  0)
+   }
+   if ((s-dev_dmfm = register_sound_special(sv_dmfm_fops, 15 /* ?? */))  0) {
+   ret = s-dev_dmfm;
goto err_dev4;
+   }
pci_set_master(pcidev);  /* enable bus mastering */
/* initialize the chips */
fs

PATCH: wd7000 missing release_region

2001-05-16 Thread Marcus Meissner

Hi,

One else case in wd7000.c did not have a release_region().

Ciao, Marcus

Index: drivers/scsi/wd7000.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/scsi/wd7000.c,v
retrieving revision 1.7
diff -u -r1.7 wd7000.c
--- drivers/scsi/wd7000.c   2001/05/03 13:03:59 1.7
+++ drivers/scsi/wd7000.c   2001/05/16 10:05:21
@@ -1676,7 +1676,8 @@
host->iobase, host->irq, host->dma);
 printk ("  BUS_ON time: %dns, BUS_OFF time: %dns\n",
 host->bus_on * 125, host->bus_off * 125);
-   }
+   } else 
+   goto err_release;
}
 
 #ifdef WD7000_DEBUG
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: missing release_region in qlogicfas.c

2001-05-16 Thread Marcus Meissner

Hi,

qlogicfas was missing a release_region in autoprobing too.

Ciao, Marcus

Index: drivers/scsi/qlogicfas.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/scsi/qlogicfas.c,v
retrieving revision 1.13
diff -u -r1.13 qlogicfas.c
--- drivers/scsi/qlogicfas.c2001/05/03 13:16:22 1.13
+++ drivers/scsi/qlogicfas.c2001/05/16 09:59:04
@@ -563,6 +563,7 @@
if ( ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 )
  && ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 ) )
break;
+   release_region(qbase, 0x10 );
}
if (qbase == 0x430)
return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: NCR53c406 missing release_region

2001-05-16 Thread Marcus Meissner

Hi,

There was a missing release_region in NCR53c406a.c, which fscked up
probing with 'modprobe NCR53c406' like one mode of our installer does.
(Tested by checking the contents of /proc/ioports before and after. After
 modprobe it contained junk for the probed port range. It no longer does.)

Ciao, Marcus

Index: drivers/scsi/NCR53c406a.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/scsi/NCR53c406a.c,v
retrieving revision 1.6
diff -u -r1.6 NCR53c406a.c
--- drivers/scsi/NCR53c406a.c   2001/05/03 13:03:53 1.6
+++ drivers/scsi/NCR53c406a.c   2001/05/16 09:38:11
@@ -508,6 +508,7 @@
 VDEB(printk("port_base=%x\n", port_base));
 break;
 }
+release_region(ports[i], 0x10);
 }
 }
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: NCR53c406 missing release_region

2001-05-16 Thread Marcus Meissner

Hi,

There was a missing release_region in NCR53c406a.c, which fscked up
probing with 'modprobe NCR53c406' like one mode of our installer does.
(Tested by checking the contents of /proc/ioports before and after. After
 modprobe it contained junk for the probed port range. It no longer does.)

Ciao, Marcus

Index: drivers/scsi/NCR53c406a.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/scsi/NCR53c406a.c,v
retrieving revision 1.6
diff -u -r1.6 NCR53c406a.c
--- drivers/scsi/NCR53c406a.c   2001/05/03 13:03:53 1.6
+++ drivers/scsi/NCR53c406a.c   2001/05/16 09:38:11
@@ -508,6 +508,7 @@
 VDEB(printk(port_base=%x\n, port_base));
 break;
 }
+release_region(ports[i], 0x10);
 }
 }
 }
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: missing release_region in qlogicfas.c

2001-05-16 Thread Marcus Meissner

Hi,

qlogicfas was missing a release_region in autoprobing too.

Ciao, Marcus

Index: drivers/scsi/qlogicfas.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/scsi/qlogicfas.c,v
retrieving revision 1.13
diff -u -r1.13 qlogicfas.c
--- drivers/scsi/qlogicfas.c2001/05/03 13:16:22 1.13
+++ drivers/scsi/qlogicfas.c2001/05/16 09:59:04
@@ -563,6 +563,7 @@
if ( ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 )
   ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 ) )
break;
+   release_region(qbase, 0x10 );
}
if (qbase == 0x430)
return 0;
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: wd7000 missing release_region

2001-05-16 Thread Marcus Meissner

Hi,

One else case in wd7000.c did not have a release_region().

Ciao, Marcus

Index: drivers/scsi/wd7000.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/scsi/wd7000.c,v
retrieving revision 1.7
diff -u -r1.7 wd7000.c
--- drivers/scsi/wd7000.c   2001/05/03 13:03:59 1.7
+++ drivers/scsi/wd7000.c   2001/05/16 10:05:21
@@ -1676,7 +1676,8 @@
host-iobase, host-irq, host-dma);
 printk (  BUS_ON time: %dns, BUS_OFF time: %dns\n,
 host-bus_on * 125, host-bus_off * 125);
-   }
+   } else 
+   goto err_release;
}
 
 #ifdef WD7000_DEBUG
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: esssolo pci_enable_device / retcodes

2001-05-15 Thread Marcus Meissner

Hi,

this moves pci_enable_device() before resource access and cleans
up the return values.

Ciao, Marcus

Index: esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.11
diff -u -r1.11 esssolo1.c
--- esssolo1.c  2001/05/09 07:08:56 1.11
+++ esssolo1.c  2001/05/15 12:46:25
@@ -77,6 +77,8 @@
  *   Fix SETTRIGGER non OSS API conformity
  *10.03.2001 provide abs function, prevent picking up a bogus kernel macro
  *   for abs. Bug report by Andrew Morton <[EMAIL PROTECTED]>
+ *15.05.2001 pci_enable_device moved, return values in probe cleaned
+ *   up. Marcus Meissner <[EMAIL PROTECTED]>
  */
 
 /*/
@@ -2277,22 +2279,21 @@
return 0;
 }
 
-
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \
-(pci_resource_flags((dev), (num)) & IORESOURCE_IO))
-
 static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct solo1_state *s;
struct pm_dev *pmdev;
+   int ret;
 
-   if (!RSRCISIOREGION(pcidev, 0) ||
-   !RSRCISIOREGION(pcidev, 1) ||
-   !RSRCISIOREGION(pcidev, 2) ||
-   !RSRCISIOREGION(pcidev, 3))
-   return -1;
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
+   if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_IO) ||
+   !(pci_resource_flags(pcidev, 1) & IORESOURCE_IO) ||
+   !(pci_resource_flags(pcidev, 2) & IORESOURCE_IO) ||
+   !(pci_resource_flags(pcidev, 3) & IORESOURCE_IO))
+   return -ENODEV;
if (pcidev->irq == 0)
-   return -1;
+   return -ENODEV;
 
/* Recording requires 24-bit DMA, so attempt to set dma mask
 * to 24 bits first, then 32 bits (playback only) if that fails.
@@ -2300,12 +2301,12 @@
if (pci_set_dma_mask(pcidev, 0x00ff) &&
pci_set_dma_mask(pcidev, 0x)) {
printk(KERN_WARNING "solo1: architecture does not support 24bit or 
32bit PCI busmaster DMA\n");
-   return -1;
+   return -ENODEV;
}
 
if (!(s = kmalloc(sizeof(struct solo1_state), GFP_KERNEL))) {
printk(KERN_WARNING "solo1: out of memory\n");
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct solo1_state));
init_waitqueue_head(>dma_adc.wait);
@@ -2325,6 +2326,7 @@
s->gameport.io = pci_resource_start(pcidev, 4);
s->gameport.size = pci_resource_len(pcidev,4);
s->irq = pcidev->irq;
+   ret = -EBUSY;
if (!request_region(s->iobase, IOBASE_EXTENT, "ESS Solo1")) {
printk(KERN_ERR "solo1: io ports in use\n");
goto err_region1;
@@ -2347,24 +2349,32 @@
printk(KERN_ERR "solo1: gameport io ports in use\n");
s->gameport.io = s->gameport.size = 0;
}
-   if (request_irq(s->irq, solo1_interrupt, SA_SHIRQ, "ESS Solo1", s)) {
+   if ((ret=request_irq(s->irq,solo1_interrupt,SA_SHIRQ,"ESS Solo1",s))) {
printk(KERN_ERR "solo1: irq %u in use\n", s->irq);
goto err_irq;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
printk(KERN_INFO "solo1: joystick port at %#x\n", s->gameport.io+1);
/* register devices */
-   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0)
+   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0) {
+   ret = s->dev_audio;
goto err_dev1;
-   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0)
+   }
+   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0) {
+   ret = s->dev_mixer;
goto err_dev2;
-   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0)
+   }
+   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0) {
+   ret = s->dev_midi;
goto err_dev3;
-   if ((s->dev_dmfm = register_sound_special(_dmfm_fops, 15 /* ?? */)) < 0)
+   }
+   if ((s->dev_dmfm = register_sound_special(_dmfm_fops, 15 /* ?? */)) < 0) 
+{
+   ret = s->dev_dmfm;
goto err_dev4;
-   if (setup_solo1(s))
+   }
+   if (setup_solo1(s)) {
+   ret = -EIO;
goto err;
+   }
/* register gameport */
gameport_register_port(>gameport);
/* store it in the drive

PATCH: esssolo pci_enable_device / retcodes

2001-05-15 Thread Marcus Meissner

Hi,

this moves pci_enable_device() before resource access and cleans
up the return values.

Ciao, Marcus

Index: esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.11
diff -u -r1.11 esssolo1.c
--- esssolo1.c  2001/05/09 07:08:56 1.11
+++ esssolo1.c  2001/05/15 12:46:25
@@ -77,6 +77,8 @@
  *   Fix SETTRIGGER non OSS API conformity
  *10.03.2001 provide abs function, prevent picking up a bogus kernel macro
  *   for abs. Bug report by Andrew Morton [EMAIL PROTECTED]
+ *15.05.2001 pci_enable_device moved, return values in probe cleaned
+ *   up. Marcus Meissner [EMAIL PROTECTED]
  */
 
 /*/
@@ -2277,22 +2279,21 @@
return 0;
 }
 
-
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0  \
-(pci_resource_flags((dev), (num))  IORESOURCE_IO))
-
 static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct solo1_state *s;
struct pm_dev *pmdev;
+   int ret;
 
-   if (!RSRCISIOREGION(pcidev, 0) ||
-   !RSRCISIOREGION(pcidev, 1) ||
-   !RSRCISIOREGION(pcidev, 2) ||
-   !RSRCISIOREGION(pcidev, 3))
-   return -1;
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
+   if (!(pci_resource_flags(pcidev, 0)  IORESOURCE_IO) ||
+   !(pci_resource_flags(pcidev, 1)  IORESOURCE_IO) ||
+   !(pci_resource_flags(pcidev, 2)  IORESOURCE_IO) ||
+   !(pci_resource_flags(pcidev, 3)  IORESOURCE_IO))
+   return -ENODEV;
if (pcidev-irq == 0)
-   return -1;
+   return -ENODEV;
 
/* Recording requires 24-bit DMA, so attempt to set dma mask
 * to 24 bits first, then 32 bits (playback only) if that fails.
@@ -2300,12 +2301,12 @@
if (pci_set_dma_mask(pcidev, 0x00ff) 
pci_set_dma_mask(pcidev, 0x)) {
printk(KERN_WARNING solo1: architecture does not support 24bit or 
32bit PCI busmaster DMA\n);
-   return -1;
+   return -ENODEV;
}
 
if (!(s = kmalloc(sizeof(struct solo1_state), GFP_KERNEL))) {
printk(KERN_WARNING solo1: out of memory\n);
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct solo1_state));
init_waitqueue_head(s-dma_adc.wait);
@@ -2325,6 +2326,7 @@
s-gameport.io = pci_resource_start(pcidev, 4);
s-gameport.size = pci_resource_len(pcidev,4);
s-irq = pcidev-irq;
+   ret = -EBUSY;
if (!request_region(s-iobase, IOBASE_EXTENT, ESS Solo1)) {
printk(KERN_ERR solo1: io ports in use\n);
goto err_region1;
@@ -2347,24 +2349,32 @@
printk(KERN_ERR solo1: gameport io ports in use\n);
s-gameport.io = s-gameport.size = 0;
}
-   if (request_irq(s-irq, solo1_interrupt, SA_SHIRQ, ESS Solo1, s)) {
+   if ((ret=request_irq(s-irq,solo1_interrupt,SA_SHIRQ,ESS Solo1,s))) {
printk(KERN_ERR solo1: irq %u in use\n, s-irq);
goto err_irq;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
printk(KERN_INFO solo1: joystick port at %#x\n, s-gameport.io+1);
/* register devices */
-   if ((s-dev_audio = register_sound_dsp(solo1_audio_fops, -1))  0)
+   if ((s-dev_audio = register_sound_dsp(solo1_audio_fops, -1))  0) {
+   ret = s-dev_audio;
goto err_dev1;
-   if ((s-dev_mixer = register_sound_mixer(solo1_mixer_fops, -1))  0)
+   }
+   if ((s-dev_mixer = register_sound_mixer(solo1_mixer_fops, -1))  0) {
+   ret = s-dev_mixer;
goto err_dev2;
-   if ((s-dev_midi = register_sound_midi(solo1_midi_fops, -1))  0)
+   }
+   if ((s-dev_midi = register_sound_midi(solo1_midi_fops, -1))  0) {
+   ret = s-dev_midi;
goto err_dev3;
-   if ((s-dev_dmfm = register_sound_special(solo1_dmfm_fops, 15 /* ?? */))  0)
+   }
+   if ((s-dev_dmfm = register_sound_special(solo1_dmfm_fops, 15 /* ?? */))  0) 
+{
+   ret = s-dev_dmfm;
goto err_dev4;
-   if (setup_solo1(s))
+   }
+   if (setup_solo1(s)) {
+   ret = -EIO;
goto err;
+   }
/* register gameport */
gameport_register_port(s-gameport);
/* store it in the driver field */
@@ -2401,7 +2411,7 @@
release_region(s-mpubase, MPUBASE_EXTENT);
  err_region1:
kfree(s);
-   return -1;
+   return ret;
 }
 
 static void __devinit solo1_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line

Re: PATCH: es1370 move pci_enable_device

2001-05-02 Thread Marcus Meissner

On Wed, May 02, 2001 at 09:44:21AM +0200, Marcus Meissner wrote:
> Hi,
> 
> This moves pci_enable_device to the correct position in es1370 and
> cleans up the return values in es1370_probe
> 
> Ciao, Marcus

> + if ((!pci_resource_flags(pcidev, 0) & IORESOURCE_IO) ||

Slightly bad placed braces, fixed.

Ciao, Marcus
Index: drivers/sound/es1370.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1370.c,v
retrieving revision 1.13
diff -u -r1.13 es1370.c
--- drivers/sound/es1370.c  2001/04/17 17:26:05 1.13
+++ drivers/sound/es1370.c  2001/05/02 07:55:33
@@ -2560,19 +2560,21 @@
{ SOUND_MIXER_WRITE_OGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \
-pci_resource_flags((dev), (num)) & IORESOURCE_IO)
-
 static int __devinit es1370_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1370_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, ret;
+
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
 
-   if (!RSRCISIOREGION(pcidev, 0))
-   return -1;
+   if ( !(pci_resource_flags(pcidev, 0) & IORESOURCE_IO) ||
+!pci_resource_start(pcidev, 0)
+   )
+   return -ENODEV;
if (pcidev->irq == 0) 
-   return -1;
+   return -ENODEV;
i = pci_set_dma_mask(pcidev, 0x);
if (i) {
printk(KERN_WARNING "es1370: architecture does not support 32bit PCI 
busmaster DMA\n");
@@ -2580,7 +2582,7 @@
}
if (!(s = kmalloc(sizeof(struct es1370_state), GFP_KERNEL))) {
printk(KERN_WARNING "es1370: out of memory\n");
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct es1370_state));
init_waitqueue_head(>dma_adc.wait);
@@ -2597,14 +2599,14 @@
s->irq = pcidev->irq;
if (!request_region(s->io, ES1370_EXTENT, "es1370")) {
printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1370_EXTENT-1);
+   ret = -EBUSY;
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
-   if (request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) {
+   if ((ret=request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370",s))) {
printk(KERN_ERR "es1370: irq %u in use\n", s->irq);
goto err_irq;
}
+
/* initialize codec registers */
/* note: setting CTRL_SERR_DIS is reported to break
 * mic bias setting (by [EMAIL PROTECTED]) */
@@ -2631,14 +2633,22 @@
   (s->ctrl & CTRL_XCTL0) ? "out" : "in",
   (s->ctrl & CTRL_XCTL1) ? "1" : "0");
/* register devices */
-   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0)
+   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0) {
+   ret = s->dev_audio;
goto err_dev1;
-   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0)
+   }
+   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0) {
+   ret = s->dev_mixer;
goto err_dev2;
-   if ((s->dev_dac = register_sound_dsp(_dac_fops, -1)) < 0)
+   }
+   if ((s->dev_dac = register_sound_dsp(_dac_fops, -1)) < 0) {
+   ret = s->dev_dac;
goto err_dev3;
-   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0)
+   }
+   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0) {
+   ret = s->dev_midi;
goto err_dev4;
+   }
/* initialize the chips */
outl(s->ctrl, s->io+ES1370_REG_CONTROL);
outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL);
@@ -2688,7 +2698,7 @@
release_region(s->io, ES1370_EXTENT);
  err_region:
kfree(s);
-   return -1;
+   return ret;
 }
 
 static void __devinit es1370_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: es1370 move pci_enable_device

2001-05-02 Thread Marcus Meissner

Hi,

This moves pci_enable_device to the correct position in es1370 and
cleans up the return values in es1370_probe.

Ciao, Marcus

Index: drivers/sound/es1370.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1370.c,v
retrieving revision 1.13
diff -u -r1.13 es1370.c
--- drivers/sound/es1370.c  2001/04/17 17:26:05 1.13
+++ drivers/sound/es1370.c  2001/05/02 06:51:05
@@ -2560,19 +2560,21 @@
{ SOUND_MIXER_WRITE_OGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \
-pci_resource_flags((dev), (num)) & IORESOURCE_IO)
-
 static int __devinit es1370_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1370_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, ret;
+
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
 
-   if (!RSRCISIOREGION(pcidev, 0))
-   return -1;
+   if ((!pci_resource_flags(pcidev, 0) & IORESOURCE_IO) ||
+!pci_resource_start(pcidev, 0)
+   )
+   return -ENODEV;
if (pcidev->irq == 0) 
-   return -1;
+   return -ENODEV;
i = pci_set_dma_mask(pcidev, 0x);
if (i) {
printk(KERN_WARNING "es1370: architecture does not support 32bit PCI 
busmaster DMA\n");
@@ -2580,7 +2582,7 @@
}
if (!(s = kmalloc(sizeof(struct es1370_state), GFP_KERNEL))) {
printk(KERN_WARNING "es1370: out of memory\n");
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct es1370_state));
init_waitqueue_head(>dma_adc.wait);
@@ -2597,14 +2599,14 @@
s->irq = pcidev->irq;
if (!request_region(s->io, ES1370_EXTENT, "es1370")) {
printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1370_EXTENT-1);
+   ret = -EBUSY;
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
-   if (request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) {
+   if ((ret=request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370",s))) {
printk(KERN_ERR "es1370: irq %u in use\n", s->irq);
goto err_irq;
}
+
/* initialize codec registers */
/* note: setting CTRL_SERR_DIS is reported to break
 * mic bias setting (by [EMAIL PROTECTED]) */
@@ -2631,14 +2633,22 @@
   (s->ctrl & CTRL_XCTL0) ? "out" : "in",
   (s->ctrl & CTRL_XCTL1) ? "1" : "0");
/* register devices */
-   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0)
+   if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0) {
+   ret = s->dev_audio;
goto err_dev1;
-   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0)
+   }
+   if ((s->dev_mixer = register_sound_mixer(_mixer_fops, -1)) < 0) {
+   ret = s->dev_mixer;
goto err_dev2;
-   if ((s->dev_dac = register_sound_dsp(_dac_fops, -1)) < 0)
+   }
+   if ((s->dev_dac = register_sound_dsp(_dac_fops, -1)) < 0) {
+   ret = s->dev_dac;
goto err_dev3;
-   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0)
+   }
+   if ((s->dev_midi = register_sound_midi(_midi_fops, -1)) < 0) {
+   ret = s->dev_midi;
goto err_dev4;
+   }
/* initialize the chips */
outl(s->ctrl, s->io+ES1370_REG_CONTROL);
outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL);
@@ -2688,7 +2698,7 @@
release_region(s->io, ES1370_EXTENT);
  err_region:
kfree(s);
-   return -1;
+   return ret;
 }
 
 static void __devinit es1370_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: emu10k1 moving pci_enable_device

2001-05-02 Thread Marcus Meissner

Hi,

This moves pci_enable_device in emu10k1 driver before any resource
access.

Ciao, Marcus

Index: main.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/emu10k1/main.c,v
retrieving revision 1.3
diff -u -r1.3 linux-mm/drivers/sound/emu10k1/main.c
--- linux-vanilla/drivers/sound/emu10k1/main.c  2001/04/17 16:55:42 1.3
+++ linux-mm/drivers/sound/emu10k1/main.c   2001/04/25 11:25:02
@@ -612,7 +612,11 @@
 {
struct emu10k1_card *card;
u32 subsysvid;
+   int ret;
 
+   if ((ret=pci_enable_device(pci_dev)))
+   return ret;
+
if ((card = kmalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "emu10k1: out of memory\n");
return -ENOMEM;
@@ -621,11 +625,6 @@
 
if (pci_set_dma_mask(pci_dev, EMU10K1_DMA_MASK)) {
printk(KERN_ERR "emu10k1: architecture does not support 32bit PCI 
busmaster DMA\n");
-   kfree(card);
-   return -ENODEV;
-   }
-
-   if (pci_enable_device(pci_dev)) {
kfree(card);
return -ENODEV;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: emu10k1 moving pci_enable_device

2001-05-02 Thread Marcus Meissner

Hi,

This moves pci_enable_device in emu10k1 driver before any resource
access.

Ciao, Marcus

Index: main.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/emu10k1/main.c,v
retrieving revision 1.3
diff -u -r1.3 linux-mm/drivers/sound/emu10k1/main.c
--- linux-vanilla/drivers/sound/emu10k1/main.c  2001/04/17 16:55:42 1.3
+++ linux-mm/drivers/sound/emu10k1/main.c   2001/04/25 11:25:02
@@ -612,7 +612,11 @@
 {
struct emu10k1_card *card;
u32 subsysvid;
+   int ret;
 
+   if ((ret=pci_enable_device(pci_dev)))
+   return ret;
+
if ((card = kmalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR emu10k1: out of memory\n);
return -ENOMEM;
@@ -621,11 +625,6 @@
 
if (pci_set_dma_mask(pci_dev, EMU10K1_DMA_MASK)) {
printk(KERN_ERR emu10k1: architecture does not support 32bit PCI 
busmaster DMA\n);
-   kfree(card);
-   return -ENODEV;
-   }
-
-   if (pci_enable_device(pci_dev)) {
kfree(card);
return -ENODEV;
}
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: es1370 move pci_enable_device

2001-05-02 Thread Marcus Meissner

Hi,

This moves pci_enable_device to the correct position in es1370 and
cleans up the return values in es1370_probe.

Ciao, Marcus

Index: drivers/sound/es1370.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1370.c,v
retrieving revision 1.13
diff -u -r1.13 es1370.c
--- drivers/sound/es1370.c  2001/04/17 17:26:05 1.13
+++ drivers/sound/es1370.c  2001/05/02 06:51:05
@@ -2560,19 +2560,21 @@
{ SOUND_MIXER_WRITE_OGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0  \
-pci_resource_flags((dev), (num))  IORESOURCE_IO)
-
 static int __devinit es1370_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1370_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, ret;
+
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
 
-   if (!RSRCISIOREGION(pcidev, 0))
-   return -1;
+   if ((!pci_resource_flags(pcidev, 0)  IORESOURCE_IO) ||
+!pci_resource_start(pcidev, 0)
+   )
+   return -ENODEV;
if (pcidev-irq == 0) 
-   return -1;
+   return -ENODEV;
i = pci_set_dma_mask(pcidev, 0x);
if (i) {
printk(KERN_WARNING es1370: architecture does not support 32bit PCI 
busmaster DMA\n);
@@ -2580,7 +2582,7 @@
}
if (!(s = kmalloc(sizeof(struct es1370_state), GFP_KERNEL))) {
printk(KERN_WARNING es1370: out of memory\n);
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct es1370_state));
init_waitqueue_head(s-dma_adc.wait);
@@ -2597,14 +2599,14 @@
s-irq = pcidev-irq;
if (!request_region(s-io, ES1370_EXTENT, es1370)) {
printk(KERN_ERR es1370: io ports %#lx-%#lx in use\n, s-io, 
s-io+ES1370_EXTENT-1);
+   ret = -EBUSY;
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
-   if (request_irq(s-irq, es1370_interrupt, SA_SHIRQ, es1370, s)) {
+   if ((ret=request_irq(s-irq, es1370_interrupt, SA_SHIRQ, es1370,s))) {
printk(KERN_ERR es1370: irq %u in use\n, s-irq);
goto err_irq;
}
+
/* initialize codec registers */
/* note: setting CTRL_SERR_DIS is reported to break
 * mic bias setting (by [EMAIL PROTECTED]) */
@@ -2631,14 +2633,22 @@
   (s-ctrl  CTRL_XCTL0) ? out : in,
   (s-ctrl  CTRL_XCTL1) ? 1 : 0);
/* register devices */
-   if ((s-dev_audio = register_sound_dsp(es1370_audio_fops, -1))  0)
+   if ((s-dev_audio = register_sound_dsp(es1370_audio_fops, -1))  0) {
+   ret = s-dev_audio;
goto err_dev1;
-   if ((s-dev_mixer = register_sound_mixer(es1370_mixer_fops, -1))  0)
+   }
+   if ((s-dev_mixer = register_sound_mixer(es1370_mixer_fops, -1))  0) {
+   ret = s-dev_mixer;
goto err_dev2;
-   if ((s-dev_dac = register_sound_dsp(es1370_dac_fops, -1))  0)
+   }
+   if ((s-dev_dac = register_sound_dsp(es1370_dac_fops, -1))  0) {
+   ret = s-dev_dac;
goto err_dev3;
-   if ((s-dev_midi = register_sound_midi(es1370_midi_fops, -1))  0)
+   }
+   if ((s-dev_midi = register_sound_midi(es1370_midi_fops, -1))  0) {
+   ret = s-dev_midi;
goto err_dev4;
+   }
/* initialize the chips */
outl(s-ctrl, s-io+ES1370_REG_CONTROL);
outl(s-sctrl, s-io+ES1370_REG_SERIAL_CONTROL);
@@ -2688,7 +2698,7 @@
release_region(s-io, ES1370_EXTENT);
  err_region:
kfree(s);
-   return -1;
+   return ret;
 }
 
 static void __devinit es1370_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: PATCH: es1370 move pci_enable_device

2001-05-02 Thread Marcus Meissner

On Wed, May 02, 2001 at 09:44:21AM +0200, Marcus Meissner wrote:
 Hi,
 
 This moves pci_enable_device to the correct position in es1370 and
 cleans up the return values in es1370_probe
 
 Ciao, Marcus

 + if ((!pci_resource_flags(pcidev, 0)  IORESOURCE_IO) ||

Slightly bad placed braces, fixed.

Ciao, Marcus
Index: drivers/sound/es1370.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1370.c,v
retrieving revision 1.13
diff -u -r1.13 es1370.c
--- drivers/sound/es1370.c  2001/04/17 17:26:05 1.13
+++ drivers/sound/es1370.c  2001/05/02 07:55:33
@@ -2560,19 +2560,21 @@
{ SOUND_MIXER_WRITE_OGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0  \
-pci_resource_flags((dev), (num))  IORESOURCE_IO)
-
 static int __devinit es1370_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1370_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, ret;
+
+   if ((ret=pci_enable_device(pcidev)))
+   return ret;
 
-   if (!RSRCISIOREGION(pcidev, 0))
-   return -1;
+   if ( !(pci_resource_flags(pcidev, 0)  IORESOURCE_IO) ||
+!pci_resource_start(pcidev, 0)
+   )
+   return -ENODEV;
if (pcidev-irq == 0) 
-   return -1;
+   return -ENODEV;
i = pci_set_dma_mask(pcidev, 0x);
if (i) {
printk(KERN_WARNING es1370: architecture does not support 32bit PCI 
busmaster DMA\n);
@@ -2580,7 +2582,7 @@
}
if (!(s = kmalloc(sizeof(struct es1370_state), GFP_KERNEL))) {
printk(KERN_WARNING es1370: out of memory\n);
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct es1370_state));
init_waitqueue_head(s-dma_adc.wait);
@@ -2597,14 +2599,14 @@
s-irq = pcidev-irq;
if (!request_region(s-io, ES1370_EXTENT, es1370)) {
printk(KERN_ERR es1370: io ports %#lx-%#lx in use\n, s-io, 
s-io+ES1370_EXTENT-1);
+   ret = -EBUSY;
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
-   if (request_irq(s-irq, es1370_interrupt, SA_SHIRQ, es1370, s)) {
+   if ((ret=request_irq(s-irq, es1370_interrupt, SA_SHIRQ, es1370,s))) {
printk(KERN_ERR es1370: irq %u in use\n, s-irq);
goto err_irq;
}
+
/* initialize codec registers */
/* note: setting CTRL_SERR_DIS is reported to break
 * mic bias setting (by [EMAIL PROTECTED]) */
@@ -2631,14 +2633,22 @@
   (s-ctrl  CTRL_XCTL0) ? out : in,
   (s-ctrl  CTRL_XCTL1) ? 1 : 0);
/* register devices */
-   if ((s-dev_audio = register_sound_dsp(es1370_audio_fops, -1))  0)
+   if ((s-dev_audio = register_sound_dsp(es1370_audio_fops, -1))  0) {
+   ret = s-dev_audio;
goto err_dev1;
-   if ((s-dev_mixer = register_sound_mixer(es1370_mixer_fops, -1))  0)
+   }
+   if ((s-dev_mixer = register_sound_mixer(es1370_mixer_fops, -1))  0) {
+   ret = s-dev_mixer;
goto err_dev2;
-   if ((s-dev_dac = register_sound_dsp(es1370_dac_fops, -1))  0)
+   }
+   if ((s-dev_dac = register_sound_dsp(es1370_dac_fops, -1))  0) {
+   ret = s-dev_dac;
goto err_dev3;
-   if ((s-dev_midi = register_sound_midi(es1370_midi_fops, -1))  0)
+   }
+   if ((s-dev_midi = register_sound_midi(es1370_midi_fops, -1))  0) {
+   ret = s-dev_midi;
goto err_dev4;
+   }
/* initialize the chips */
outl(s-ctrl, s-io+ES1370_REG_CONTROL);
outl(s-sctrl, s-io+ES1370_REG_SERIAL_CONTROL);
@@ -2688,7 +2698,7 @@
release_region(s-io, ES1370_EXTENT);
  err_region:
kfree(s);
-   return -1;
+   return ret;
 }
 
 static void __devinit es1370_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: PATCH: trident , pci_enable_device moved

2001-04-25 Thread Marcus Meissner

On Wed, Apr 25, 2001 at 09:04:38AM +0200, Marcus Meissner wrote:
> Hi Alan, linux-kernel,
> 
> This moves pci_enable_device() in trident.c before any PCI resource access.
> Everything else appears to be ok in regards to 2.4 PCI API and return values.
> 
> Ciao, Marcus

Argh, actually the return value of pci_enable_device*() should be returned.

Ciao, Marcus

Index: drivers/sound/trident.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/trident.c,v
retrieving revision 1.12
diff -u -r1.12 trident.c
--- drivers/sound/trident.c 2001/04/24 09:47:13 1.12
+++ drivers/sound/trident.c 2001/04/25 07:31:11
@@ -3308,7 +3308,11 @@
unsigned long iobase;
struct trident_card *card;
u8 revision;
+   int ret;
 
+   if ((ret=pci_enable_device(pci_dev)))
+   return ret;
+
if (pci_set_dma_mask(pci_dev, TRIDENT_DMA_MASK)) {
printk(KERN_ERR "trident: architecture does not support"
   " 30bit PCI busmaster DMA\n");
@@ -3322,9 +3326,6 @@
   iobase);
return -ENODEV;
}
-
-   if (pci_enable_device(pci_dev))
-   return -ENODEV;
 
if ((card = kmalloc(sizeof(struct trident_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "trident: out of memory\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: trident , pci_enable_device moved

2001-04-25 Thread Marcus Meissner

Hi Alan, linux-kernel,

This moves pci_enable_device() in trident.c before any PCI resource access.
Everything else appears to be ok in regards to 2.4 PCI API and return values.

Ciao, Marcus

Index: trident.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/trident.c,v
retrieving revision 1.12
diff -u -r1.12 trident.c
--- trident.c   2001/04/24 09:47:13 1.12
+++ trident.c   2001/04/24 10:19:36
@@ -3309,6 +3309,9 @@
struct trident_card *card;
u8 revision;
 
+   if (pci_enable_device(pci_dev))
+   return -ENODEV;
+
if (pci_set_dma_mask(pci_dev, TRIDENT_DMA_MASK)) {
printk(KERN_ERR "trident: architecture does not support"
   " 30bit PCI busmaster DMA\n");
@@ -3322,9 +3325,6 @@
   iobase);
return -ENODEV;
}
-
-   if (pci_enable_device(pci_dev))
-   return -ENODEV;
 
if ((card = kmalloc(sizeof(struct trident_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "trident: out of memory\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: trident , pci_enable_device moved

2001-04-25 Thread Marcus Meissner

Hi Alan, linux-kernel,

This moves pci_enable_device() in trident.c before any PCI resource access.
Everything else appears to be ok in regards to 2.4 PCI API and return values.

Ciao, Marcus

Index: trident.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/trident.c,v
retrieving revision 1.12
diff -u -r1.12 trident.c
--- trident.c   2001/04/24 09:47:13 1.12
+++ trident.c   2001/04/24 10:19:36
@@ -3309,6 +3309,9 @@
struct trident_card *card;
u8 revision;
 
+   if (pci_enable_device(pci_dev))
+   return -ENODEV;
+
if (pci_set_dma_mask(pci_dev, TRIDENT_DMA_MASK)) {
printk(KERN_ERR trident: architecture does not support
30bit PCI busmaster DMA\n);
@@ -3322,9 +3325,6 @@
   iobase);
return -ENODEV;
}
-
-   if (pci_enable_device(pci_dev))
-   return -ENODEV;
 
if ((card = kmalloc(sizeof(struct trident_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR trident: out of memory\n);
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] es1371 pci fix/cleanup

2001-04-23 Thread Marcus Meissner

On Mon, Apr 23, 2001 at 11:58:25AM -0400, Jeff Garzik wrote:
> Marcus Meissner wrote:
> > 
> > Hi,
> > 
> > This moves pci_enable_device in the es1371 driver before any resource
> > access and also replaces the RSRCISIOREGION by just pci_resource_flags
> > as suggested by Jeff.
> > 
> > Tested and verified.

> Looks ok except error returns.
> 
> pci_enable_device - obtain its return value, and return that.
> 
> no IORESOURCE_IO or pcidev->irq==0 - I guess -ENODEV would be
> appropriate.  (basically look at errno.h and make a judgement call which
> error best fits the situation)

Hmm, I think I spotted all places in the probe function. I also return
-ENODEV in case we can't request_region() or request_irq().

Some drivers use EBUSY, some ENOMEM, some ENODEV there, is there
any standard return value?

Ciao, Marcus

Index: drivers/sound/es1371.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1371.c,v
retrieving revision 1.7
diff -u -r1.7 es1371.c
--- drivers/sound/es1371.c  2001/04/17 17:26:05 1.7
+++ drivers/sound/es1371.c  2001/04/23 16:03:34
@@ -2771,22 +2771,22 @@
{ SOUND_MIXER_WRITE_IGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \
-(pci_resource_flags((dev), (num)) & IORESOURCE_IO))
-
 static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1371_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, res = -1;
unsigned long tmo;
signed long tmo2;
unsigned int cssr;
+
+   if ((res=pci_enable_device(pcidev)))
+   return res;
 
-   if (!RSRCISIOREGION(pcidev, 0))
-   return -1;
+   if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_IO))
+   return -ENODEV;
if (pcidev->irq == 0) 
-   return -1;
+   return -ENODEV;
i = pci_set_dma_mask(pcidev, 0x);
if (i) {
printk(KERN_WARNING "es1371: architecture does not support 32bit PCI 
busmaster DMA\n");
@@ -2794,7 +2794,7 @@
}
if (!(s = kmalloc(sizeof(struct es1371_state), GFP_KERNEL))) {
printk(KERN_WARNING PFX "out of memory\n");
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct es1371_state));
init_waitqueue_head(>dma_adc.wait);
@@ -2822,8 +2822,6 @@
printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s->irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) {
printk(KERN_ERR PFX "irq %u in use\n", s->irq);
goto err_irq;
@@ -2964,7 +2962,7 @@
release_region(s->io, ES1371_EXTENT);
  err_region:
kfree(s);
-   return -1;
+   return -ENODEV;
 }
 
 static void __devinit es1371_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] es1371 pci fix/cleanup

2001-04-23 Thread Marcus Meissner

Hi,

This moves pci_enable_device in the es1371 driver before any resource
access and also replaces the RSRCISIOREGION by just pci_resource_flags
as suggested by Jeff.

Tested and verified.

Ciao, Marcus

Index: drivers/sound/es1371.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1371.c,v
retrieving revision 1.7
diff -u -r1.7 es1371.c
--- drivers/sound/es1371.c  2001/04/17 17:26:05 1.7
+++ drivers/sound/es1371.c  2001/04/23 15:49:15
@@ -2771,9 +2771,6 @@
{ SOUND_MIXER_WRITE_IGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \
-(pci_resource_flags((dev), (num)) & IORESOURCE_IO))
-
 static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1371_state *s;
@@ -2783,8 +2780,11 @@
signed long tmo2;
unsigned int cssr;
 
-   if (!RSRCISIOREGION(pcidev, 0))
+   if (pci_enable_device(pcidev))
return -1;
+
+   if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_IO))
+   return -1;
if (pcidev->irq == 0) 
return -1;
i = pci_set_dma_mask(pcidev, 0x);
@@ -2822,8 +2822,6 @@
printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s->irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) {
printk(KERN_ERR PFX "irq %u in use\n", s->irq);
goto err_irq;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] es1371 pci fix/cleanup

2001-04-23 Thread Marcus Meissner

On Mon, Apr 23, 2001 at 11:58:25AM -0400, Jeff Garzik wrote:
 Marcus Meissner wrote:
  
  Hi,
  
  This moves pci_enable_device in the es1371 driver before any resource
  access and also replaces the RSRCISIOREGION by just pci_resource_flags
  as suggested by Jeff.
  
  Tested and verified.

 Looks ok except error returns.
 
 pci_enable_device - obtain its return value, and return that.
 
 no IORESOURCE_IO or pcidev-irq==0 - I guess -ENODEV would be
 appropriate.  (basically look at errno.h and make a judgement call which
 error best fits the situation)

Hmm, I think I spotted all places in the probe function. I also return
-ENODEV in case we can't request_region() or request_irq().

Some drivers use EBUSY, some ENOMEM, some ENODEV there, is there
any standard return value?

Ciao, Marcus

Index: drivers/sound/es1371.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1371.c,v
retrieving revision 1.7
diff -u -r1.7 es1371.c
--- drivers/sound/es1371.c  2001/04/17 17:26:05 1.7
+++ drivers/sound/es1371.c  2001/04/23 16:03:34
@@ -2771,22 +2771,22 @@
{ SOUND_MIXER_WRITE_IGAIN, 0x4040 }
 };
 
-#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0  \
-(pci_resource_flags((dev), (num))  IORESOURCE_IO))
-
 static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_device_id 
*pciid)
 {
struct es1371_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, res = -1;
unsigned long tmo;
signed long tmo2;
unsigned int cssr;
+
+   if ((res=pci_enable_device(pcidev)))
+   return res;
 
-   if (!RSRCISIOREGION(pcidev, 0))
-   return -1;
+   if (!(pci_resource_flags(pcidev, 0)  IORESOURCE_IO))
+   return -ENODEV;
if (pcidev-irq == 0) 
-   return -1;
+   return -ENODEV;
i = pci_set_dma_mask(pcidev, 0x);
if (i) {
printk(KERN_WARNING es1371: architecture does not support 32bit PCI 
busmaster DMA\n);
@@ -2794,7 +2794,7 @@
}
if (!(s = kmalloc(sizeof(struct es1371_state), GFP_KERNEL))) {
printk(KERN_WARNING PFX out of memory\n);
-   return -1;
+   return -ENOMEM;
}
memset(s, 0, sizeof(struct es1371_state));
init_waitqueue_head(s-dma_adc.wait);
@@ -2822,8 +2822,6 @@
printk(KERN_ERR PFX io ports %#lx-%#lx in use\n, s-io, 
s-io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s-irq, es1371_interrupt, SA_SHIRQ, es1371, s)) {
printk(KERN_ERR PFX irq %u in use\n, s-irq);
goto err_irq;
@@ -2964,7 +2962,7 @@
release_region(s-io, ES1371_EXTENT);
  err_region:
kfree(s);
-   return -1;
+   return -ENODEV;
 }
 
 static void __devinit es1371_remove(struct pci_dev *dev)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] drivers/sound/nm256_audio.c

2001-04-19 Thread Marcus Meissner

On Thu, Apr 19, 2001 at 11:56:01AM -0400, Jeff Garzik wrote:
> Marcus Meissner wrote:
> > 
> > Hi,
> > 
> > This updates the nm256_audio driver to the 2.4 PCI API.
> > 
> > Patch is against 2.4.3-ac9, verified on Sony VAIO Laptop.
> 
> "verified" is the really important part with this driver, since its
> really finicky.  I have a patch I would love to bounce to you in
> private, that I have been searching for a tester for -months- because I
> had no test hardware of my own.

Feel free to send (I have a NM256AV card in that VAIO).

> Your patch looks ok to me and I would say apply it.  But I also think it
> is incomplete.
> 
> * there is no need for a linked list of cards, since
> pci_{get,set}_drvdata is used.  This eliminates the list walk in
> nm256_remove

The problem is with device opens, which just pass numbers, most other
sound drivers still use linked lists.

Hmm, but via8_audio.c doesn't, I will take this as example.

> * the new PCI API has suspend/resume hooks, and those should be used in
> preference to register_pm_...

Ok, will have another look at the other issues.

And I hope my colleague brings his VAIO to work tomorrow ;)

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] drivers/sound/nm256_audio.c

2001-04-19 Thread Marcus Meissner

Hi,

This updates the nm256_audio driver to the 2.4 PCI API.

Patch is against 2.4.3-ac9, verified on Sony VAIO Laptop.

Ciao, Marcus

Index: drivers/sound/nm256_audio.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/nm256_audio.c,v
retrieving revision 1.1
diff -u -r1.1 nm256_audio.c
--- drivers/sound/nm256_audio.c 2001/04/17 14:50:30 1.1
+++ drivers/sound/nm256_audio.c 2001/04/19 15:28:43
@@ -15,6 +16,8 @@
  * Changes:
  * 11-10-2000  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
  * Added some __init
+ * 19-04-2001  Marcus Meissner <[EMAIL PROTECTED]>
+ * Ported to 2.4 PCI API.
  */
 
 #define __NO_VERSION__
@@ -49,8 +52,6 @@
 #define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
 #define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
 
-#define RSRCADDRESS(dev,num) ((dev)->resource[(num)].start)
-
 /* List of cards.  */
 static struct nm256_info *nmcard_list;
 
@@ -1042,6 +1043,9 @@
 struct pm_dev *pmdev;
 int x;
 
+if (pci_enable_device(pcidev))
+   return 0;
+
 card = kmalloc (sizeof (struct nm256_info), GFP_KERNEL);
 if (card == NULL) {
printk (KERN_ERR "NM256: out of memory!\n");
@@ -1055,7 +1059,7 @@
 
 /* Init the memory port info.  */
 for (x = 0; x < 2; x++) {
-   card->port[x].physaddr = RSRCADDRESS (pcidev, x);
+   card->port[x].physaddr = pci_resource_start (pcidev, x);
card->port[x].ptr = NULL;
card->port[x].start_offset = 0;
card->port[x].end_offset = 0;
@@ -1201,6 +1205,8 @@
}
 }
 
+pci_set_drvdata(pcidev,card);
+
 /* Insert the card in the list.  */
 card->next_card = nmcard_list;
 nmcard_list = card;
@@ -1251,37 +1257,38 @@
 return 0;
 }
 
-/*
- * This loop walks the PCI configuration database and finds where
- * the sound cards are.
- */
- 
-int __init
-init_nm256(void)
+static int __devinit
+nm256_probe(struct pci_dev *pcidev,const struct pci_device_id *pciid)
 {
-struct pci_dev *pcidev = NULL;
-int count = 0;
-
-if(! pci_present())
-   return -ENODEV;
-
-while((pcidev = pci_find_device(PCI_VENDOR_ID_NEOMAGIC,
-   PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO,
-   pcidev)) != NULL) {
-   count += nm256_install(pcidev, REV_NM256AV, "256AV");
-}
-
-while((pcidev = pci_find_device(PCI_VENDOR_ID_NEOMAGIC,
-   PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO,
-   pcidev)) != NULL) {
-   count += nm256_install(pcidev, REV_NM256ZX, "256ZX");
+if (pcidev->device == PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO)
+   return nm256_install(pcidev, REV_NM256AV, "256AV");
+if (pcidev->device == PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO)
+   return nm256_install(pcidev, REV_NM256ZX, "256ZX");
+return -1; /* should not come here ... */
+}
+
+static void __devinit
+nm256_remove(struct pci_dev *pcidev) {
+struct nm256_info *xcard = pci_get_drvdata(pcidev);
+struct nm256_info *card,*next_card = NULL;
+
+for (card = nmcard_list; card != NULL; card = next_card) {
+   next_card = card->next_card;
+   if (card == xcard) {
+   stopPlay (card);
+   stopRecord (card);
+   if (card->has_irq)
+   free_irq (card->irq, card);
+   nm256_release_ports (card);
+   sound_unload_mixerdev (card->mixer_oss_dev);
+   sound_unload_audiodev (card->dev[0]);
+   sound_unload_audiodev (card->dev[1]);
+   kfree (card);
+   break;
+   }
 }
-
-if (count == 0)
-   return -ENODEV;
-
-printk (KERN_INFO "Done installing NM256 audio driver.\n");
-return 0;
+if (nmcard_list == card)
+   nmcard_list = next_card;
 }
 
 /*
@@ -1639,9 +1646,21 @@
 local_qlen:nm256_audio_local_qlen,
 };
 
-EXPORT_SYMBOL(init_nm256);
+static struct pci_device_id nm256_pci_tbl[] __devinitdata = {
+   {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO,
+   PCI_ANY_ID, PCI_ANY_ID, 0, 0},
+   {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO,
+   PCI_ANY_ID, PCI_ANY_ID, 0, 0},
+   {0,}
+};
+MODULE_DEVICE_TABLE(pci, nm256_pci_tbl);
 
-static int loaded = 0;
+struct pci_driver nm256_pci_driver = {
+   name:"nm256_audio",
+   id_table:nm256_pci_tbl,
+   probe:nm256_probe,
+   remove:nm256_remove,
+};
 
 MODULE_PARM (usecache, "i");
 MODULE_PARM (buffertop, "i");
@@ -1650,37 +1669,13 @@
 
 static int __init do_init_nm256(void)
 {
-nmcard_list = NULL;
-printk (KERN_INFO "NeoMagic 256AV/256ZX audio driver, version 1.1\n");
-
-if (init_nm256 () == 0) {
-   loaded = 1;
-   return 0;
-}
-else
-   return -ENODE

[PATCH] drivers/sound/nm256_audio.c

2001-04-19 Thread Marcus Meissner

Hi,

This updates the nm256_audio driver to the 2.4 PCI API.

Patch is against 2.4.3-ac9, verified on Sony VAIO Laptop.

Ciao, Marcus

Index: drivers/sound/nm256_audio.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/nm256_audio.c,v
retrieving revision 1.1
diff -u -r1.1 nm256_audio.c
--- drivers/sound/nm256_audio.c 2001/04/17 14:50:30 1.1
+++ drivers/sound/nm256_audio.c 2001/04/19 15:28:43
@@ -15,6 +16,8 @@
  * Changes:
  * 11-10-2000  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  * Added some __init
+ * 19-04-2001  Marcus Meissner [EMAIL PROTECTED]
+ * Ported to 2.4 PCI API.
  */
 
 #define __NO_VERSION__
@@ -49,8 +52,6 @@
 #define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
 #define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
 
-#define RSRCADDRESS(dev,num) ((dev)-resource[(num)].start)
-
 /* List of cards.  */
 static struct nm256_info *nmcard_list;
 
@@ -1042,6 +1043,9 @@
 struct pm_dev *pmdev;
 int x;
 
+if (pci_enable_device(pcidev))
+   return 0;
+
 card = kmalloc (sizeof (struct nm256_info), GFP_KERNEL);
 if (card == NULL) {
printk (KERN_ERR "NM256: out of memory!\n");
@@ -1055,7 +1059,7 @@
 
 /* Init the memory port info.  */
 for (x = 0; x  2; x++) {
-   card-port[x].physaddr = RSRCADDRESS (pcidev, x);
+   card-port[x].physaddr = pci_resource_start (pcidev, x);
card-port[x].ptr = NULL;
card-port[x].start_offset = 0;
card-port[x].end_offset = 0;
@@ -1201,6 +1205,8 @@
}
 }
 
+pci_set_drvdata(pcidev,card);
+
 /* Insert the card in the list.  */
 card-next_card = nmcard_list;
 nmcard_list = card;
@@ -1251,37 +1257,38 @@
 return 0;
 }
 
-/*
- * This loop walks the PCI configuration database and finds where
- * the sound cards are.
- */
- 
-int __init
-init_nm256(void)
+static int __devinit
+nm256_probe(struct pci_dev *pcidev,const struct pci_device_id *pciid)
 {
-struct pci_dev *pcidev = NULL;
-int count = 0;
-
-if(! pci_present())
-   return -ENODEV;
-
-while((pcidev = pci_find_device(PCI_VENDOR_ID_NEOMAGIC,
-   PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO,
-   pcidev)) != NULL) {
-   count += nm256_install(pcidev, REV_NM256AV, "256AV");
-}
-
-while((pcidev = pci_find_device(PCI_VENDOR_ID_NEOMAGIC,
-   PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO,
-   pcidev)) != NULL) {
-   count += nm256_install(pcidev, REV_NM256ZX, "256ZX");
+if (pcidev-device == PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO)
+   return nm256_install(pcidev, REV_NM256AV, "256AV");
+if (pcidev-device == PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO)
+   return nm256_install(pcidev, REV_NM256ZX, "256ZX");
+return -1; /* should not come here ... */
+}
+
+static void __devinit
+nm256_remove(struct pci_dev *pcidev) {
+struct nm256_info *xcard = pci_get_drvdata(pcidev);
+struct nm256_info *card,*next_card = NULL;
+
+for (card = nmcard_list; card != NULL; card = next_card) {
+   next_card = card-next_card;
+   if (card == xcard) {
+   stopPlay (card);
+   stopRecord (card);
+   if (card-has_irq)
+   free_irq (card-irq, card);
+   nm256_release_ports (card);
+   sound_unload_mixerdev (card-mixer_oss_dev);
+   sound_unload_audiodev (card-dev[0]);
+   sound_unload_audiodev (card-dev[1]);
+   kfree (card);
+   break;
+   }
 }
-
-if (count == 0)
-   return -ENODEV;
-
-printk (KERN_INFO "Done installing NM256 audio driver.\n");
-return 0;
+if (nmcard_list == card)
+   nmcard_list = next_card;
 }
 
 /*
@@ -1639,9 +1646,21 @@
 local_qlen:nm256_audio_local_qlen,
 };
 
-EXPORT_SYMBOL(init_nm256);
+static struct pci_device_id nm256_pci_tbl[] __devinitdata = {
+   {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO,
+   PCI_ANY_ID, PCI_ANY_ID, 0, 0},
+   {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO,
+   PCI_ANY_ID, PCI_ANY_ID, 0, 0},
+   {0,}
+};
+MODULE_DEVICE_TABLE(pci, nm256_pci_tbl);
 
-static int loaded = 0;
+struct pci_driver nm256_pci_driver = {
+   name:"nm256_audio",
+   id_table:nm256_pci_tbl,
+   probe:nm256_probe,
+   remove:nm256_remove,
+};
 
 MODULE_PARM (usecache, "i");
 MODULE_PARM (buffertop, "i");
@@ -1650,37 +1669,13 @@
 
 static int __init do_init_nm256(void)
 {
-nmcard_list = NULL;
-printk (KERN_INFO "NeoMagic 256AV/256ZX audio driver, version 1.1\n");
-
-if (init_nm256 () == 0) {
-   loaded = 1;
-   return 0;
-}
-else
-   return -ENODEV;
+printk (KERN_INFO "NeoMagic 256AV/256ZX audio driver, vers

Re: [PATCH] drivers/sound/nm256_audio.c

2001-04-19 Thread Marcus Meissner

On Thu, Apr 19, 2001 at 11:56:01AM -0400, Jeff Garzik wrote:
 Marcus Meissner wrote:
  
  Hi,
  
  This updates the nm256_audio driver to the 2.4 PCI API.
  
  Patch is against 2.4.3-ac9, verified on Sony VAIO Laptop.
 
 "verified" is the really important part with this driver, since its
 really finicky.  I have a patch I would love to bounce to you in
 private, that I have been searching for a tester for -months- because I
 had no test hardware of my own.

Feel free to send (I have a NM256AV card in that VAIO).

 Your patch looks ok to me and I would say apply it.  But I also think it
 is incomplete.
 
 * there is no need for a linked list of cards, since
 pci_{get,set}_drvdata is used.  This eliminates the list walk in
 nm256_remove

The problem is with device opens, which just pass numbers, most other
sound drivers still use linked lists.

Hmm, but via8_audio.c doesn't, I will take this as example.

 * the new PCI API has suspend/resume hooks, and those should be used in
 preference to register_pm_...

Ok, will have another look at the other issues.

And I hope my colleague brings his VAIO to work tomorrow ;)

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] misplaced pci_enable_device()s in drivers/sound/

2001-04-18 Thread Marcus Meissner

On Wed, Apr 18, 2001 at 12:55:50PM -0400, Jeff Garzik wrote:
> Marcus Meissner wrote:
> > Several pci_enable_device()s in drivers/sound happen _after_ accessing
> > PCI resources. I have moved them before the relevant first accesses.
> 
> cool
> 
> > if (!RSRCISIOREGION(pcidev, 0))
> > return -1;
> 
> can you replace this mess while you are cleaning stuff up.  this, for
> example, should be
>   if (!(pci_resource_flags(pcidev,) & IORESOURCE_IO))
> 
> There is also pci_resource_start and pci_resource_len.
> 
> > iobase = SILLY_PCI_BASE_ADDRESS(pcidev);
> 
> pci_resource_start

THere is also some pci dma stuff which probably got changed.

> patch looks ok to me, but those would be nice additions...

I am a bit afraid to break stuff doing this without testing, but I will
do it for the cards I have access to.

Is there a 'HOW TO DO IT' PCI driver?

drivers/net/pci-skeleton.c looks up to date, is it?

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] misplaced pci_enable_device()s in drivers/sound/

2001-04-18 Thread Marcus Meissner

Hi,

Several pci_enable_device()s in drivers/sound happen _after_ accessing 
PCI resources. I have moved them before the relevant first accesses.

(Untested, but should work.)

Against 2.4.3-ac9.

Ciao, Marcus

Index: es1370.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1370.c,v
retrieving revision 1.13
diff -u -r1.13 es1370.c
--- es1370.c2001/04/17 17:26:05 1.13
+++ es1370.c2001/04/18 16:24:05
@@ -2569,6 +2569,9 @@
mm_segment_t fs;
int i, val;
 
+   if (pci_enable_device(pcidev))
+   return -1;
+
if (!RSRCISIOREGION(pcidev, 0))
return -1;
if (pcidev->irq == 0) 
@@ -2599,8 +2602,6 @@
printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1370_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) {
printk(KERN_ERR "es1370: irq %u in use\n", s->irq);
goto err_irq;
Index: es1371.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1371.c,v
retrieving revision 1.7
diff -u -r1.7 es1371.c
--- es1371.c2001/04/17 17:26:05 1.7
+++ es1371.c2001/04/18 16:24:20
@@ -2783,6 +2783,9 @@
signed long tmo2;
unsigned int cssr;
 
+   if (pci_enable_device(pcidev))
+   return -1;
+
if (!RSRCISIOREGION(pcidev, 0))
return -1;
if (pcidev->irq == 0) 
@@ -2822,8 +2825,6 @@
printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s->irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) {
printk(KERN_ERR PFX "irq %u in use\n", s->irq);
goto err_irq;
Index: esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.7
diff -u -r1.7 esssolo1.c
--- esssolo1.c  2001/04/17 17:26:05 1.7
+++ esssolo1.c  2001/04/18 16:24:35
@@ -2297,6 +2297,8 @@
struct solo1_state *s;
struct pm_dev *pmdev;
 
+   if (pci_enable_device(pcidev))
+   return -1;
if (!RSRCISIOREGION(pcidev, 0) ||
!RSRCISIOREGION(pcidev, 1) ||
!RSRCISIOREGION(pcidev, 2) ||
@@ -2362,8 +2364,6 @@
printk(KERN_ERR "solo1: irq %u in use\n", s->irq);
goto err_irq;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
printk(KERN_INFO "solo1: joystick port at %#x\n", s->gameport.io+1);
/* register devices */
if ((s->dev_audio = register_sound_dsp(_audio_fops, -1)) < 0)
Index: maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.4
diff -u -r1.4 maestro.c
--- maestro.c   2001/04/17 15:49:10 1.4
+++ maestro.c   2001/04/18 16:25:21
@@ -3321,6 +3321,9 @@
/* don't pick up weird modem maestros */
if(((pcidev->class >> 8) & 0x) != PCI_CLASS_MULTIMEDIA_AUDIO)
return 0;
+
+   if (pci_enable_device(pcidev))
+   return 0;

iobase = SILLY_PCI_BASE_ADDRESS(pcidev); 
 
@@ -3406,19 +3409,6 @@
}

ess = >channels[0];
-
-   if (pci_enable_device(pcidev)) {
-   printk (KERN_ERR "maestro: pci_enable_device() failed\n");
-   for (i = 0; i < NR_DSPS; i++) {
-   struct ess_state *s = >channels[i];
-   if (s->dev_audio != -1)
-   unregister_sound_dsp(s->dev_audio);
-   }
-   release_region(card->iobase, 256);
-   unregister_reboot_notifier(_nb);
-   kfree(card);
-   return 0;
-   }
 
/*
 *  Ok card ready. Begin setup proper
Index: sonicvibes.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/sonicvibes.c,v
retrieving revision 1.7
diff -u -r1.7 sonicvibes.c
--- sonicvibes.c2001/04/17 17:26:05 1.7
+++ sonicvibes.c2001/04/18 16:26:01
@@ -2508,6 +2508,8 @@
char *ddmaname;
unsigned ddmanamelen;
 
+   if (pci_enable_device(pcidev))
+   return -1;
if (!RSRCISIOREGION(pcidev, RESOURCE_SB) ||
!RSRCISIOREGION(pcidev, RESOURCE_ENH) ||
!RSRCISIOREGION(pcidev, RESOURCE_SYNTH) ||
@@ -2594,8 +2596,6 @@
printk(KERN_ERR "sv: gameport io ports in use\n");
s->gameport.io 

[PATCH] toshoboe pci enable

2001-04-18 Thread Marcus Meissner

Hi,

Enable PCI for toshoboe IRDA adapters.

Ciao, Marcus

Index: drivers/net/irda/toshoboe.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/net/irda/toshoboe.c,v
retrieving revision 1.12
diff -u -r1.12 toshoboe.c
--- drivers/net/irda/toshoboe.c 2001/04/17 17:26:03 1.12
+++ drivers/net/irda/toshoboe.c 2001/04/18 16:18:24
@@ -722,6 +722,9 @@
   return -ENOMEM;
 }
 
+  if ((err=pci_enable_device(pci_dev)))
+ return err;
+
   self = kmalloc (sizeof (struct toshoboe_cb), GFP_KERNEL);
 
   if (self == NULL)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] pci enable nm256 audio

2001-04-18 Thread Marcus Meissner

Hi Alan, linux-kernel,

Some of our customer reported a hang when modprobing nm256_audio, 
this patch should fix the problem.

Ciao, Marcus

Index: nm256_audio.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/nm256_audio.c,v
retrieving revision 1.1
diff -u -r1.1 nm256_audio.c
--- nm256_audio.c   2001/04/17 14:50:30 1.1
+++ nm256_audio.c   2001/04/18 16:13:38
@@ -1042,6 +1042,9 @@
 struct pm_dev *pmdev;
 int x;
 
+if (pci_enable_device(pcidev))
+   return 0;
+
 card = kmalloc (sizeof (struct nm256_info), GFP_KERNEL);
 if (card == NULL) {
printk (KERN_ERR "NM256: out of memory!\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] pci enable nm256 audio

2001-04-18 Thread Marcus Meissner

Hi Alan, linux-kernel,

Some of our customer reported a hang when modprobing nm256_audio, 
this patch should fix the problem.

Ciao, Marcus

Index: nm256_audio.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/nm256_audio.c,v
retrieving revision 1.1
diff -u -r1.1 nm256_audio.c
--- nm256_audio.c   2001/04/17 14:50:30 1.1
+++ nm256_audio.c   2001/04/18 16:13:38
@@ -1042,6 +1042,9 @@
 struct pm_dev *pmdev;
 int x;
 
+if (pci_enable_device(pcidev))
+   return 0;
+
 card = kmalloc (sizeof (struct nm256_info), GFP_KERNEL);
 if (card == NULL) {
printk (KERN_ERR "NM256: out of memory!\n");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] toshoboe pci enable

2001-04-18 Thread Marcus Meissner

Hi,

Enable PCI for toshoboe IRDA adapters.

Ciao, Marcus

Index: drivers/net/irda/toshoboe.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/net/irda/toshoboe.c,v
retrieving revision 1.12
diff -u -r1.12 toshoboe.c
--- drivers/net/irda/toshoboe.c 2001/04/17 17:26:03 1.12
+++ drivers/net/irda/toshoboe.c 2001/04/18 16:18:24
@@ -722,6 +722,9 @@
   return -ENOMEM;
 }
 
+  if ((err=pci_enable_device(pci_dev)))
+ return err;
+
   self = kmalloc (sizeof (struct toshoboe_cb), GFP_KERNEL);
 
   if (self == NULL)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] misplaced pci_enable_device()s in drivers/sound/

2001-04-18 Thread Marcus Meissner

Hi,

Several pci_enable_device()s in drivers/sound happen _after_ accessing 
PCI resources. I have moved them before the relevant first accesses.

(Untested, but should work.)

Against 2.4.3-ac9.

Ciao, Marcus

Index: es1370.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1370.c,v
retrieving revision 1.13
diff -u -r1.13 es1370.c
--- es1370.c2001/04/17 17:26:05 1.13
+++ es1370.c2001/04/18 16:24:05
@@ -2569,6 +2569,9 @@
mm_segment_t fs;
int i, val;
 
+   if (pci_enable_device(pcidev))
+   return -1;
+
if (!RSRCISIOREGION(pcidev, 0))
return -1;
if (pcidev-irq == 0) 
@@ -2599,8 +2602,6 @@
printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s-io, 
s-io+ES1370_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s-irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) {
printk(KERN_ERR "es1370: irq %u in use\n", s-irq);
goto err_irq;
Index: es1371.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/es1371.c,v
retrieving revision 1.7
diff -u -r1.7 es1371.c
--- es1371.c2001/04/17 17:26:05 1.7
+++ es1371.c2001/04/18 16:24:20
@@ -2783,6 +2783,9 @@
signed long tmo2;
unsigned int cssr;
 
+   if (pci_enable_device(pcidev))
+   return -1;
+
if (!RSRCISIOREGION(pcidev, 0))
return -1;
if (pcidev-irq == 0) 
@@ -2822,8 +2825,6 @@
printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s-io, 
s-io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s-irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) {
printk(KERN_ERR PFX "irq %u in use\n", s-irq);
goto err_irq;
Index: esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.7
diff -u -r1.7 esssolo1.c
--- esssolo1.c  2001/04/17 17:26:05 1.7
+++ esssolo1.c  2001/04/18 16:24:35
@@ -2297,6 +2297,8 @@
struct solo1_state *s;
struct pm_dev *pmdev;
 
+   if (pci_enable_device(pcidev))
+   return -1;
if (!RSRCISIOREGION(pcidev, 0) ||
!RSRCISIOREGION(pcidev, 1) ||
!RSRCISIOREGION(pcidev, 2) ||
@@ -2362,8 +2364,6 @@
printk(KERN_ERR "solo1: irq %u in use\n", s-irq);
goto err_irq;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
printk(KERN_INFO "solo1: joystick port at %#x\n", s-gameport.io+1);
/* register devices */
if ((s-dev_audio = register_sound_dsp(solo1_audio_fops, -1))  0)
Index: maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.4
diff -u -r1.4 maestro.c
--- maestro.c   2001/04/17 15:49:10 1.4
+++ maestro.c   2001/04/18 16:25:21
@@ -3321,6 +3321,9 @@
/* don't pick up weird modem maestros */
if(((pcidev-class  8)  0x) != PCI_CLASS_MULTIMEDIA_AUDIO)
return 0;
+
+   if (pci_enable_device(pcidev))
+   return 0;

iobase = SILLY_PCI_BASE_ADDRESS(pcidev); 
 
@@ -3406,19 +3409,6 @@
}

ess = card-channels[0];
-
-   if (pci_enable_device(pcidev)) {
-   printk (KERN_ERR "maestro: pci_enable_device() failed\n");
-   for (i = 0; i  NR_DSPS; i++) {
-   struct ess_state *s = card-channels[i];
-   if (s-dev_audio != -1)
-   unregister_sound_dsp(s-dev_audio);
-   }
-   release_region(card-iobase, 256);
-   unregister_reboot_notifier(maestro_nb);
-   kfree(card);
-   return 0;
-   }
 
/*
 *  Ok card ready. Begin setup proper
Index: sonicvibes.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/sonicvibes.c,v
retrieving revision 1.7
diff -u -r1.7 sonicvibes.c
--- sonicvibes.c2001/04/17 17:26:05 1.7
+++ sonicvibes.c2001/04/18 16:26:01
@@ -2508,6 +2508,8 @@
char *ddmaname;
unsigned ddmanamelen;
 
+   if (pci_enable_device(pcidev))
+   return -1;
if (!RSRCISIOREGION(pcidev, RESOURCE_SB) ||
!RSRCISIOREGION(pcidev, RESOURCE_ENH) ||
!RSRCISIOREGION(pcidev, RESOURCE_SYNTH) ||
@@ -2594,8 +2596,6 @@
printk(KERN_ERR "sv: gameport io ports in use\n");
s-gameport.io = 

Re: [PATCH] misplaced pci_enable_device()s in drivers/sound/

2001-04-18 Thread Marcus Meissner

On Wed, Apr 18, 2001 at 12:55:50PM -0400, Jeff Garzik wrote:
 Marcus Meissner wrote:
  Several pci_enable_device()s in drivers/sound happen _after_ accessing
  PCI resources. I have moved them before the relevant first accesses.
 
 cool
 
  if (!RSRCISIOREGION(pcidev, 0))
  return -1;
 
 can you replace this mess while you are cleaning stuff up.  this, for
 example, should be
   if (!(pci_resource_flags(pcidev,)  IORESOURCE_IO))
 
 There is also pci_resource_start and pci_resource_len.
 
  iobase = SILLY_PCI_BASE_ADDRESS(pcidev);
 
 pci_resource_start

THere is also some pci dma stuff which probably got changed.

 patch looks ok to me, but those would be nice additions...

I am a bit afraid to break stuff doing this without testing, but I will
do it for the cards I have access to.

Is there a 'HOW TO DO IT' PCI driver?

drivers/net/pci-skeleton.c looks up to date, is it?

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [Problem] 3c90x on 2.4.3-ac3

2001-04-05 Thread Marcus Meissner

In article <[EMAIL PROTECTED]> you wrote:

> hi lkml,
>   I just built 2.4.3-ac3 with my old 2.4.2 .config and somehow networking does 
>not work. 
> dhclient eventually froze the machine.

> here is what dhclient complains.

> [root@psubash linux]# cat /tmp/error.txt
> skb: pf=2 (unowned) dev=lo len=328
> PROTO=17 0.0.0.0:68 255.255.255.255:67 L=328 S=0x10 I=0 F=0x T=16
> DHCPDISCOVER on lo to 255.255.255.255 port 67 interval 14
> ip_local_deliver: bad loopback skb: PRE_ROUTING LOCAL_IN
> skb: pf=2 (unowned) dev=lo len=328
> PROTO=17 0.0.0.0:68 255.255.255.255:67 L=328 S=0x10 I=0 F=0x T=16
> DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
> DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
> DHCPDISCOVER on lo to 255.255.255.255 port 67 interval 12
> ip_local_deliver: bad loopback skb: PRE_ROUTING LOCAL_IN
> skb: pf=2 (unowned) dev=lo len=328

> Here is my ver_linux info

...
> CONFIG_ACPI=y

The ACPI powermanagement for the 3c59x devices appears to be a bit broken.

Disable ACPI support. Recompile. Reboot. Watch problem disappear hopefully.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: pci_enable_device fixes for sound/* and block/cpqarray and block/cciss

2001-03-13 Thread Marcus Meissner

Hi Alan, linux-kernel,

This moves all pci_enable_device()s before any resource usage in 
sound/*.c,sound/*/*.c and block/cciss.c, block/cpqarray.c.

I have NOT tested them except the es1370, but they should be correct as
is.

Note that it was missing in nm256_audio.c.

Ciao, Marcus

--- linux/drivers/block/cciss.c.marcus  Tue Mar 13 14:23:52 2001
+++ linux/drivers/block/cciss.c Tue Mar 13 14:23:55 2001
@@ -1438,9 +1438,13 @@
int cfg_offset;
int cfg_base_addr;
int cfg_base_addr_index;
-   int i;
+   int i, err;
 
pdev = pci_find_slot(bus, device_fn);
+
+   if ((err=pci_enable_device(pdev)))
+   return err;
+   
vendor_id = pdev->vendor;
device_id = pdev->device;
irq = pdev->irq;
@@ -1448,9 +1452,6 @@
for(i=0; i<6; i++)
addr[i] = pdev->resource[i].start;
 
-   if (pci_enable_device(pdev))
-   return( -1);
-   
(void) pci_read_config_word(pdev, PCI_COMMAND,);
(void) pci_read_config_byte(pdev, PCI_CLASS_REVISION, );
(void) pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE,
--- linux/drivers/block/cpqarray.c.marcus   Tue Feb 13 23:13:43 2001
+++ linux/drivers/block/cpqarray.c  Tue Mar 13 14:23:55 2001
@@ -635,10 +635,13 @@
unchar irq, revision;
unsigned long addr[6];
__u32 board_id;
-
-   int i;
+   int i, err;
 
c->pci_dev = pdev;
+
+   if ((err=pci_enable_device(pdev)))
+   return err;
+
vendor_id = pdev->vendor;
device_id = pdev->device;
irq = pdev->irq;
@@ -646,9 +649,6 @@
for(i=0; i<6; i++)
addr[i] = pci_resource_start(pdev, i);
 
-   if (pci_enable_device(pdev))
-   return -1;
-
pci_read_config_word(pdev, PCI_COMMAND, );
pci_read_config_byte(pdev, PCI_CLASS_REVISION, );
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, _line_size);
--- linux/drivers/sound/emu10k1/main.c.marcus   Fri Feb  9 20:30:23 2001
+++ linux/drivers/sound/emu10k1/main.c  Tue Mar 13 14:23:55 2001
@@ -612,6 +612,10 @@
 {
struct emu10k1_card *card;
u32 subsysvid;
+   int err;
+
+   if ((err=pci_enable_device(pci_dev)))
+   return err;
 
if ((card = kmalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "emu10k1: out of memory\n");
@@ -624,11 +628,6 @@
kfree(card);
return -ENODEV;
}
-
-   if (pci_enable_device(pci_dev)) {
-   kfree(card);
-   return -ENODEV;
-   }
 
pci_set_master(pci_dev);
 
--- linux/drivers/sound/cs46xx.c.marcus Tue Mar 13 14:23:54 2001
+++ linux/drivers/sound/cs46xx.cTue Mar 13 14:25:33 2001
@@ -4054,7 +4054,10 @@
struct pm_dev *pmdev;
 #endif
u16 ss_card, ss_vendor;
+   int err;

+   if ((err=pci_enable_device(pci_dev)))
+   return err;

pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, _vendor);
pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, _card);
--- linux/drivers/sound/es1370.c.marcus Tue Mar 13 14:23:54 2001
+++ linux/drivers/sound/es1370.cTue Mar 13 14:23:55 2001
@@ -2519,7 +2519,10 @@
 {
struct es1370_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, err;
+
+   if ((err=pci_enable_device(pcidev)))
+   return err;
 
if (!RSRCISIOREGION(pcidev, 0))
return -1;
@@ -2550,8 +2553,6 @@
printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1370_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s->irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) {
printk(KERN_ERR "es1370: irq %u in use\n", s->irq);
goto err_irq;
--- linux/drivers/sound/es1371.c.marcus Fri Feb  9 20:30:23 2001
+++ linux/drivers/sound/es1371.cTue Mar 13 14:23:55 2001
@@ -2728,11 +2728,13 @@
 {
struct es1371_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, err;
unsigned long tmo;
signed long tmo2;
unsigned int cssr;
 
+   if ((err=pci_enable_device(pcidev)))
+   return err;
if (!RSRCISIOREGION(pcidev, 0))
return -1;
if (pcidev->irq == 0) 
@@ -2771,8 +2773,6 @@
printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s->io, 
s->io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s->irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) {
printk(KERN_ERR PFX "irq %u in use\n", s->irq);
goto err_irq;
--- linux/drivers/sound/esssolo1.c.marcus   Fri Feb  9 20:30:23 2001
+++ linux/drivers/sound/esssolo1.c  Tue Mar 13 14:23:55 2001

PATCH: pci_enable_device fixes for sound/* and block/cpqarray and block/cciss

2001-03-13 Thread Marcus Meissner

Hi Alan, linux-kernel,

This moves all pci_enable_device()s before any resource usage in 
sound/*.c,sound/*/*.c and block/cciss.c, block/cpqarray.c.

I have NOT tested them except the es1370, but they should be correct as
is.

Note that it was missing in nm256_audio.c.

Ciao, Marcus

--- linux/drivers/block/cciss.c.marcus  Tue Mar 13 14:23:52 2001
+++ linux/drivers/block/cciss.c Tue Mar 13 14:23:55 2001
@@ -1438,9 +1438,13 @@
int cfg_offset;
int cfg_base_addr;
int cfg_base_addr_index;
-   int i;
+   int i, err;
 
pdev = pci_find_slot(bus, device_fn);
+
+   if ((err=pci_enable_device(pdev)))
+   return err;
+   
vendor_id = pdev-vendor;
device_id = pdev-device;
irq = pdev-irq;
@@ -1448,9 +1452,6 @@
for(i=0; i6; i++)
addr[i] = pdev-resource[i].start;
 
-   if (pci_enable_device(pdev))
-   return( -1);
-   
(void) pci_read_config_word(pdev, PCI_COMMAND,command);
(void) pci_read_config_byte(pdev, PCI_CLASS_REVISION, revision);
(void) pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE,
--- linux/drivers/block/cpqarray.c.marcus   Tue Feb 13 23:13:43 2001
+++ linux/drivers/block/cpqarray.c  Tue Mar 13 14:23:55 2001
@@ -635,10 +635,13 @@
unchar irq, revision;
unsigned long addr[6];
__u32 board_id;
-
-   int i;
+   int i, err;
 
c-pci_dev = pdev;
+
+   if ((err=pci_enable_device(pdev)))
+   return err;
+
vendor_id = pdev-vendor;
device_id = pdev-device;
irq = pdev-irq;
@@ -646,9 +649,6 @@
for(i=0; i6; i++)
addr[i] = pci_resource_start(pdev, i);
 
-   if (pci_enable_device(pdev))
-   return -1;
-
pci_read_config_word(pdev, PCI_COMMAND, command);
pci_read_config_byte(pdev, PCI_CLASS_REVISION, revision);
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, cache_line_size);
--- linux/drivers/sound/emu10k1/main.c.marcus   Fri Feb  9 20:30:23 2001
+++ linux/drivers/sound/emu10k1/main.c  Tue Mar 13 14:23:55 2001
@@ -612,6 +612,10 @@
 {
struct emu10k1_card *card;
u32 subsysvid;
+   int err;
+
+   if ((err=pci_enable_device(pci_dev)))
+   return err;
 
if ((card = kmalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "emu10k1: out of memory\n");
@@ -624,11 +628,6 @@
kfree(card);
return -ENODEV;
}
-
-   if (pci_enable_device(pci_dev)) {
-   kfree(card);
-   return -ENODEV;
-   }
 
pci_set_master(pci_dev);
 
--- linux/drivers/sound/cs46xx.c.marcus Tue Mar 13 14:23:54 2001
+++ linux/drivers/sound/cs46xx.cTue Mar 13 14:25:33 2001
@@ -4054,7 +4054,10 @@
struct pm_dev *pmdev;
 #endif
u16 ss_card, ss_vendor;
+   int err;

+   if ((err=pci_enable_device(pci_dev)))
+   return err;

pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, ss_vendor);
pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, ss_card);
--- linux/drivers/sound/es1370.c.marcus Tue Mar 13 14:23:54 2001
+++ linux/drivers/sound/es1370.cTue Mar 13 14:23:55 2001
@@ -2519,7 +2519,10 @@
 {
struct es1370_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, err;
+
+   if ((err=pci_enable_device(pcidev)))
+   return err;
 
if (!RSRCISIOREGION(pcidev, 0))
return -1;
@@ -2550,8 +2553,6 @@
printk(KERN_ERR "es1370: io ports %#lx-%#lx in use\n", s-io, 
s-io+ES1370_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s-irq, es1370_interrupt, SA_SHIRQ, "es1370", s)) {
printk(KERN_ERR "es1370: irq %u in use\n", s-irq);
goto err_irq;
--- linux/drivers/sound/es1371.c.marcus Fri Feb  9 20:30:23 2001
+++ linux/drivers/sound/es1371.cTue Mar 13 14:23:55 2001
@@ -2728,11 +2728,13 @@
 {
struct es1371_state *s;
mm_segment_t fs;
-   int i, val;
+   int i, val, err;
unsigned long tmo;
signed long tmo2;
unsigned int cssr;
 
+   if ((err=pci_enable_device(pcidev)))
+   return err;
if (!RSRCISIOREGION(pcidev, 0))
return -1;
if (pcidev-irq == 0) 
@@ -2771,8 +2773,6 @@
printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s-io, 
s-io+ES1371_EXTENT-1);
goto err_region;
}
-   if (pci_enable_device(pcidev))
-   goto err_irq;
if (request_irq(s-irq, es1371_interrupt, SA_SHIRQ, "es1371", s)) {
printk(KERN_ERR PFX "irq %u in use\n", s-irq);
goto err_irq;
--- linux/drivers/sound/esssolo1.c.marcus   Fri Feb  9 20:30:23 2001
+++ linux/drivers/sound/esssolo1.c  Tue 

PATCH: CS4281: missing pci_enable_dervice

2001-03-12 Thread Marcus Meissner

Hi,

My Laptop has a CS4281 soundchip. It requires the following patch to start
working (enable pci device).

Ciao, Marcus

--- linux/drivers/sound/cs4281/cs4281m.c.marcus Mon Mar 12 09:55:35 2001
+++ linux/drivers/sound/cs4281/cs4281m.cMon Mar 12 09:55:57 2001
@@ -4289,6 +4289,9 @@
CS_DBGOUT(CS_FUNCTION | CS_INIT, 2,
  printk(KERN_INFO "cs4281: probe()+\n"));
 
+   if (pci_enable_device(pcidev))
+   return -1;
+
if (!RSRCISMEMORYREGION(pcidev, 0) ||
!RSRCISMEMORYREGION(pcidev, 1)) {
CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: CS4281: missing pci_enable_dervice

2001-03-12 Thread Marcus Meissner

Hi,

My Laptop has a CS4281 soundchip. It requires the following patch to start
working (enable pci device).

Ciao, Marcus

--- linux/drivers/sound/cs4281/cs4281m.c.marcus Mon Mar 12 09:55:35 2001
+++ linux/drivers/sound/cs4281/cs4281m.cMon Mar 12 09:55:57 2001
@@ -4289,6 +4289,9 @@
CS_DBGOUT(CS_FUNCTION | CS_INIT, 2,
  printk(KERN_INFO "cs4281: probe()+\n"));
 
+   if (pci_enable_device(pcidev))
+   return -1;
+
if (!RSRCISMEMORYREGION(pcidev, 0) ||
!RSRCISMEMORYREGION(pcidev, 1)) {
CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Netgear FA311

2000-12-23 Thread Marcus Meissner

In article <[EMAIL PROTECTED]> you wrote:
> Is this where you got the sources?  
> http://www.scyld.com/network/natsemi.html (Thanks Steve)

The linux driver is actually on the accompanying floppy disk. Without license
statement unfortunately.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: Netgear FA311

2000-12-23 Thread Marcus Meissner

In article [EMAIL PROTECTED] you wrote:
 Is this where you got the sources?  
 http://www.scyld.com/network/natsemi.html (Thanks Steve)

The linux driver is actually on the accompanying floppy disk. Without license
statement unfortunately.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: hotplug mopup

2000-12-10 Thread Marcus Meissner

In article <[EMAIL PROTECTED]> you wrote:

> A compendium of questions and misc stuff concerning hotplug:

> - Is everyone happy with call_usermodehelper() being asynchronous? It
>   _could_ be given a `synchronous' option, but that's a fair bit of
>   obfuscation and it does expose us to deadlocks if the caller has any
>   semaphores held.

I am happy.

> - On the unregister/removal path, the netdevice layer ensures that
>   the interface is removed from the kernel namespace prior to launching
>   `/sbin/hotplug net unregister eth0'.

>   This means that when handling netdevice unregistration
>   /sbin/hotplug cannot and must not attempt to do anything with eth0!
>   Generally it'll fail to find an interface with this name.  If it does
>   find eth0, it'll be the wrong one due to a race.

I always thought I should have to do "/sbin/ifdown eth0" here.
(Just as I do /sbin/ifup eth0 on register.)

> - I don't think we can say that the kernel hotplug interface is
>   complete until we have real, working, tested userspace tools.  David,
>   could you please summarise the state of play here? In particular,
>   what still needs to be done?

Well, for USB I would like to know which device major/minor entry a newly 
plugged device is associated with.

Like if I insert a new USB camera, I want to easy find out it is char 81.1
(/dev/video1). Or if I plugin a USB storage device I want to easy find out
it is /dev/sda now.

This is currently very hard to do and it would be really nice to have
a solution for this.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: hotplug mopup

2000-12-10 Thread Marcus Meissner

In article [EMAIL PROTECTED] you wrote:

 A compendium of questions and misc stuff concerning hotplug:

 - Is everyone happy with call_usermodehelper() being asynchronous? It
   _could_ be given a `synchronous' option, but that's a fair bit of
   obfuscation and it does expose us to deadlocks if the caller has any
   semaphores held.

I am happy.

 - On the unregister/removal path, the netdevice layer ensures that
   the interface is removed from the kernel namespace prior to launching
   `/sbin/hotplug net unregister eth0'.

   This means that when handling netdevice unregistration
   /sbin/hotplug cannot and must not attempt to do anything with eth0!
   Generally it'll fail to find an interface with this name.  If it does
   find eth0, it'll be the wrong one due to a race.

I always thought I should have to do "/sbin/ifdown eth0" here.
(Just as I do /sbin/ifup eth0 on register.)

 - I don't think we can say that the kernel hotplug interface is
   complete until we have real, working, tested userspace tools.  David,
   could you please summarise the state of play here? In particular,
   what still needs to be done?

Well, for USB I would like to know which device major/minor entry a newly 
plugged device is associated with.

Like if I insert a new USB camera, I want to easy find out it is char 81.1
(/dev/video1). Or if I plugin a USB storage device I want to easy find out
it is /dev/sda now.

This is currently very hard to do and it would be really nice to have
a solution for this.

Ciao, Marcus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



  1   2   >