[RFC PATCH v4 4/9] fixup:t7404:use 'git -C' instead of cd .. && git

2018-04-18 Thread Eddy Petrișor
From: Eddy Petrișor <eddy.petri...@gmail.com>

Signed-off-by: Eddy Petrișor <eddy.petri...@gmail.com>
---
 t/t7406-submodule-update.sh | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 7fb370991..974f949df 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -288,10 +288,7 @@ test_expect_success 'submodule update --remote --recursive 
--init should fetch m
git commit -m "add l1 module with branch b1 in super5" &&
git submodule init submodl1b1 &&
git clone super5 super &&
-   (
-   cd super &&
-   git submodule update --recursive --init
-   ) &&
+   git -C super submodule update --recursive --init &&
(
cd submodl1b1 &&
git rev-parse --verify HEAD >../../actuall1 &&
-- 
2.16.2



[PATCH v3 1/5] tests: change "cd ... && git fetch" to "cd &&\n\tgit fetch"

2017-04-26 Thread Ævar Arnfjörð Bjarmason
Change occurrences "cd" followed by "fetch" on a single line to be on
two lines.

This is purely a stylistic change pointed out in code review for an
unrelated patch. Change the these tests use so new tests added later
using the more common style don't look out of place.

Signed-off-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com>
---
 t/t5612-clone-refspec.sh | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh
index 7ace2535c8..97c847fab6 100755
--- a/t/t5612-clone-refspec.sh
+++ b/t/t5612-clone-refspec.sh
@@ -59,7 +59,8 @@ test_expect_success 'setup' '
 
 test_expect_success 'by default all branches will be kept updated' '
    (
-   cd dir_all && git fetch &&
+   cd dir_all &&
+   git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
@@ -71,7 +72,8 @@ test_expect_success 'by default all branches will be kept 
updated' '
 
 test_expect_success 'by default no tags will be kept updated' '
(
-   cd dir_all && git fetch &&
+   cd dir_all &&
+   git fetch &&
git for-each-ref refs/tags >../actual
) &&
git for-each-ref refs/tags >expect &&
@@ -80,7 +82,8 @@ test_expect_success 'by default no tags will be kept updated' 
'
 
 test_expect_success '--single-branch while HEAD pointing at master' '
(
-   cd dir_master && git fetch &&
+   cd dir_master &&
+   git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
@@ -92,7 +95,8 @@ test_expect_success '--single-branch while HEAD pointing at 
master' '
 
 test_expect_success '--single-branch while HEAD pointing at side' '
(
-   cd dir_side && git fetch &&
+   cd dir_side &&
+   git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
    -e "s|/remotes/origin/|/heads/|" >../actual
@@ -104,7 +108,8 @@ test_expect_success '--single-branch while HEAD pointing at 
side' '
 
 test_expect_success '--single-branch with explicit --branch side' '
(
-   cd dir_side2 && git fetch &&
+   cd dir_side2 &&
+   git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
@@ -116,7 +121,8 @@ test_expect_success '--single-branch with explicit --branch 
side' '
 
 test_expect_success '--single-branch with explicit --branch with tag fetches 
updated tag' '
(
-   cd dir_tag && git fetch &&
+   cd dir_tag &&
+       git fetch &&
    git for-each-ref refs/tags >../actual
) &&
git for-each-ref refs/tags >expect &&
@@ -125,7 +131,8 @@ test_expect_success '--single-branch with explicit --branch 
with tag fetches upd
 
 test_expect_success '--single-branch with --mirror' '
(
-   cd dir_mirror && git fetch &&
+   cd dir_mirror &&
+   git fetch &&
git for-each-ref refs > ../actual
) &&
git for-each-ref refs >expect &&
@@ -134,7 +141,8 @@ test_expect_success '--single-branch with --mirror' '
 
 test_expect_success '--single-branch with explicit --branch and --mirror' '
    (
-   cd dir_mirror_side && git fetch &&
+   cd dir_mirror_side &&
+   git fetch &&
git for-each-ref refs > ../actual
) &&
git for-each-ref refs >expect &&
@@ -143,7 +151,8 @@ test_expect_success '--single-branch with explicit --branch 
and --mirror' '
 
 test_expect_success '--single-branch with detached' '
(
-   cd dir_detached && git fetch &&
+   cd dir_detached &&
+   git fetch &&
git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual
-- 
2.11.0



[PATCHv2 1/3] git-p4 tests: cd to / before running python

2016-04-26 Thread Luke Diamand
The python one-liner for getting the current time prints out
error messages if the current directory is deleted while it is
running if using python3.

Avoid these messages by switching to "/" before running it.

This problem does not arise if using python2.

Signed-off-by: Luke Diamand <l...@diamand.org>
---
 t/lib-git-p4.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index f9ae1d7..724bc43 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -50,7 +50,7 @@ native_path() {
 # at runtime (e.g. via NTP). The 'clock_gettime(CLOCK_MONOTONIC)'
 # function could fix that but it is not in Python until 3.3.
 time_in_seconds() {
-   python -c 'import time; print int(time.time())'
+   (cd / && python -c 'import time; print(int(time.time()))')
 }
 
 # Try to pick a unique port: guess a large number, then hope
-- 
2.8.1.218.gd2cea43.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] git-p4 tests: cd to testdir before running python

2016-04-23 Thread Luke Diamand
The python one-liner for getting the current time prints out
error messages if the current directory is deleted while it is
running if using python3.

Avoid these messages by switching back to the test directory
before running python3, instead of remaining in the trash
directory.

Signed-off-by: Luke Diamand <l...@diamand.org>
---
 t/lib-git-p4.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index f9ae1d7..77802fe 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -50,7 +50,7 @@ native_path() {
 # at runtime (e.g. via NTP). The 'clock_gettime(CLOCK_MONOTONIC)'
 # function could fix that but it is not in Python until 3.3.
 time_in_seconds() {
-   python -c 'import time; print int(time.time())'
+       (cd "$TEST_DIRECTORY" && python -c 'import time; 
print(int(time.time()))')
 }
 
 # Try to pick a unique port: guess a large number, then hope
-- 
2.8.1.218.gd2cea43.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] typo DWIMery with alias broken (cd to random dir)

2016-01-26 Thread Duy Nguyen
On Tue, Jan 26, 2016 at 2:37 PM, Michael J Gruber
<g...@drmicha.warpmail.net> wrote:
> Hi there,
>
> with current next (989ee58 plus local additions) it seems that typo
> DWIMery with aliases is broken, see below.
>
> It appears that the typo DWIMery is broken only when there is a unique
> automatic DWIM substitution for a mistyped alias.
>
> I haven't bisected yet, but I suspect this to be related to recent
> changes regarding the environment in which commands/aliases are started
> (though this happens without extra work trees), so I'm cc'ing an expert
> in that area. Funny, though, that my user name shows up...
>
> I think the reason is that git.c's handle_alias() (or something else)
> calls restore_env() multiple times, and restore_env frees orig_cwd such
> that subsequent restore_env(0) with external_alias=0 tries to cd to a
> random location.
>
> I have no idea whether orig_cwd=0 after freeing or something else would
> be the proper fix.

I think the key is to reset saved_env_before_alias to zero in
restore_env(). With that flag remains set, the second save_env turns
no-op. orig_cwd should be reset too, but that's minor. It's working
for me. I'll send a patch later.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] typo DWIMery with alias broken (cd to random dir)

2016-01-25 Thread Michael J Gruber
Hi there,

with current next (989ee58 plus local additions) it seems that typo
DWIMery with aliases is broken, see below.

It appears that the typo DWIMery is broken only when there is a unique
automatic DWIM substitution for a mistyped alias.

I haven't bisected yet, but I suspect this to be related to recent
changes regarding the environment in which commands/aliases are started
(though this happens without extra work trees), so I'm cc'ing an expert
in that area. Funny, though, that my user name shows up...

I think the reason is that git.c's handle_alias() (or something else)
calls restore_env() multiple times, and restore_env frees orig_cwd such
that subsequent restore_env(0) with external_alias=0 tries to cd to a
random location.

I have no idea whether orig_cwd=0 after freeing or something else would
be the proper fix.

Michael

LANG=C git sss
WARNING: You called a Git command named 'sss', which does not exist.
Continuing under the assumption that you meant 'ss'
in 2.0 seconds automatically...
fatal: could not move to g...@drmicha.warpmail.net: No such file or directory
[mjg@skimbleshanks git]✗ LANG=C git ss
## HEAD (no branch)
?? a
?? a.patch
?? c2d.sh
[mjg@skimbleshanks git]✓ LANG=C git statu -sb
git: 'statu' is not a git command. See 'git --help'.

Did you mean one of these?
status
stage
stash
[mjg@skimbleshanks git]✗ LANG=C git statuss -sb
WARNING: You called a Git command named 'statuss', which does not exist.
Continuing under the assumption that you meant 'status'
in 2.0 seconds automatically...
## HEAD (no branch)
?? a
?? a.patch
?? c2d.sh
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


git-archive doesn't support --date= option for %ad %cd format:string's

2014-10-09 Thread Derek Moore
PRETTY FORMATS' format:string documentation says, %ad: author date
(format respects --date= option), and similarly for %cd.

But git-archive does not support the --date= option for changing the
date format in $Format:%ad$ or $Format:%cd$ substitution strings.


Relatedly, I want a short RFC date, not a short ISO date, but there is
only --date=short, which is ISO.

Would introducing --date=shortrfc and --date=shortiso be feasable,
with --date=short aliasing to --date=shortiso. With a shortrfc, I
could recreate SVN $Date$'s, which would be equivalent to $Format:%ai
(%ad)$ when used with git archive --date=shortrfc.

Thanks,

Derek
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: git-archive doesn't support --date= option for %ad %cd format:string's

2014-10-09 Thread Jeff King
On Thu, Oct 09, 2014 at 11:19:36AM -0500, Derek Moore wrote:

 PRETTY FORMATS' format:string documentation says, %ad: author date
 (format respects --date= option), and similarly for %cd.
 
 But git-archive does not support the --date= option for changing the
 date format in $Format:%ad$ or $Format:%cd$ substitution strings.

Correct. You can use %ai, %aD, etc to pick a format. But...

 Relatedly, I want a short RFC date, not a short ISO date, but there is
 only --date=short, which is ISO.

If you start adding new formats, we are likely going to run out of
reasonably-memorable letters.

We've discussed something like %ad(rfc822) in the past, and I even had
a patch:

  http://article.gmane.org/gmane.comp.version-control.git/168512

but it got bogged down in a discussion on potentially expanding the
placeholder syntax to something more regular (probably
%(authordate:rfc822), like for-each-ref does. That's from 2011, and I
doubt anybody is working on it now.

 Would introducing --date=shortrfc and --date=shortiso be feasable,
 with --date=short aliasing to --date=shortiso. With a shortrfc, I
 could recreate SVN $Date$'s, which would be equivalent to $Format:%ai
 (%ad)$ when used with git archive --date=shortrfc.

I don't see a big problem with that. But I wonder if we would do better
to introduce arbitrary strftime-like formatting, so we do not have to
keep adding new formats.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: git-archive doesn't support --date= option for %ad %cd format:string's

2014-10-09 Thread Jeff King
On Thu, Oct 09, 2014 at 03:24:28PM -0400, Jeff King wrote:

 On Thu, Oct 09, 2014 at 11:19:36AM -0500, Derek Moore wrote:
 
  PRETTY FORMATS' format:string documentation says, %ad: author date
  (format respects --date= option), and similarly for %cd.
  
  But git-archive does not support the --date= option for changing the
  date format in $Format:%ad$ or $Format:%cd$ substitution strings.
 
 Correct. You can use %ai, %aD, etc to pick a format. But...
 
  Relatedly, I want a short RFC date, not a short ISO date, but there is
  only --date=short, which is ISO.
 
 If you start adding new formats, we are likely going to run out of
 reasonably-memorable letters.
 [...]

I meant to add in here: ...so an external --date option does not seem
like that bad an idea. I think calling it --date is probably a
mistake, but something like --subst-date-format or something might
make more sense.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: git-archive doesn't support --date= option for %ad %cd format:string's

2014-10-09 Thread Derek Moore
 I don't see a big problem with that. But I wonder if we would do better
 to introduce arbitrary strftime-like formatting, so we do not have to
 keep adding new formats.

My thoughts exactly...

This list seems to be a prove-yourself-with-patches sorta place. If I
can find the time, I'll try attacking this also in some manner.

Thanks again,

Derek
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] pretty: note that %cd respects the --date= option

2014-08-21 Thread Junio C Hamano
Thomas Braun thomas.br...@virtuell-zuhause.de writes:

 Signed-off-by: Thomas Braun thomas.br...@virtuell-zuhause.de
 ---

 Today I found out that both %cd and %ad pretty print format
 specifications honour the --date option as shown in:

 $ git log --abbrev=8 --date=short --pretty=%h (%s, %cd) -n1
 5bdb1c4e (Merge pull request #245 from
 kblees/kb/master/fix-libsvn-address-conflict, 2014-08-16)
 $ git log --abbrev=8 --date=short --pretty=%h (%s, %ad) -n1
 5bdb1c4e (Merge pull request #245 from
 kblees/kb/master/fix-libsvn-address-conflict, 2014-08-16)

 But the documentation did not mention that.

  Documentation/pretty-formats.txt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/Documentation/pretty-formats.txt
 b/Documentation/pretty-formats.txt
 index 85d6353..eac7909 100644
 --- a/Documentation/pretty-formats.txt
 +++ b/Documentation/pretty-formats.txt
 @@ -122,7 +122,7 @@ The placeholders are:
  - '%ce': committer email
  - '%cE': committer email (respecting .mailmap, see
linkgit:git-shortlog[1] or linkgit:git-blame[1])
 -- '%cd': committer date
 +- '%cd': committer date (format respects --date= option)

Funny that we already have the same text for %ad.  Thanks.

  - '%cD': committer date, RFC2822 style
  - '%cr': committer date, relative
  - '%ct': committer date, UNIX timestamp
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] pretty: note that %cd respects the --date= option

2014-08-20 Thread Thomas Braun
Signed-off-by: Thomas Braun thomas.br...@virtuell-zuhause.de
---

Today I found out that both %cd and %ad pretty print format
specifications honour the --date option as shown in:

$ git log --abbrev=8 --date=short --pretty=%h (%s, %cd) -n1
5bdb1c4e (Merge pull request #245 from
kblees/kb/master/fix-libsvn-address-conflict, 2014-08-16)
$ git log --abbrev=8 --date=short --pretty=%h (%s, %ad) -n1
5bdb1c4e (Merge pull request #245 from
kblees/kb/master/fix-libsvn-address-conflict, 2014-08-16)

But the documentation did not mention that.

 Documentation/pretty-formats.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/pretty-formats.txt
b/Documentation/pretty-formats.txt
index 85d6353..eac7909 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt
@@ -122,7 +122,7 @@ The placeholders are:
 - '%ce': committer email
 - '%cE': committer email (respecting .mailmap, see
   linkgit:git-shortlog[1] or linkgit:git-blame[1])
-- '%cd': committer date
+- '%cd': committer date (format respects --date= option)
 - '%cD': committer date, RFC2822 style
 - '%cr': committer date, relative
 - '%ct': committer date, UNIX timestamp
-- 
2.1.0.msysgit.0

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: `ab | (cd cd git apply -)' fails with v2.0.0

2014-07-25 Thread Michael J Gruber
Junio C Hamano venit, vidit, dixit 24.07.2014 19:19:
 Michael J Gruber g...@drmicha.warpmail.net writes:
 
 Steffen Nurpmeso venit, vidit, dixit 24.07.2014 15:29:
 Hello (again, psst, after a long time),

 it happened yesterday that i needed to do

   $ git diff HEAD:FILE COMMIT:SAME-FILE |
(cd src  git apply -) 
 ...

 Ah little more context would help. Are you diffing files in the subdir
 src, or a file at the root which happens to be present in the subdir src
 as well?
 
 As the treeish:path form is not meant to produce git apply
 applicable patch in the first place, I am not sure what the OP is
 trying to achieve in the first place.  Not just how many leading
 levels to strip? but which file is being modified? does not
 appear in a usable form.  For example, here is what you would see:
 
 $ git diff HEAD:GIT-VERSION-GEN maint:GIT-VERSION-GEN
 diff --git a/HEAD:GIT-VERSION-GEN b/maint:GIT-VERSION-GEN
 index 40adbf7..0d1a86c 100755
 --- a/HEAD:GIT-VERSION-GEN
 +++ b/maint:GIT-VERSION-GEN
 @@ -1,7 +1,7 @@
 ...
 
 and neither HEAD:GIT-VERSION-GEN nor maint:GIT-VERSION-GEN is
 the file being modified (GIT-VERSION-GEN is).

I thought git apply knows how to strip the rev part.

 I would understand if the upstream of the pipe were
 
 $ git diff HEAD maint -- GIT-VERSION-GEN | ...
 
 though.
 
 Needless to say, if the place cd goes is not a worktree controlled
 by git, then git apply would not know where the top-level of the
 target tree is, so even though the input with the corrected command
 on the upstream side of the pipe tells it which file is being
 modified, it needs to be told with the proper -pn parameter how
 many leading levels to strip.

I think it's a common mistake to think of git apply as some sort of
magic extension of patch which can do anything that patch does and
more, and can be fed anything that git diff produces, figuring out by
itself what to do with it :)

Michael
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: `ab | (cd cd git apply -)' fails with v2.0.0

2014-07-25 Thread Steffen Nurpmeso
Hello and good morning,

Michael J Gruber g...@drmicha.warpmail.net wrote:
 |Junio C Hamano venit, vidit, dixit 24.07.2014 19:19:
 | Michael J Gruber g...@drmicha.warpmail.net writes:
 | Steffen Nurpmeso venit, vidit, dixit 24.07.2014 15:29:
 | Hello (again, psst, after a long time),
 |
 | it happened yesterday that i needed to do
 |
 |   $ git diff HEAD:FILE COMMIT:SAME-FILE |
 | (cd src  git apply -) 
 | ...
 |
 | Ah little more context would help. Are you diffing files in the subdir
 | src, or a file at the root which happens to be present in the subdir src
 | as well?
 | 
 | As the treeish:path form is not meant to produce git apply
 | applicable patch in the first place, I am not sure what the OP is
 | trying to achieve in the first place.  Not just how many leading
 | levels to strip? but which file is being modified? does not
 | appear in a usable form.  For example, here is what you would see:
 | 
 | $ git diff HEAD:GIT-VERSION-GEN maint:GIT-VERSION-GEN
 | diff --git a/HEAD:GIT-VERSION-GEN b/maint:GIT-VERSION-GEN
 | index 40adbf7..0d1a86c 100755
 | --- a/HEAD:GIT-VERSION-GEN
 | +++ b/maint:GIT-VERSION-GEN
 | @@ -1,7 +1,7 @@
 | ...
 | 
 | and neither HEAD:GIT-VERSION-GEN nor maint:GIT-VERSION-GEN is
 | the file being modified (GIT-VERSION-GEN is).
 |
 |I thought git apply knows how to strip the rev part.

That would brighten the sky of the glorious future.  Perfect!

 | I would understand if the upstream of the pipe were
 | 
 | $ git diff HEAD maint -- GIT-VERSION-GEN | ...
 | 
 | though.

Yes, in this case it applies the patch.

 | Needless to say, if the place cd goes is not a worktree controlled
 | by git, then git apply would not know where the top-level of the
 | target tree is, so even though the input with the corrected command
 | on the upstream side of the pipe tells it which file is being
 | modified, it needs to be told with the proper -pn parameter how
 | many leading levels to strip.
 |
 |I think it's a common mistake to think of git apply as some sort of
 |magic extension of patch which can do anything that patch does and
 |more, and can be fed anything that git diff produces, figuring out by
 |itself what to do with it :)

This was indeed my mistake.
But regardless i think the current behaviour sucks:

  ?0[steffen@sherwood x.git]$ git diff HEAD:XY 5d0d74:XY |
   (cd src  patch -p4)
  can't find file to patch at input line 5
  Perhaps you used the wrong -p or --strip option?
  The text leading up to this was:
  ?130[steffen@sherwood x.git]$ git diff HEAD:XY 5d0d74:XY |
   (cd src  git apply -p4)
  ?0[steffen@sherwood x.git]$

and

  ?0[steffen@sherwood groff.git]$ git diff HEAD:XY 5d0d74:XY |
   (cd src  git apply -p2)
  ?0[steffen@sherwood groff.git]$ git diff HEAD:XY 5d0d74:XY |
   (cd src  patch -p2)
  patching file XY
  ?0[steffen@sherwood groff.git]$ 

The number after `?' is the exit status of the last command, btw.
Ciao (and yes, thanks a lot for git(1)!)

--steffen
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: `ab | (cd cd git apply -)' fails with v2.0.0

2014-07-24 Thread Michael J Gruber
Steffen Nurpmeso venit, vidit, dixit 24.07.2014 15:29:
 Hello (again, psst, after a long time),
 
 it happened yesterday that i needed to do
 
   $ git diff HEAD:FILE COMMIT:SAME-FILE |
(cd src  git apply -) 
 
 but found that didn't work with v2.0.0 (silently succeeds?, doing
 nothing).  It works without the subshell and the cd(1); i had to
 use `(cd src  patch -p2)' instead to keep in going.
 Just in case that is not known yet (i've updated my git(1) repo,
 but in the 1466 commits in between nothing sprung into my eye
 regarding apply, and a Gmane search didn't, too).
 No need to Cc: me, please just fix it; thank you.
 Ciao,
 
 --steffen
 

Ah little more context would help. Are you diffing files in the subdir
src, or a file at the root which happens to be present in the subdir src
as well?

Michael
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


`ab | (cd cd git apply -)' fails with v2.0.0

2014-07-24 Thread Steffen Nurpmeso
Hello (again, psst, after a long time),

it happened yesterday that i needed to do

  $ git diff HEAD:FILE COMMIT:SAME-FILE |
   (cd src  git apply -) 

but found that didn't work with v2.0.0 (silently succeeds?, doing
nothing).  It works without the subshell and the cd(1); i had to
use `(cd src  patch -p2)' instead to keep in going.
Just in case that is not known yet (i've updated my git(1) repo,
but in the 1466 commits in between nothing sprung into my eye
regarding apply, and a Gmane search didn't, too).
No need to Cc: me, please just fix it; thank you.
Ciao,

--steffen
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: `ab | (cd cd git apply -)' fails with v2.0.0

2014-07-24 Thread Junio C Hamano
Michael J Gruber g...@drmicha.warpmail.net writes:

 Steffen Nurpmeso venit, vidit, dixit 24.07.2014 15:29:
 Hello (again, psst, after a long time),
 
 it happened yesterday that i needed to do
 
   $ git diff HEAD:FILE COMMIT:SAME-FILE |
(cd src  git apply -) 
 ...

 Ah little more context would help. Are you diffing files in the subdir
 src, or a file at the root which happens to be present in the subdir src
 as well?

As the treeish:path form is not meant to produce git apply
applicable patch in the first place, I am not sure what the OP is
trying to achieve in the first place.  Not just how many leading
levels to strip? but which file is being modified? does not
appear in a usable form.  For example, here is what you would see:

$ git diff HEAD:GIT-VERSION-GEN maint:GIT-VERSION-GEN
diff --git a/HEAD:GIT-VERSION-GEN b/maint:GIT-VERSION-GEN
index 40adbf7..0d1a86c 100755
--- a/HEAD:GIT-VERSION-GEN
+++ b/maint:GIT-VERSION-GEN
@@ -1,7 +1,7 @@
...

and neither HEAD:GIT-VERSION-GEN nor maint:GIT-VERSION-GEN is
the file being modified (GIT-VERSION-GEN is).

I would understand if the upstream of the pipe were

$ git diff HEAD maint -- GIT-VERSION-GEN | ...

though.

Needless to say, if the place cd goes is not a worktree controlled
by git, then git apply would not know where the top-level of the
target tree is, so even though the input with the corrected command
on the upstream side of the pipe tells it which file is being
modified, it needs to be told with the proper -pn parameter how
many leading levels to strip.



--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/12] t0001: drop subshells just for cd

2014-03-20 Thread Jeff King
Many tests do something like:

  (
mkdir foo 
cd foo 
git init
  )

You can do the same these days with git init foo, which
makes the tests shorter and simpler to read.

Signed-off-by: Jeff King p...@peff.net
---
Unlike the last patch, this one _could_ have an affect. I made the
assumption that git init foo would behave sanely, but that other
complex things should be left alone. E.g., ones that set GIT_DIR in the
environment to a relative path might be affected based on when git does
the chdir.

 t/t0001-init.sh | 56 +---
 1 file changed, 9 insertions(+), 47 deletions(-)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 55a68bc..68549d1 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -24,11 +24,7 @@ check_config () {
 }
 
 test_expect_success 'plain' '
-   (
-   mkdir plain 
-   cd plain 
-   git init
-   ) 
+   git init plain 
check_config plain/.git false unset
 '
 
@@ -90,11 +86,7 @@ test_expect_success 'plain with GIT_WORK_TREE' '
 '
 
 test_expect_success 'plain bare' '
-   (
-   mkdir plain-bare-1 
-   cd plain-bare-1 
-   git --bare init
-   ) 
+   git --bare init plain-bare-1 
check_config plain-bare-1 true unset
 '
 
@@ -112,12 +104,7 @@ test_expect_success 'GIT_DIR bare' '
 '
 
 test_expect_success 'init --bare' '
-
-   (
-   mkdir init-bare.git 
-   cd init-bare.git 
-   git init --bare
-   ) 
+   git init --bare init-bare.git 
check_config init-bare.git true unset
 '
 
@@ -166,26 +153,14 @@ test_expect_success 'reinit' '
 test_expect_success 'init with --template' '
mkdir template-source 
echo content template-source/file 
-   (
-   mkdir template-custom 
-   cd template-custom 
-   git init --template=../template-source
-   ) 
+   git init --template=../template-source template-custom 
test_cmp template-source/file template-custom/.git/file
 '
 
 test_expect_success 'init with --template (blank)' '
-   (
-   mkdir template-plain 
-   cd template-plain 
-   git init
-   ) 
+   git init template-plain 
test_path_is_file template-plain/.git/info/exclude 
-   (
-   mkdir template-blank 
-   cd template-blank 
-   git init --template=
-   ) 
+   git init --template= template-blank 
test_path_is_missing template-blank/.git/info/exclude
 '
 
@@ -207,11 +182,7 @@ test_expect_success 'init with init.templatedir set' '
 test_expect_success 'init --bare/--shared overrides system/global config' '
test_config_global core.bare false 
test_config_global core.sharedRepository 0640 
-   (
-   mkdir init-bare-shared-override 
-   cd init-bare-shared-override 
-   git init --bare --shared=0666
-   ) 
+   git init --bare --shared=0666 init-bare-shared-override 
check_config init-bare-shared-override true unset 
test x0666 = \
x`git config -f init-bare-shared-override/config core.sharedRepository`
@@ -219,22 +190,13 @@ test_expect_success 'init --bare/--shared overrides 
system/global config' '
 
 test_expect_success 'init honors global core.sharedRepository' '
test_config_global core.sharedRepository 0666 
-   (
-   mkdir shared-honor-global 
-   cd shared-honor-global 
-   git init
-   ) 
+   git init shared-honor-global 
test x0666 = \
x`git config -f shared-honor-global/.git/config core.sharedRepository`
 '
 
 test_expect_success 'init rejects insanely long --template' '
-   (
-   insane=$(printf x%0dx 1) 
-   mkdir test 
-   cd test 
-   test_must_fail git init --template=$insane
-   )
+   test_must_fail git init --template=$(printf x%0dx 1) test
 '
 
 test_expect_success 'init creates a new directory' '
-- 
1.9.0.560.g01ceb46
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cdgit: cd relative to git workdir root

2013-09-16 Thread Adam Spiers
On Mon, Sep 16, 2013 at 09:01:14PM +0200, Thomas Koch wrote:
 Hi,
 
 I frequently have the need to cd back to the root of the current git workdir 
 and created to alias for this:
 
 git alias root = rev-parse --show-toplevel
 
 shell alias cdgit = cd $(git root)
 
 Maybe somebody likes this.

I do, and I was about to copy it into my own config when I discovered
that I'd already done this 4 years ago and totally forgotten about it :)

 Now it would be cool, to have an alias to cd into a specific subdir of the 
 git 
 worktree and have zsh (or bash) auto completion for this like
 
 git clone git://git.kernel.org/pub/scm/git/git.git
 cd git/gitweb/static/js/lib (just to be somewhere deep)
 cdgit contab/comtab (becomes: cdgit contrib/completion)
 
 Somebody with zsh/bash skills who already did this?

I hadn't done this before today, but it's easy in zsh:

  https://github.com/aspiers/git-config/commit/89df1d78

Of course, _gitcd needs to be somewhere on your $fpath so it can be
autoloaded.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cdgit: cd relative to git workdir root

2013-09-16 Thread Thomas Koch
Hi,

I frequently have the need to cd back to the root of the current git workdir 
and created to alias for this:

git alias root = rev-parse --show-toplevel

shell alias cdgit = cd $(git root)

Maybe somebody likes this.

Now it would be cool, to have an alias to cd into a specific subdir of the git 
worktree and have zsh (or bash) auto completion for this like

git clone git://git.kernel.org/pub/scm/git/git.git
cd git/gitweb/static/js/lib (just to be somewhere deep)
cdgit contab/comtab (becomes: cdgit contrib/completion)

Somebody with zsh/bash skills who already did this?

Regards, Thomas Koch
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cdgit: cd relative to git workdir root

2013-09-16 Thread martin f krafft
also sprach Thomas Koch tho...@koch.ro [2013.09.16.2101 +0200]:
 shell alias cdgit = cd $(git root)

I've tried to make this happen many years ago, but I never finished
the ZLE widget that did it. The idea was to bind 'tab' to a function
that would replace an occurrence of ~g in $LBUFFER with the output
of rev-parse--show-toplevel and then delegate to normal tab
expansion.

So now I just have

  hash -d g=$(git rev-parse --show-toplevel)

in a pre-prompt function and get the same effect.

  fishbowl:~/code/salt|develop|debian% ls ~g/debitab

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
i am not in favour of long engagements. they give people the
 opportunity of finding out each other's character before marriage,
 which i think is never advisable.
-- oscar wilde
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


cd

2013-04-03 Thread jpinheiro
Hi all,

We are students from Universidade do Minho in Portugal, and we are using git
in project as a case study.
While experimenting with git we found an unexpected behavior with git rm.
Here is a trace of the unexpected behavior:

$ git init
$ mkdir D
$ echo Hi  D/F
$ git add D/F
$ rm -r D
$ echo Hey  D
$ git rm D/F
warning: 'D/F': Not a directory
rm 'D/F'
fatal: git rm: 'D/F': Not a directory


If the file D created with last echo did not exist or was named differently
then no error would occur as expected. For example:

$ git init
$ mkdir D
$ echo Hi  D/F
$ git add D/F
$ rm -r D
$ echo Hey  F
$ git rm D/F

This works as expected, and the only difference is the name of the file of
the last echo.
Is this the expected behavior of git rm?




--
View this message in context: http://git.661346.n2.nabble.com/cd-tp7581484.html
Sent from the git mailing list archive at Nabble.com.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cd

2013-04-03 Thread Andreas Ericsson

On 04/03/2013 04:49 PM, jpinheiro wrote:

Hi all,

We are students from Universidade do Minho in Portugal, and we are using git
in project as a case study.
While experimenting with git we found an unexpected behavior with git rm.
Here is a trace of the unexpected behavior:

$ git init
$ mkdir D
$ echo Hi  D/F
$ git add D/F
$ rm -r D
$ echo Hey  D
$ git rm D/F
warning: 'D/F': Not a directory
rm 'D/F'
fatal: git rm: 'D/F': Not a directory


If the file D created with last echo did not exist or was named differently
then no error would occur as expected. For example:

$ git init
$ mkdir D
$ echo Hi  D/F
$ git add D/F
$ rm -r D
$ echo Hey  F
$ git rm D/F

This works as expected, and the only difference is the name of the file of
the last echo.
Is this the expected behavior of git rm?



Yes. The only difference between 'git rm' and 'rm' is that git rm also
removes the file from its index and prepares to commit a version without
it. From git's point of view, it's not an error if the file doesn't
exist. It *is* an error if the directory where the file should reside
suddenly no longer a directory though.

--
Andreas Ericsson   andreas.erics...@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


a) Book (Hard-Copy). b) CD-ROM c) Journal d) E-Library e) Inclusion in all the Indexes of http://wseas.org/wseas/cms.action?id=6

2013-04-01 Thread Viky Hanioti
CALL FOR PAPERS
** Find the conference links via http://www.wseas.org
 
Rhodes Island, Greece, July 16-19, 2013
Scientific Sponsors: Technical University of Sofia, Bulgaria, Polytechnic 
University of Bari, Italy
and University Politehnica of Bucharest, Romania

17th CSCC Multiconference:
17th International Conference on Circuits
17th International Conference on Systems
17th International Conference on Communications
17th International Conference on Computers

** Find the conference links via http://www.wseas.org

Rhodes Island, Greece, July 16-19, 2013
Scientific Sponsors: Technical University of Sofia, Bulgaria, Polytechnic 
University of Bari, Italy
and University Politehnica of Bucharest, Romania

8th International Conference on Energy  Environment (EE '13)
8th International Conference on Continuum Mechanics (CM '13)
8th International Conference on Water Resources, Hydraulics  Hydrology (WHH 
'13)
1st International Conference on Hydrology and Ecology (HYEC '13)
7th International Conference on Geology and Seismology (GES '13)

** Find the conference links via http://www.naun.org
The following conferences are organized in Rhodes by NAUN:

Scientific Sponsors: Technical University of Sofia, Bulgaria, Polytechnic 
University of Bari, Italy
and University Politehnica of Bucharest, Romania

6th International Conference on Urban Rehabilitation and Sustainability (URES 
'13)
1st International Conference on Environmental Management in Construction (EMC 
'13)
1st International Conference on Monitoring and Management of Air Pollution 
(MMAP '13)
1st International Conference on Affective Computing and Applications (ACA '13)
1st International Conference on Artificial Intelligence and Cognitive Science 
(AICS '13)
1st International Conference on Innovative Computing and Information Processing 
(INCIP '13)


For the accepted papers we provide
---
 a) Book (Hard-Copy). 

 b) CD-ROM Proceedings with all collocated conferences 

 c) Journal (NEW: in ISI soon, see SJR Impact factor
http://www.scimagojr.com/journalsearch.php?q=WSEAStip=jou
Soon in ISI also)

 d) E-Library 
 
 e) Inclusion in all the Indexes of http://wseas.org/wseas/cms.action?id=6




* * * * * * * * * * * * * * * * * * * * *   
Extended Versions of Selected papers will be published in Journals of NOVA 
Publishers or as
Chapters in Books of Springer Verlag, World Scientific, Imperial College Press, 
IOS Press, IGI
Global and others:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
These Books (hard copies) of  Springer Verlag, World Scientific, Imperial 
College Press, IOS Press,
IGI Global, etc will be sent to all authors after the conference. These 
publishers will take care
of Indexing of these Books in all major indexes (including ISI).

* * * * * * * * * * * * * * * * * * * * * 
The Proceedings of the Conference (all the accepted and registered papers; not 
only the selected
ones to be sent to the previous publishers) with all the accepted and 
registered papers of the
conferences will be sent for indexing to: ISI (Thomson Reuters), ELSEVIER, 
SCOPUS, ACM -
Association for Computing Machinery, Zentralblatt MATH, British Library, EBSCO, 
SWETS, EMBASE, CAS
- American Chemical Society, EI Compendex, Engineering Village, DoPP, GEOBASE, 
Biobase, TIB|UB -
German National Library of Science and Technology, American Mathematical 
Society (AMS), Inspec -
The IET, Ulrich's International Periodicals Directory.





 
If you want to un~subscribe, send an email to rena.n.pol...@gmail.com with the 
following
command as Subject:  
un~subscribe email1, email2, email3, 
where email1, email2, email3 are all the possible emails that you have
For  example
un~subscribe johnsm...@gmail.com, jsm...@server.mbu.uk etc..
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


MAINTAINERS: update ide-cd maintainer's email address

2008-02-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ef709165d8de1ba9dd3cd5e05dbabf71dc32d883
Commit: ef709165d8de1ba9dd3cd5e05dbabf71dc32d883
Parent: b152fcd34108d07a1e682786af583fd3e080cab3
Author: Borislav Petkov [EMAIL PROTECTED]
AuthorDate: Tue Feb 19 01:41:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Tue Feb 19 01:41:25 2008 +0100

MAINTAINERS: update ide-cd maintainer's email address

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 MAINTAINERS |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1d2edb4..082d1ee 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1924,7 +1924,7 @@ S:Maintained
 
 IDE/ATAPI CDROM DRIVER
 P: Borislav Petkov
-M: [EMAIL PROTECTED]
+M: [EMAIL PROTECTED]
 L: [EMAIL PROTECTED]
 S: Maintained
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix missing residual count setting in DMA mode

2008-02-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=14e04c3f6e64bac468f0aa38c6d47aa95b60c074
Commit: 14e04c3f6e64bac468f0aa38c6d47aa95b60c074
Parent: 0e7d8d480259319649f7a2c230622b98758d1c83
Author: Kiyoshi Ueda [EMAIL PROTECTED]
AuthorDate: Tue Feb 19 01:41:26 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Tue Feb 19 01:41:26 2008 +0100

ide-cd: fix missing residual count setting in DMA mode

This patch fixes the missing residual count setting in DMA mode,
which was introduced during the conversion to blk-end-request.
The residual count could be used by the request submitter.
So if it isn't set correctly, some upper layers does not work.
(e.g. wodim for CD burning.)

The bug is in only DMA mode.
In PIO mode, we are setting the residual count correctly,
so no need to fix.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
Reported-by: Andreas Schwab [EMAIL PROTECTED]
Tested-by: Andreas Schwab [EMAIL PROTECTED]
Tested-by: Laura Garcia [EMAIL PROTECTED]
Tested-by: Borislav Petkov [EMAIL PROTECTED]
Cc: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 354c91d..310e497 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1207,9 +1207,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 end_request:
if (blk_pc_request(rq)) {
unsigned long flags;
+   unsigned int dlen = rq-data_len;
+
+   if (dma)
+   rq-data_len = 0;
 
spin_lock_irqsave(ide_lock, flags);
-   if (__blk_end_request(rq, 0, rq-data_len))
+   if (__blk_end_request(rq, 0, dlen))
BUG();
HWGROUP(drive)-rq = NULL;
spin_unlock_irqrestore(ide_lock, flags);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: replace ntohs with generic byteorder macro be16_to_cpu

2008-02-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7eb43fd2fa4a55faee97d4c84b336d2138075926
Commit: 7eb43fd2fa4a55faee97d4c84b336d2138075926
Parent: eba8ff946177ca38dfde0bf1d8ce0703c45c49b9
Author: Borislav Petkov [EMAIL PROTECTED]
AuthorDate: Mon Feb 11 00:32:13 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Feb 11 00:32:13 2008 +0100

ide-cd: replace ntohs with generic byteorder macro be16_to_cpu

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 5e42c19..354c91d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1555,7 +1555,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
if (stat)
return stat;
 
-   toc-hdr.toc_length = ntohs (toc-hdr.toc_length);
+   toc-hdr.toc_length = be16_to_cpu(toc-hdr.toc_length);
 
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
toc-hdr.first_track = BCD2BIN(toc-hdr.first_track);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix leftover data BUG

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4f4f6c2502474f51654a699d7127d86c2f87075a
Commit: 4f4f6c2502474f51654a699d7127d86c2f87075a
Parent: 4eb166d9874b4917d79ccd14577a60d795a0cb4a
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Thu Jan 31 13:57:51 2008 +0100
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Fri Feb 1 09:26:33 2008 +0100

ide-cd: fix leftover data BUG

It's perfectly legal to have data leftovers when a drive signals
completion, it happens all the time when a user issues a command
with a transfer count that is too large.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 74c6087..bee05a3 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1722,7 +1722,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 */
if ((stat  DRQ_STAT) == 0) {
spin_lock_irqsave(ide_lock, flags);
-   if (__blk_end_request(rq, 0, 0))
+   if (__blk_end_request(rq, 0, rq-data_len))
BUG();
HWGROUP(drive)-rq = NULL;
spin_unlock_irqrestore(ide_lock, flags);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: use xfer_func_t in cdrom_pc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=68661c53a2a847b9a0d6d232a85b2e063573307a
Commit: 68661c53a2a847b9a0d6d232a85b2e063573307a
Parent: 468e468139ffbc4f0ce44862eec6dd0f5ac80945
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:17 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:17 2008 +0100

ide-cd: use xfer_func_t in cdrom_pc_intr()

Unify writing and reading handling in cdrom_pc_intr() using xfer_func_t.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   47 +--
 1 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index bee05a3..f2b951d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1005,6 +1005,8 @@ static ide_startstop_t cdrom_transfer_packet_command 
(ide_drive_t *drive,
  * Block read functions.
  */
 
+typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
+
 /*
  * Buffer up to SECTORS_TO_TRANSFER sectors from the drive in our sector
  * buffer.  Once the first sector is added, any subsequent sectors are
@@ -1430,10 +1432,10 @@ static ide_startstop_t cdrom_start_read (ide_drive_t 
*drive, unsigned int block)
 /* Interrupt routine for packet command completion. */
 static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
 {
-   int ireason, len, thislen;
struct request *rq = HWGROUP(drive)-rq;
+   xfer_func_t *xferfunc = NULL;
+   int stat, ireason, len, thislen, write;
u8 lowcyl = 0, highcyl = 0;
-   int stat;
 
/* Check for errors. */
if (cdrom_decode_status(drive, 0, stat))
@@ -1478,44 +1480,31 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t 
*drive)
 
/* Figure out how much data to transfer. */
thislen = rq-data_len;
-   if (thislen  len) thislen = len;
+   if (thislen  len)
+   thislen = len;
 
-   /* The drive wants to be written to. */
if (ireason == 0) {
-   if (!rq-data) {
-   blk_dump_rq_flags(rq, cdrom_pc_intr, write);
-   goto confused;
-   }
-   /* Transfer the data. */
-   HWIF(drive)-atapi_output_bytes(drive, rq-data, thislen);
-
-   /* If we haven't moved enough data to satisfy the drive,
-  add some padding. */
-   while (len  thislen) {
-   int dum = 0;
-   HWIF(drive)-atapi_output_bytes(drive, dum, 
sizeof(dum));
-   len -= sizeof(dum);
-   }
-
-   /* Keep count of how much data we've moved. */
-   rq-data += thislen;
-   rq-data_len -= thislen;
+   write = 1;
+   xferfunc = HWIF(drive)-atapi_output_bytes;
+   } else if (ireason == 2) {
+   write = 0;
+   xferfunc = HWIF(drive)-atapi_input_bytes;
}
 
-   /* Same drill for reading. */
-   else if (ireason == 2) {
+   if (xferfunc) {
if (!rq-data) {
-   blk_dump_rq_flags(rq, cdrom_pc_intr, read);
+   blk_dump_rq_flags(rq, write ? cdrom_pc_intr, write
+   : cdrom_pc_intr, read);
goto confused;
}
/* Transfer the data. */
-   HWIF(drive)-atapi_input_bytes(drive, rq-data, thislen);
+   xferfunc(drive, rq-data, thislen);
 
/* If we haven't moved enough data to satisfy the drive,
   add some padding. */
while (len  thislen) {
int dum = 0;
-   HWIF(drive)-atapi_input_bytes(drive, dum, 
sizeof(dum));
+   xferfunc(drive, dum, sizeof(dum));
len -= sizeof(dum);
}
 
@@ -1523,7 +1512,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
rq-data += thislen;
rq-data_len -= thislen;
 
-   if (blk_sense_request(rq))
+   if (write  blk_sense_request(rq))
rq-sense_len += thislen;
} else {
 confused:
@@ -1658,8 +1647,6 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
return 1;
 }
 
-typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
-
 /*
  * best way to deal with dma that is not sector aligned right now... note
  * that in this path we are not using -data or -buffer at all. this irs
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: add ide_cd_pad_transfer() helper

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5a5222d9fa4aa7ae3b1d5c126cb9c83124d75af5
Commit: 5a5222d9fa4aa7ae3b1d5c126cb9c83124d75af5
Parent: 68661c53a2a847b9a0d6d232a85b2e063573307a
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:17 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:17 2008 +0100

ide-cd: add ide_cd_pad_transfer() helper

Add ide_cd_pad_transfer() helper and use it in cdrom_[new]pc_intr()
and cdrom_{read,write}_check_ireason().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   51 -
 1 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f2b951d..75539fd 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1007,6 +1007,15 @@ static ide_startstop_t cdrom_transfer_packet_command 
(ide_drive_t *drive,
 
 typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
 
+static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len)
+{
+   while (len  0) {
+   int dum = 0;
+   xf(drive, dum, sizeof(dum));
+   len -= sizeof(dum);
+   }
+}
+
 /*
  * Buffer up to SECTORS_TO_TRANSFER sectors from the drive in our sector
  * buffer.  Once the first sector is added, any subsequent sectors are
@@ -1063,17 +1072,15 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int 
len, int ireason)
if (ireason == 2)
return 0;
else if (ireason == 0) {
+   ide_hwif_t *hwif = drive-hwif;
+
/* Whoops... The drive is expecting to receive data from us! */
printk(KERN_ERR %s: %s: wrong transfer direction!\n,
drive-name, __FUNCTION__);
 
/* Throw some data at the drive so it doesn't hang
   and quit this request. */
-   while (len  0) {
-   int dum = 0;
-   HWIF(drive)-atapi_output_bytes(drive, dum, sizeof 
(dum));
-   len -= sizeof (dum);
-   }
+   ide_cd_pad_transfer(drive, hwif-atapi_output_bytes, len);
} else  if (ireason == 1) {
/* Some drives (ASUS) seem to tell us that status
 * info is available. just get it and ignore.
@@ -1500,15 +1507,8 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
/* Transfer the data. */
xferfunc(drive, rq-data, thislen);
 
-   /* If we haven't moved enough data to satisfy the drive,
-  add some padding. */
-   while (len  thislen) {
-   int dum = 0;
-   xferfunc(drive, dum, sizeof(dum));
-   len -= sizeof(dum);
-   }
-
/* Keep count of how much data we've moved. */
+   len -= thislen;
rq-data += thislen;
rq-data_len -= thislen;
 
@@ -1525,6 +1525,13 @@ confused:
return ide_stopped;
}
 
+   /*
+* If we haven't moved enough data to satisfy the drive,
+* add some padding.
+*/
+   if (len  0)
+   ide_cd_pad_transfer(drive, xferfunc, len);
+
/* Now we wait for another interrupt. */
ide_set_handler(drive, cdrom_pc_intr, ATAPI_WAIT_PC, 
cdrom_timer_expiry);
return ide_started;
@@ -1617,15 +1624,13 @@ static int cdrom_write_check_ireason(ide_drive_t 
*drive, int len, int ireason)
if (ireason == 0)
return 0;
else if (ireason == 2) {
+   ide_hwif_t *hwif = drive-hwif;
+
/* Whoops... The drive wants to send data. */
printk(KERN_ERR %s: %s: wrong transfer direction!\n,
drive-name, __FUNCTION__);
 
-   while (len  0) {
-   int dum = 0;
-   HWIF(drive)-atapi_input_bytes(drive, dum, 
sizeof(dum));
-   len -= sizeof(dum);
-   }
+   ide_cd_pad_transfer(drive, hwif-atapi_input_bytes, len);
} else {
/* Drive wants a command packet, or invalid ireason... */
printk(KERN_ERR %s: %s: bad interrupt reason 0x%02x\n,
@@ -1783,14 +1788,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
/*
 * pad, if necessary
 */
-   if (len  0) {
-   while (len  0) {
-   int pad = 0;
-
-   xferfunc(drive, pad, sizeof(pad));
-   len -= sizeof(pad);
-   }
-   }
+   if (len  0)
+   ide_cd_pad_transfer(drive, xferfunc, len

ide-cd: fix DMA error handling in cdrom_newpc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eba15fba1f046d25c663d294fc919ab59cec3e9c
Commit: eba15fba1f046d25c663d294fc919ab59cec3e9c
Parent: f1071e628bc769174c3e2df7827a2a8ad05aea67
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:17 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:17 2008 +0100

ide-cd: fix DMA error handling in cdrom_newpc_intr()

Make cdrom_newpc_intr() match cdrom_{read,write}_intr() w.r.t.
handling DMA errors:

* disable DMA before cdrom_decode_status() call

* log the device name and the type of the request (read/write)

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index cbe4f1a..c638d05 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1674,6 +1674,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
if (dma) {
info-dma = 0;
dma_error = HWIF(drive)-ide_dma_end(drive);
+   if (dma_error) {
+   printk(KERN_ERR %s: DMA %s error\n, drive-name,
+   rq_data_dir(rq) ? write : read);
+   ide_dma_off(drive);
+   }
}
 
if (cdrom_decode_status(drive, 0, stat))
@@ -1683,11 +1688,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 * using dma, transfer is complete now
 */
if (dma) {
-   if (dma_error) {
-   printk(KERN_ERR ide-cd: dma error\n);
-   ide_dma_off(drive);
+   if (dma_error)
return ide_error(drive, dma error, stat);
-   }
 
spin_lock_irqsave(ide_lock, flags);
if (__blk_end_request(rq, 0, rq-data_len))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix trailing whitespaces in changelog

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cc6dbef25273f032d2b580bd0519ea950cb7cb83
Commit: cc6dbef25273f032d2b580bd0519ea950cb7cb83
Parent: eba15fba1f046d25c663d294fc919ab59cec3e9c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:18 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:18 2008 +0100

ide-cd: fix trailing whitespaces in changelog

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   23 +++
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index c638d05..591768c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -129,16 +129,15 @@
  * 3.14  May 29, 1996 -- Add work-around for Vertos 600.
  *(From Hennus Bergman [EMAIL PROTECTED].)
  * 3.15  July 2, 1996 -- Added support for Sanyo 3 CD changers
- *from Ben Galliart [EMAIL PROTECTED] with 
- *special help from Jeff Lightfoot 
+ *from Ben Galliart [EMAIL PROTECTED] with
+ *special help from Jeff Lightfoot
  *[EMAIL PROTECTED]
  * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification
  * 3.16  Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl.
  * 3.17  Sep 17, 1996 -- Tweak audio reads for some drives.
  *   Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC.
  * 3.18  Oct 31, 1996 -- Added module and DMA support.
- *   
- *   
+ *
  * 4.00  Nov 5, 1996   -- New ide-cd maintainer,
  * Erik B. Andersen [EMAIL PROTECTED]
  * -- Newer Creative drives don't always set the error
@@ -153,8 +152,8 @@
  * -- Add some probes of drive capability during setup.
  *
  * 4.01  Nov 11, 1996  -- Split into ide-cd.c and ide-cd.h
- * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE 
- *  ioctls in favor of a generalized approach 
+ * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE
+ *  ioctls in favor of a generalized approach
  *  using the generic cdrom driver.
  * -- Fully integrated with the 2.1.X kernel.
  * -- Other stuff that I forgot (lots of changes)
@@ -163,7 +162,7 @@
  *  to fix the drive door locking problems.
  *
  * 4.03  Dec 04, 1996  -- Added DSC overlap support.
- * 4.04  Dec 29, 1996  -- Added CDROMREADRAW ioclt based on patch 
+ * 4.04  Dec 29, 1996  -- Added CDROMREADRAW ioclt based on patch
  *  by Ales Makarov ([EMAIL PROTECTED])
  *
  * 4.05  Nov 20, 1997  -- Modified to print more drive info on init
@@ -186,7 +185,7 @@
  * -- Cleaned up the global namespace a bit by making more
  * functions static that should already have been.
  * 4.11  Mar 12, 1998  -- Added support for the CDROM_SELECT_SPEED ioctl
- * based on a patch for 2.0.33 by Jelle Foks 
+ * based on a patch for 2.0.33 by Jelle Foks
  * [EMAIL PROTECTED], a patch for 2.0.33
  * by Toni Giorgino [EMAIL PROTECTED], the SCSI
  * version, and my own efforts.  -erik
@@ -194,8 +193,8 @@
  * inform me of where Illegal mode for this track
  * was never returned due to a comparison on data
  * types of limited range.
- * 4.12  Mar 29, 1998  -- Fixed bug in CDROM_SELECT_SPEED so write speed is 
- * now set ionly for CD-R and CD-RW drives.  I had 
+ * 4.12  Mar 29, 1998  -- Fixed bug in CDROM_SELECT_SPEED so write speed is
+ * now set ionly for CD-R and CD-RW drives.  I had
  * removed this support because it produced errors.
  * It produced errors _only_ for non-writers. duh.
  * 4.13  May 05, 1998  -- Suppress useless in progress of becoming ready
@@ -206,7 +205,7 @@
  * since the .pdf version doesn't seem to work...
  * -- Updated the TODO list to something more current.
  *
- * 4.15  Aug 25, 1998  -- Updated ide-cd.h to respect mechine endianess, 
+ * 4.15  Aug 25, 1998  -- Updated ide-cd.h to respect mechine endianess,
  * patch thanks to Eddie C. Dost [EMAIL PROTECTED]
  *
  * 4.50  Oct 19, 1998  -- New maintainers!
@@ -270,7 +269,7 @@
  * - Mode sense and mode select moved to the
  *   Uniform layer

ide-cd: move historical changelog to Documentation/ide/ChangeLog.ide-cd.1994-2004

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=03553353e91121dbe57f4a6d40b731374ff7438a
Commit: 03553353e91121dbe57f4a6d40b731374ff7438a
Parent: cc6dbef25273f032d2b580bd0519ea950cb7cb83
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:18 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:18 2008 +0100

ide-cd: move historical changelog to 
Documentation/ide/ChangeLog.ide-cd.1994-2004

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 Documentation/ide/ChangeLog.ide-cd.1994-2004 |  268 +
 drivers/ide/ide-cd.c |  274 +-
 2 files changed, 272 insertions(+), 270 deletions(-)

diff --git a/Documentation/ide/ChangeLog.ide-cd.1994-2004 
b/Documentation/ide/ChangeLog.ide-cd.1994-2004
new file mode 100644
index 000..190d17b
--- /dev/null
+++ b/Documentation/ide/ChangeLog.ide-cd.1994-2004
@@ -0,0 +1,268 @@
+/*
+ * 1.00  Oct 31, 1994 -- Initial version.
+ * 1.01  Nov  2, 1994 -- Fixed problem with starting request in
+ *   cdrom_check_status.
+ * 1.03  Nov 25, 1994 -- leaving unmask_intr[] as a user-setting (as for disks)
+ * (from mlord)   -- minor changes to cdrom_setup()
+ *-- renamed ide_dev_s to ide_drive_t, enable irq on 
command
+ * 2.00  Nov 27, 1994 -- Generalize packet command interface;
+ *   add audio ioctls.
+ * 2.01  Dec  3, 1994 -- Rework packet command interface to handle devices
+ *   which send an interrupt when ready for a command.
+ * 2.02  Dec 11, 1994 -- Cache the TOC in the driver.
+ *   Don't use SCMD_PLAYAUDIO_TI; it's not included
+ *   in the current version of ATAPI.
+ *   Try to use LBA instead of track or MSF addressing
+ *   when possible.
+ *   Don't wait for READY_STAT.
+ * 2.03  Jan 10, 1995 -- Rewrite block read routines to handle block sizes
+ *   other than 2k and to move multiple sectors in a
+ *   single transaction.
+ * 2.04  Apr 21, 1995 -- Add work-around for Creative Labs CD220E drives.
+ *   Thanks to Nick Saw [EMAIL PROTECTED] for
+ *   help in figuring this out.  Ditto for Acer and
+ *   Aztech drives, which seem to have the same problem.
+ * 2.04b May 30, 1995 -- Fix to match changes in ide.c version 3.16 -ml
+ * 2.05  Jun  8, 1995 -- Don't attempt to retry after an illegal request
+ *or data protect error.
+ *   Use HWIF and DEV_HWIF macros as in ide.c.
+ *   Always try to do a request_sense after
+ *a failed command.
+ *   Include an option to give textual descriptions
+ *of ATAPI errors.
+ *   Fix a bug in handling the sector cache which
+ *showed up if the drive returned data in 512 byte
+ *blocks (like Pioneer drives).  Thanks to
+ *Richard Hirst [EMAIL PROTECTED] for diagnosing 
this.
+ *   Properly supply the page number field in the
+ *MODE_SELECT command.
+ *   PLAYAUDIO12 is broken on the Aztech; work around it.
+ * 2.05x Aug 11, 1995 -- lots of data structure renaming/restructuring in ide.c
+ *   (my apologies to Scott, but now ide-cd.c is 
independent)
+ * 3.00  Aug 22, 1995 -- Implement CDROMMULTISESSION ioctl.
+ *   Implement CDROMREADAUDIO ioctl (UNTESTED).
+ *   Use input_ide_data() and output_ide_data().
+ *   Add door locking.
+ *   Fix usage count leak in cdrom_open, which happened
+ *when a read-write mount was attempted.
+ *   Try to load the disk on open.
+ *   Implement CDROMEJECT_SW ioctl (off by default).
+ *   Read total cdrom capacity during open.
+ *   Rearrange logic in cdrom_decode_status.  Issue
+ *request sense commands for failed packet commands
+ *from here instead of from cdrom_queue_packet_command.
+ *Fix a race condition in retrieving error information.
+ *   Suppress printing normal unit attention errors and
+ *some drive not ready errors.
+ *   Implement CDROMVOLREAD ioctl.
+ *   Implement CDROMREADMODE1/2 ioctls.
+ *   Fix race condition in setting up interrupt handlers
+ *when the `serialize' option is used.
+ * 3.01  Sep  2, 1995 -- Fix

ide-cd: remove stale cdrom_transfer_packet_command() comment

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4415e871d6d497f0a90332c4b3a488ebccbf217d
Commit: 4415e871d6d497f0a90332c4b3a488ebccbf217d
Parent: 03553353e91121dbe57f4a6d40b731374ff7438a
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:18 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:18 2008 +0100

ide-cd: remove stale cdrom_transfer_packet_command() comment

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 945d730..8dea991 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -684,10 +684,6 @@ static ide_startstop_t 
cdrom_start_packet_command(ide_drive_t *drive,
by cdrom_start_packet_command.
HANDLER is the interrupt handler to call when the command completes
or there's data ready. */
-/*
- * changed 5 parameters to 3 for dvd-ram
- * struct packet_command *pc; now packet_command_t *pc;
- */
 #define ATAPI_MIN_CDB_BYTES 12
 static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
  struct request *rq,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove unused defines from ide-cd.h

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9f8256dbb690eeb93a8b2422ff02382e3a19ed20
Commit: 9f8256dbb690eeb93a8b2422ff02382e3a19ed20
Parent: 4415e871d6d497f0a90332c4b3a488ebccbf217d
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:18 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:18 2008 +0100

ide-cd: remove unused defines from ide-cd.h

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.h |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 1b302fe..1e138c9 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -49,16 +49,6 @@
 #endif
 #define SECTORS_PER_FRAME  (CD_FRAMESIZE  SECTOR_BITS)
 #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
-#define SECTORS_BUFFER (SECTOR_BUFFER_SIZE  SECTOR_BITS)
-#define SECTORS_MAX(131072  SECTOR_BITS)
-
-#define BLOCKS_PER_FRAME   (CD_FRAMESIZE / BLOCK_SIZE)
-
-/* special command codes for strategy routine. */
-#define PACKET_COMMAND4315
-#define REQUEST_SENSE_COMMAND 4316
-#define RESET_DRIVE_COMMAND   4317
-
 
 /* Configuration flags.  These describe the capabilities of the drive.
They generally do not change after initialization, unless we learn
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove dead code from cdrom_pc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6229ac1ff32692694b7b0e74585b1ef6fa8973fd
Commit: 6229ac1ff32692694b7b0e74585b1ef6fa8973fd
Parent: 9f8256dbb690eeb93a8b2422ff02382e3a19ed20
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:18 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:18 2008 +0100

ide-cd: remove dead code from cdrom_pc_intr()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 8dea991..bec6ac0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1201,13 +1201,6 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
if (rq-data_len == 0)
cdrom_end_request(drive, 1);
else {
-   /* Comment this out, because this always happens 
-  right after a reset occurs, and it is annoying to 
-  always print expected stuff.  */
-   /*
-   printk (%s: cdrom_pc_intr: data underrun %d\n,
-   drive-name, pc-buflen);
-   */
rq-cmd_flags |= REQ_FAILED;
cdrom_end_request(drive, 0);
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove unused struct atapi_cdrom_subchnl

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f17b0e02c0035b90c4e943f6e2cca840f82dce0f
Commit: f17b0e02c0035b90c4e943f6e2cca840f82dce0f
Parent: 6229ac1ff32692694b7b0e74585b1ef6fa8973fd
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:19 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:19 2008 +0100

ide-cd: remove unused struct atapi_cdrom_subchnl

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.h |   32 
 1 files changed, 0 insertions(+), 32 deletions(-)

diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 1e138c9..e6f2197 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -145,38 +145,6 @@ struct atapi_toc {
  /* One extra for the leadout. */
 };
 
-
-/* This structure is annoyingly close to, but not identical with,
-   the cdrom_subchnl structure from cdrom.h. */
-struct atapi_cdrom_subchnl {
-   u_char  acdsc_reserved;
-   u_char  acdsc_audiostatus;
-   u_short acdsc_length;
-   u_char  acdsc_format;
-
-#if defined(__BIG_ENDIAN_BITFIELD)
-   u_char  acdsc_ctrl: 4;
-   u_char  acdsc_adr:  4;
-#elif defined(__LITTLE_ENDIAN_BITFIELD)
-   u_char  acdsc_adr:  4;
-   u_char  acdsc_ctrl: 4;
-#else
-#error Please fix asm/byteorder.h
-#endif
-   u_char  acdsc_trk;
-   u_char  acdsc_ind;
-   union {
-   struct atapi_msf msf;
-   int lba;
-   } acdsc_absaddr;
-   union {
-   struct atapi_msf msf;
-   int lba;
-   } acdsc_reladdr;
-};
-
-
-
 /* This should probably go into cdrom.h along with the other
  * generic stuff now in the Mt. Fuji spec.
  */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove needless zeroing of 'info' fields from ide_cdrom_setup()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b8d25dee3b73b572ea1778671098ee7b943133c5
Commit: b8d25dee3b73b572ea1778671098ee7b943133c5
Parent: f17b0e02c0035b90c4e943f6e2cca840f82dce0f
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:19 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:19 2008 +0100

ide-cd: remove needless zeroing of 'info' fields from ide_cdrom_setup()

ide_cd_probe() zeroes 'info' prior to calling ide_cdrom_setup() so there
is no need to explicitly zero 'info' fields in the latter function.

Ditto for fields of CDROM_STATE_FLAGS(), CDROM_CONFIG_FLAGS() and 'cdi'
(all are embedded in 'info').

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   44 +++-
 1 files changed, 7 insertions(+), 37 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index bec6ac0..cd3ea32 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2865,30 +2865,16 @@ int ide_cdrom_setup (ide_drive_t *drive)
drive-special.all  = 0;
 
CDROM_STATE_FLAGS(drive)-media_changed = 1;
-   CDROM_STATE_FLAGS(drive)-toc_valid = 0;
-   CDROM_STATE_FLAGS(drive)-door_locked   = 0;
 
 #if NO_DOOR_LOCKING
CDROM_CONFIG_FLAGS(drive)-no_doorlock = 1;
-#else
-   CDROM_CONFIG_FLAGS(drive)-no_doorlock = 0;
 #endif
-
-   CDROM_CONFIG_FLAGS(drive)-drq_interrupt = ((drive-id-config  
0x0060) == 0x20);
-   CDROM_CONFIG_FLAGS(drive)-is_changer = 0;
-   CDROM_CONFIG_FLAGS(drive)-cd_r = 0;
-   CDROM_CONFIG_FLAGS(drive)-cd_rw = 0;
-   CDROM_CONFIG_FLAGS(drive)-test_write = 0;
-   CDROM_CONFIG_FLAGS(drive)-dvd = 0;
-   CDROM_CONFIG_FLAGS(drive)-dvd_r = 0;
-   CDROM_CONFIG_FLAGS(drive)-dvd_ram = 0;
+   if ((drive-id-config  0x0060) == 0x20)
+   CDROM_CONFIG_FLAGS(drive)-drq_interrupt = 1;
CDROM_CONFIG_FLAGS(drive)-no_eject = 1;
-   CDROM_CONFIG_FLAGS(drive)-supp_disc_present = 0;
-   CDROM_CONFIG_FLAGS(drive)-audio_play = 0;
CDROM_CONFIG_FLAGS(drive)-close_tray = 1;
-   
+
/* limit transfer size per interrupt. */
-   CDROM_CONFIG_FLAGS(drive)-limit_nframes = 0;
/* a testament to the nice quality of Samsung drives... */
if (!strcmp(drive-id-model, SAMSUNG CD-ROM SCR-2430))
CDROM_CONFIG_FLAGS(drive)-limit_nframes = 1;
@@ -2899,16 +2885,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS(drive)-no_speed_select = 1;
 
 #if ! STANDARD_ATAPI
-   /* by default Sanyo 3 CD changer support is turned off and
-   ATAPI Rev 2.2+ standard support for CD changers is used */
-   cdi-sanyo_slot = 0;
-
-   CDROM_CONFIG_FLAGS(drive)-nec260 = 0;
-   CDROM_CONFIG_FLAGS(drive)-toctracks_as_bcd = 0;
-   CDROM_CONFIG_FLAGS(drive)-tocaddr_as_bcd = 0;
-   CDROM_CONFIG_FLAGS(drive)-playmsf_as_bcd = 0;
-   CDROM_CONFIG_FLAGS(drive)-subchan_as_bcd = 0;
-
if (strcmp (drive-id-model, V003S0DS) == 0 
drive-id-fw_rev[4] == '1' 
drive-id-fw_rev[6] = '2') {
@@ -2942,8 +2918,10 @@ int ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS(drive)-playmsf_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)-subchan_as_bcd = 1;
}
-/* Sanyo 3 CD changer uses a non-standard command
-   for CD changing */
+   /*
+* Sanyo 3 CD changer uses a non-standard command for CD changing
+* (by default standard ATAPI support for CD changers is used).
+*/
 else if ((strcmp(drive-id-model, CD-ROM CDR-C3 G) == 0) ||
  (strcmp(drive-id-model, CD-ROM CDR-C3G) == 0) ||
  (strcmp(drive-id-model, CD-ROM CDR_C36) == 0)) {
@@ -2952,14 +2930,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
 }
 #endif /* not STANDARD_ATAPI */
 
-   info-toc   = NULL;
-   info-buffer= NULL;
-   info-sector_buffered   = 0;
-   info-nsectors_buffered = 0;
-   info-changer_info  = NULL;
-   info-last_block= 0;
-   info-start_seek= 0;
-
nslots = ide_cdrom_probe_capabilities (drive);
 
/*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove unused and write-only struct ide_cd_config_flags fields

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2609d06d36317cc22f6d3c37186a8cf1a5f87ba6
Commit: 2609d06d36317cc22f6d3c37186a8cf1a5f87ba6
Parent: b8d25dee3b73b572ea1778671098ee7b943133c5
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:19 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:19 2008 +0100

ide-cd: remove unused and write-only struct ide_cd_config_flags fields

unused fields:
* -writing
* -reserved

write-only fields:
* -playmsf_as_bcd
* -subchan_as_bcd
* -test_write
* -supp_disc_present

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   18 ++
 drivers/ide/ide-cd.h |7 ---
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index cd3ea32..c736f76 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2693,8 +2693,6 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
CDROM_CONFIG_FLAGS(drive)-cd_rw = 1;
CDROM_CONFIG_FLAGS(drive)-ram = 1;
}
-   if (cap.test_write)
-   CDROM_CONFIG_FLAGS(drive)-test_write = 1;
if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)
CDROM_CONFIG_FLAGS(drive)-dvd = 1;
if (cap.dvd_ram_write) {
@@ -2727,10 +2725,9 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
 #endif /* not STANDARD_ATAPI */
if (cap.mechtype == mechtype_individual_changer ||
cap.mechtype == mechtype_cartridge_changer) {
-   if ((nslots = cdrom_number_of_slots(cdi))  1) {
+   nslots = cdrom_number_of_slots(cdi);
+   if (nslots  1)
CDROM_CONFIG_FLAGS(drive)-is_changer = 1;
-   CDROM_CONFIG_FLAGS(drive)-supp_disc_present = 1;
-   }
}
 
ide_cdrom_update_speed(drive, cap);
@@ -2892,10 +2889,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
   Some versions of this drive like to talk BCD. */
CDROM_CONFIG_FLAGS(drive)-toctracks_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)-tocaddr_as_bcd = 1;
-   CDROM_CONFIG_FLAGS(drive)-playmsf_as_bcd = 1;
-   CDROM_CONFIG_FLAGS(drive)-subchan_as_bcd = 1;
}
-
else if (strcmp (drive-id-model, V006E0DS) == 0 
drive-id-fw_rev[4] == '1' 
drive-id-fw_rev[6] = '2') {
@@ -2908,16 +2902,8 @@ int ide_cdrom_setup (ide_drive_t *drive)
   This drive was released before the 1.2 version
   of the spec. */
CDROM_CONFIG_FLAGS(drive)-tocaddr_as_bcd = 1;
-   CDROM_CONFIG_FLAGS(drive)-playmsf_as_bcd = 1;
-   CDROM_CONFIG_FLAGS(drive)-subchan_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)-nec260 = 1;
}
-   else if (strcmp(drive-id-model, WEARNES CDD-120) == 0 
-strncmp(drive-id-fw_rev, A1.1, 4) == 0) { /* FIXME */
-   /* Wearnes */
-   CDROM_CONFIG_FLAGS(drive)-playmsf_as_bcd = 1;
-   CDROM_CONFIG_FLAGS(drive)-subchan_as_bcd = 1;
-   }
/*
 * Sanyo 3 CD changer uses a non-standard command for CD changing
 * (by default standard ATAPI support for CD changers is used).
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index e6f2197..d224b06 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -59,10 +59,8 @@ struct ide_cd_config_flags {
__u8 no_doorlock: 1; /* Drive cannot lock the door. */
__u8 no_eject   : 1; /* Drive cannot eject the disc. */
__u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */
-   __u8 playmsf_as_bcd : 1; /* PLAYMSF command takes BCD args. */
__u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */
__u8 toctracks_as_bcd   : 1; /* TOC track numbers are in BCD. */
-   __u8 subchan_as_bcd : 1; /* Subchannel info is in BCD. */
__u8 is_changer : 1; /* Drive is a changer. */
__u8 cd_r   : 1; /* Drive can write to CD-R media . */
__u8 cd_rw  : 1; /* Drive can write to CD-R/W media . */
@@ -70,19 +68,14 @@ struct ide_cd_config_flags {
__u8 dvd_r  : 1; /* Drive can write DVD-R */
__u8 dvd_ram: 1; /* Drive can write DVD-RAM */
__u8 ram: 1; /* generic WRITE (dvd-ram/mrw) */
-   __u8 test_write : 1; /* Drive can fake writes */
-   __u8 supp_disc_present  : 1; /* Changer can report exact contents
-   of slots. */
__u8 limit_nframes  : 1; /* Drive does not provide data in
multiples of SECTOR_SIZE when

ide-cd: remove struct atapi_{mechstat_header,changer_info,slot}

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f18f960c5c1568fa2f720e2cb31d6c1af9ea1e1a
Commit: f18f960c5c1568fa2f720e2cb31d6c1af9ea1e1a
Parent: 2609d06d36317cc22f6d3c37186a8cf1a5f87ba6
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:19 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:19 2008 +0100

ide-cd: remove struct atapi_{mechstat_header,changer_info,slot}

* Remove -changer_info from struct cdrom_info (it is never allocated).

* Remove unused struct atapi_{mechstat_header,changer_info,slot}.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |1 -
 drivers/ide/ide-cd.h |   55 --
 2 files changed, 0 insertions(+), 56 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index c736f76..f02ddc5 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2969,7 +2969,6 @@ static void ide_cd_release(struct kref *kref)
 
kfree(info-buffer);
kfree(info-toc);
-   kfree(info-changer_info);
if (devinfo-handle == drive  unregister_cdrom(devinfo))
printk(KERN_ERR %s: %s failed to unregister device from the 
cdrom 
driver.\n, __FUNCTION__, drive-name);
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index d224b06..5bda4ec 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -357,59 +357,6 @@ struct atapi_capabilities_page {
char pad[4];
 };
 
-
-struct atapi_mechstat_header {
-#if defined(__BIG_ENDIAN_BITFIELD)
-   __u8 fault : 1;
-   __u8 changer_state : 2;
-   __u8 curslot   : 5;
-#elif defined(__LITTLE_ENDIAN_BITFIELD)
-   __u8 curslot   : 5;
-   __u8 changer_state : 2;
-   __u8 fault : 1;
-#else
-#error Please fix asm/byteorder.h
-#endif
-
-#if defined(__BIG_ENDIAN_BITFIELD)
-   __u8 mech_state: 3;
-   __u8 door_open : 1;
-   __u8 reserved1 : 4;
-#elif defined(__LITTLE_ENDIAN_BITFIELD)
-   __u8 reserved1 : 4;
-   __u8 door_open : 1;
-   __u8 mech_state: 3;
-#else
-#error Please fix asm/byteorder.h
-#endif
-
-   byte curlba[3];
-   byte nslots;
-   __u16slot_tablelen;
-};
-
-
-struct atapi_slot {
-#if defined(__BIG_ENDIAN_BITFIELD)
-   __u8 disc_present : 1;
-   __u8 reserved1: 6;
-   __u8 change   : 1;
-#elif defined(__LITTLE_ENDIAN_BITFIELD)
-   __u8 change   : 1;
-   __u8 reserved1: 6;
-   __u8 disc_present : 1;
-#else
-#error Please fix asm/byteorder.h
-#endif
-
-   byte reserved2[3];
-};
-
-struct atapi_changer_info {
-   struct atapi_mechstat_header hdr;
-   struct atapi_slot slots[0];
-};
-
 /* Extra per-device info for cdrom drives. */
 struct cdrom_info {
ide_drive_t *drive;
@@ -434,8 +381,6 @@ struct cdrom_info {
int dma;
unsigned long last_block;
unsigned long start_seek;
-   /* Buffer to hold mechanism status and changer slot table. */
-   struct atapi_changer_info *changer_info;
 
struct ide_cd_config_flags  config_flags;
struct ide_cd_state_flags   state_flags;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: cleanup ide_cdrom_update_speed()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=481c8c6476f86d7e92435764ba710315d644a45e
Commit: 481c8c6476f86d7e92435764ba710315d644a45e
Parent: f18f960c5c1568fa2f720e2cb31d6c1af9ea1e1a
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:20 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:20 2008 +0100

ide-cd: cleanup ide_cdrom_update_speed()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f02ddc5..0f6d2e0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2416,19 +2416,20 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, 
struct atapi_capabilities_pag
 static
 void ide_cdrom_update_speed (ide_drive_t *drive, struct 
atapi_capabilities_page *cap)
 {
+   u16 curspeed, maxspeed;
+
/* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */
if (!drive-id-model[0] 
!strncmp(drive-id-fw_rev, 241N, 4)) {
-   CDROM_STATE_FLAGS(drive)-current_speed  =
-   (le16_to_cpu(cap-curspeed) + (176/2)) / 176;
-   CDROM_CONFIG_FLAGS(drive)-max_speed =
-   (le16_to_cpu(cap-maxspeed) + (176/2)) / 176;
+   curspeed = le16_to_cpu(cap-curspeed);
+   maxspeed = le16_to_cpu(cap-maxspeed);
} else {
-   CDROM_STATE_FLAGS(drive)-current_speed  =
-   (be16_to_cpu(cap-curspeed) + (176/2)) / 176;
-   CDROM_CONFIG_FLAGS(drive)-max_speed =
-   (be16_to_cpu(cap-maxspeed) + (176/2)) / 176;
+   curspeed = be16_to_cpu(cap-curspeed);
+   maxspeed = be16_to_cpu(cap-maxspeed);
}
+
+   CDROM_STATE_FLAGS(drive)-current_speed = (curspeed + (176/2)) / 176;
+   CDROM_CONFIG_FLAGS(drive)-max_speed = (maxspeed + (176/2)) / 176;
 }
 
 static
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove redundant config flags

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f1b86d89dc73dedda426a85e600ad244ed9fad4
Commit: 3f1b86d89dc73dedda426a85e600ad244ed9fad4
Parent: 20e7f7efa3da3678c65cea45903260dfabb8264c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:20 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:20 2008 +0100

ide-cd: remove redundant config flags

* Use CDC_* flags directly and remove redundant flags from -config_flags.

While at it:
* Add KERN_CONT to printk()-s in ide_cdrom_probe_capabilities().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   98 +++--
 drivers/ide/ide-cd.h |   10 -
 2 files changed, 38 insertions(+), 70 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index d8c2ce1..81247a0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1889,6 +1889,8 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct 
request_sense *sense)
 static int cdrom_eject(ide_drive_t *drive, int ejectflag,
   struct request_sense *sense)
 {
+   struct cdrom_info *cd = drive-driver_data;
+   struct cdrom_device_info *cdi = cd-devinfo;
struct request req;
char loej = 0x02;
 
@@ -1902,7 +1904,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
cdrom_prepare_request(drive, req);
 
/* only tell drive to close tray if open, if it can do that */
-   if (ejectflag  !CDROM_CONFIG_FLAGS(drive)-close_tray)
+   if (ejectflag  (cdi-mask  CDC_CLOSE_TRAY))
loej = 0;
 
req.sense = sense;
@@ -2163,6 +2165,8 @@ static int cdrom_read_subchannel(ide_drive_t *drive, int 
format, char *buf,
 static int cdrom_select_speed(ide_drive_t *drive, int speed,
  struct request_sense *sense)
 {
+   struct cdrom_info *cd = drive-driver_data;
+   struct cdrom_device_info *cdi = cd-devinfo;
struct request req;
cdrom_prepare_request(drive, req);
 
@@ -2177,9 +2181,8 @@ static int cdrom_select_speed(ide_drive_t *drive, int 
speed,
req.cmd[2] = (speed  8)  0xff;   
/* Read Drive speed in kbytes/second LSB */
req.cmd[3] = speed  0xff;
-   if (CDROM_CONFIG_FLAGS(drive)-cd_r ||
-   CDROM_CONFIG_FLAGS(drive)-cd_rw ||
-   CDROM_CONFIG_FLAGS(drive)-dvd_r) {
+   if ((cdi-mask  (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) !=
+   (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) {
/* Write Drive speed in kbytes/second MSB */
req.cmd[4] = (speed  8)  0xff;
/* Write Drive speed in kbytes/second LSB */
@@ -2609,33 +2612,10 @@ static int ide_cdrom_register (ide_drive_t *drive, int 
nslots)
struct cdrom_device_info *devinfo = info-devinfo;
 
devinfo-ops = ide_cdrom_dops;
-   devinfo-mask = 0;
devinfo-speed = CDROM_STATE_FLAGS(drive)-current_speed;
devinfo-capacity = nslots;
devinfo-handle = drive;
strcpy(devinfo-name, drive-name);
-   
-   /* set capability mask to match the probe. */
-   if (!CDROM_CONFIG_FLAGS(drive)-cd_r)
-   devinfo-mask |= CDC_CD_R;
-   if (!CDROM_CONFIG_FLAGS(drive)-cd_rw)
-   devinfo-mask |= CDC_CD_RW;
-   if (!CDROM_CONFIG_FLAGS(drive)-dvd)
-   devinfo-mask |= CDC_DVD;
-   if (!CDROM_CONFIG_FLAGS(drive)-dvd_r)
-   devinfo-mask |= CDC_DVD_R;
-   if (!CDROM_CONFIG_FLAGS(drive)-dvd_ram)
-   devinfo-mask |= CDC_DVD_RAM;
-   if (!CDROM_CONFIG_FLAGS(drive)-is_changer)
-   devinfo-mask |= CDC_SELECT_DISC;
-   if (!CDROM_CONFIG_FLAGS(drive)-audio_play)
-   devinfo-mask |= CDC_PLAY_AUDIO;
-   if (!CDROM_CONFIG_FLAGS(drive)-close_tray)
-   devinfo-mask |= CDC_CLOSE_TRAY;
-   if (!CDROM_CONFIG_FLAGS(drive)-mo_drive)
-   devinfo-mask |= CDC_MO_DRIVE;
-   if (!CDROM_CONFIG_FLAGS(drive)-ram)
-   devinfo-mask |= CDC_RAM;
 
if (CDROM_CONFIG_FLAGS(drive)-no_speed_select)
devinfo-mask |= CDC_SELECT_SPEED;
@@ -2652,9 +2632,12 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
struct atapi_capabilities_page cap;
int nslots = 1;
 
+   cdi-mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R |
+CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO |
+CDC_MO_DRIVE | CDC_RAM);
+
if (drive-media == ide_optical) {
-   CDROM_CONFIG_FLAGS(drive)-mo_drive = 1;
-   CDROM_CONFIG_FLAGS(drive)-ram = 1;
+   cdi-mask = ~(CDC_MO_DRIVE | CDC_RAM);
printk(KERN_ERR %s: ATAPI magneto-optical drive\n, 
drive-name);
return nslots;
}
@@ -2662,7 +2645,7 @@ int ide_cdrom_probe_capabilities

ide-cd: kill CDROM_CONFIG_FLAGS() macro

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4fe6717862d4977b8e61307a2623ed7739068bdc
Commit: 4fe6717862d4977b8e61307a2623ed7739068bdc
Parent: 3f1b86d89dc73dedda426a85e600ad244ed9fad4
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:21 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:21 2008 +0100

ide-cd: kill CDROM_CONFIG_FLAGS() macro

While at it rename 'info' variable to 'cd' in
ide_cdrom_probe_capabilities() and ide_cdrom_setup().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   96 ++
 drivers/ide/ide-cd.h |2 -
 2 files changed, 50 insertions(+), 48 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 81247a0..3e1923d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -657,8 +657,8 @@ static ide_startstop_t 
cdrom_start_packet_command(ide_drive_t *drive,
/* Set up the controller registers. */
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
   IDE_TFLAG_NO_SELECT_MASK, xferlen, info-dma);
- 
-   if (CDROM_CONFIG_FLAGS (drive)-drq_interrupt) {
+
+   if (info-config_flags.drq_interrupt) {
/* waiting for CDB interrupt, not DMA yet. */
if (info-dma)
drive-waiting_for_dma = 0;
@@ -694,7 +694,7 @@ static ide_startstop_t cdrom_transfer_packet_command 
(ide_drive_t *drive,
struct cdrom_info *info = drive-driver_data;
ide_startstop_t startstop;
 
-   if (CDROM_CONFIG_FLAGS(drive)-drq_interrupt) {
+   if (info-config_flags.drq_interrupt) {
/* Here we should have been called after receiving an interrupt
   from the device.  DRQ should how be set. */
 
@@ -893,11 +893,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t 
*drive)
if ((len % SECTOR_SIZE) != 0) {
printk (KERN_ERR %s: cdrom_read_intr: Bad transfer size %d\n,
drive-name, len);
-   if (CDROM_CONFIG_FLAGS(drive)-limit_nframes)
+   if (info-config_flags.limit_nframes)
printk (KERN_ERR   This drive is not supported by this 
version of the driver\n);
else {
printk (KERN_ERR   Trying to limit transfer sizes\n);
-   CDROM_CONFIG_FLAGS(drive)-limit_nframes = 1;
+   info-config_flags.limit_nframes = 1;
}
cdrom_end_request(drive, 0);
return ide_stopped;
@@ -1073,7 +1073,8 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t 
*drive)
 
if (cdrom_decode_status(drive, 0, stat))
return ide_stopped;
-   CDROM_CONFIG_FLAGS(drive)-seeking = 1;
+
+   info-config_flags.seeking = 1;
 
if (retry  time_after(jiffies, info-start_seek + IDECD_SEEK_TIMER)) {
if (--retry == 0) {
@@ -1721,7 +1722,7 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, 
sector_t block)
struct cdrom_info *info = drive-driver_data;
 
if (blk_fs_request(rq)) {
-   if (CDROM_CONFIG_FLAGS(drive)-seeking) {
+   if (info-config_flags.seeking) {
unsigned long elapsed = jiffies - info-start_seek;
int stat = HWIF(drive)-INB(IDE_STATUS_REG);
 
@@ -1732,7 +1733,7 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, 
sector_t block)
}
printk (KERN_ERR %s: DSC timeout\n, 
drive-name);
}
-   CDROM_CONFIG_FLAGS(drive)-seeking = 0;
+   info-config_flags.seeking = 0;
}
if ((rq_data_dir(rq) == READ)  
IDE_LARGE_SEEK(info-last_block, block, IDECD_SEEK_THRESHOLD)  
drive-dsc_overlap) {
action = cdrom_start_seek(drive, block);
@@ -1844,6 +1845,7 @@ static int cdrom_check_status(ide_drive_t *drive, struct 
request_sense *sense)
 static int
 cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
 {
+   struct cdrom_info *cd = drive-driver_data;
struct request_sense my_sense;
struct request req;
int stat;
@@ -1852,7 +1854,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct 
request_sense *sense)
sense = my_sense;
 
/* If the drive cannot lock the door, just pretend. */
-   if (CDROM_CONFIG_FLAGS(drive)-no_doorlock) {
+   if (cd-config_flags.no_doorlock) {
stat = 0;
} else {
cdrom_prepare_request(drive, req);
@@ -1869,7 +1871,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct 
request_sense *sense)
(sense-asc == 0x24 || sense-asc == 0x20

ide-cd: kill CDROM_STATE_FLAGS() macro

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ba11211f9ac58aac44daec5af4f7eeba217
Commit: 0ba11211f9ac58aac44daec5af4f7eeba217
Parent: 4fe6717862d4977b8e61307a2623ed7739068bdc
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:21 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:21 2008 +0100

ide-cd: kill CDROM_STATE_FLAGS() macro

While at it rename 'info' variable to 'cd' in cdrom_saw_media_change().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   44 
 drivers/ide/ide-cd.h |2 --
 2 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3e1923d..59981a0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -93,11 +93,11 @@ static void ide_cd_put(struct cdrom_info *cd)
buffers. */
 static void cdrom_saw_media_change (ide_drive_t *drive)
 {
-   struct cdrom_info *info = drive-driver_data;
-   
-   CDROM_STATE_FLAGS (drive)-media_changed = 1;
-   CDROM_STATE_FLAGS (drive)-toc_valid = 0;
-   info-nsectors_buffered = 0;
+   struct cdrom_info *cd = drive-driver_data;
+
+   cd-state_flags.media_changed = 1;
+   cd-state_flags.toc_valid = 0;
+   cd-nsectors_buffered = 0;
 }
 
 static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
@@ -1880,7 +1880,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct 
request_sense *sense)
stat = 0;
 
if (stat == 0)
-   CDROM_STATE_FLAGS(drive)-door_locked = lockflag;
+   cd-state_flags.door_locked = lockflag;
 
return stat;
 }
@@ -1900,7 +1900,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
return -EDRIVE_CANT_DO_THIS;
 
/* reload fails on some drives, if the tray is locked */
-   if (CDROM_STATE_FLAGS(drive)-door_locked  ejectflag)
+   if (cd-state_flags.door_locked  ejectflag)
return 0;
 
cdrom_prepare_request(drive, req);
@@ -1998,7 +1998,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
   If it is, just return. */
(void) cdrom_check_status(drive, sense);
 
-   if (CDROM_STATE_FLAGS(drive)-toc_valid)
+   if (info-state_flags.toc_valid)
return 0;
 
/* Try to get the total cdrom capacity and sector size. */
@@ -2137,7 +2137,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
}
 
/* Remember that we've read this stuff. */
-   CDROM_STATE_FLAGS(drive)-toc_valid = 1;
+   info-state_flags.toc_valid = 1;
 
return 0;
 }
@@ -2219,7 +2219,7 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int 
track,
/*
 * don't serve cached data, if the toc isn't valid
 */
-   if (!CDROM_STATE_FLAGS(drive)-toc_valid)
+   if (!info-state_flags.toc_valid)
return -EINVAL;
 
/* Check validity of requested track number. */
@@ -2351,6 +2351,7 @@ static
 int ide_cdrom_reset (struct cdrom_device_info *cdi)
 {
ide_drive_t *drive = cdi-handle;
+   struct cdrom_info *cd = drive-driver_data;
struct request_sense sense;
struct request req;
int ret;
@@ -2364,7 +2365,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
 * A reset will unlock the door. If it was previously locked,
 * lock it again.
 */
-   if (CDROM_STATE_FLAGS(drive)-door_locked)
+   if (cd-state_flags.door_locked)
(void) cdrom_lockdoor(drive, 1, sense);
 
return ret;
@@ -2434,7 +2435,7 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct 
atapi_capabilities_page
maxspeed = be16_to_cpu(cap-maxspeed);
}
 
-   CDROM_STATE_FLAGS(drive)-current_speed = (curspeed + (176/2)) / 176;
+   cd-state_flags.current_speed = (curspeed + (176/2)) / 176;
cd-config_flags.max_speed = (maxspeed + (176/2)) / 176;
 }
 
@@ -2442,6 +2443,7 @@ static
 int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
 {
ide_drive_t *drive = cdi-handle;
+   struct cdrom_info *cd = drive-driver_data;
struct request_sense sense;
struct atapi_capabilities_page cap;
int stat;
@@ -2451,7 +2453,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info 
*cdi, int speed)
 
if (!ide_cdrom_get_capabilities(drive, cap)) {
ide_cdrom_update_speed(drive, cap);
-   cdi-speed = CDROM_STATE_FLAGS(drive)-current_speed;
+   cdi-speed = cd-state_flags.current_speed;
}
 return 0;
 }
@@ -2512,7 +2514,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info 
*cdi,
struct request_sense sense;
int ret;
 
-   if (!CDROM_STATE_FLAGS(drive

ide-cd: remove struct atapi_capabilities_page (take 2)

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=455d80a9553915251b6392e31c39aeb8f8a94d68
Commit: 455d80a9553915251b6392e31c39aeb8f8a94d68
Parent: 0ba11211f9ac58aac44daec5af4f7eeba217
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:21 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:21 2008 +0100

ide-cd: remove struct atapi_capabilities_page (take 2)

* Remove struct atapi_capabilities_page.

* Add ATAPI_CAPABILITIES_PAGE[_PAD]_SIZE define.

v2:
* The buf[] array access indexes were swapped between 'curspeed'/'maxspeed'.
  (Noticed by Borislav Petkov).

Cc: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   62 ---
 drivers/ide/ide-cd.h |  223 +-
 2 files changed, 37 insertions(+), 248 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 59981a0..ab1cdce 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2394,13 +2394,12 @@ int ide_cdrom_lock_door (struct cdrom_device_info *cdi, 
int lock)
return cdrom_lockdoor(drive, lock, NULL);
 }
 
-static
-int ide_cdrom_get_capabilities(ide_drive_t *drive, struct 
atapi_capabilities_page *cap)
+static int ide_cdrom_get_capabilities(ide_drive_t *drive, u8 *buf)
 {
struct cdrom_info *info = drive-driver_data;
struct cdrom_device_info *cdi = info-devinfo;
struct packet_command cgc;
-   int stat, attempts = 3, size = sizeof(*cap);
+   int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE;
 
/*
 * ACER50 (and others?) require the full spec length mode sense
@@ -2408,9 +2407,9 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct 
atapi_capabilities_pag
 */
if (!(!strcmp(drive-id-model, ATAPI CD ROM DRIVE 50X MAX) ||
!strcmp(drive-id-model, WPI CDS-32X)))
-   size -= sizeof(cap-pad);
+   size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE;
 
-   init_cdrom_command(cgc, cap, size, CGC_DATA_UNKNOWN);
+   init_cdrom_command(cgc, buf, size, CGC_DATA_UNKNOWN);
do { /* we seem to get stat=0x01,err=0x00 the first time (??) */
stat = cdrom_mode_sense(cdi, cgc, GPMODE_CAPABILITIES_PAGE, 0);
if (!stat)
@@ -2419,20 +2418,22 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, 
struct atapi_capabilities_pag
return stat;
 }
 
-static
-void ide_cdrom_update_speed (ide_drive_t *drive, struct 
atapi_capabilities_page *cap)
+static void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
 {
struct cdrom_info *cd = drive-driver_data;
u16 curspeed, maxspeed;
 
+   curspeed = *(u16 *)buf[8 + 14];
+   maxspeed = *(u16 *)buf[8 +  8];
+
/* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */
if (!drive-id-model[0] 
!strncmp(drive-id-fw_rev, 241N, 4)) {
-   curspeed = le16_to_cpu(cap-curspeed);
-   maxspeed = le16_to_cpu(cap-maxspeed);
+   curspeed = le16_to_cpu(curspeed);
+   maxspeed = le16_to_cpu(maxspeed);
} else {
-   curspeed = be16_to_cpu(cap-curspeed);
-   maxspeed = be16_to_cpu(cap-maxspeed);
+   curspeed = be16_to_cpu(curspeed);
+   maxspeed = be16_to_cpu(maxspeed);
}
 
cd-state_flags.current_speed = (curspeed + (176/2)) / 176;
@@ -2445,14 +2446,14 @@ int ide_cdrom_select_speed (struct cdrom_device_info 
*cdi, int speed)
ide_drive_t *drive = cdi-handle;
struct cdrom_info *cd = drive-driver_data;
struct request_sense sense;
-   struct atapi_capabilities_page cap;
+   u8 buf[ATAPI_CAPABILITIES_PAGE_SIZE];
int stat;
 
if ((stat = cdrom_select_speed(drive, speed, sense))  0)
return stat;
 
-   if (!ide_cdrom_get_capabilities(drive, cap)) {
-   ide_cdrom_update_speed(drive, cap);
+   if (!ide_cdrom_get_capabilities(drive, buf)) {
+   ide_cdrom_update_speed(drive, buf);
cdi-speed = cd-state_flags.current_speed;
}
 return 0;
@@ -2636,7 +2637,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
 {
struct cdrom_info *cd = drive-driver_data;
struct cdrom_device_info *cdi = cd-devinfo;
-   struct atapi_capabilities_page cap;
+   u8 buf[ATAPI_CAPABILITIES_PAGE_SIZE];
+   mechtype_t mechtype;
int nslots = 1;
 
cdi-mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R |
@@ -2666,26 +2668,28 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
cdi-handle = drive;
cdi-ops = ide_cdrom_dops;
 
-   if (ide_cdrom_get_capabilities(drive, cap))
+   if (ide_cdrom_get_capabilities(drive, buf))
return 0

ide-cd: remove struct ide_cd_{config,state}_flags

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2bc4cf2d826cb497063f6a84ab444cff13537e5f
Commit: 2bc4cf2d826cb497063f6a84ab444cff13537e5f
Parent: 455d80a9553915251b6392e31c39aeb8f8a94d68
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:22 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:22 2008 +0100

ide-cd: remove struct ide_cd_{config,state}_flags

* Remove unused -{writing,reserved} fields from struct ide_cd_config_flags.

* Move -max_speed from struct ide_cd_config_flags to struct cdrom_info.

* Move -current_speed from struct ide_cd_state_flags to struct cdrom_info.

* Add defines for config and state flags.

* Add 'unsigned int cd_flags' to struct cdrom_info and use -cd_flags
  instead of -{config,state}_flags.

* Remove no longer needed struct ide_cd_{config,state}_flags.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  106 ++
 drivers/ide/ide-cd.h |   62 +++--
 2 files changed, 87 insertions(+), 81 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ab1cdce..a049750 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -95,8 +95,8 @@ static void cdrom_saw_media_change (ide_drive_t *drive)
 {
struct cdrom_info *cd = drive-driver_data;
 
-   cd-state_flags.media_changed = 1;
-   cd-state_flags.toc_valid = 0;
+   cd-cd_flags |= IDE_CD_FLAG_MEDIA_CHANGED;
+   cd-cd_flags = ~IDE_CD_FLAG_TOC_VALID;
cd-nsectors_buffered = 0;
 }
 
@@ -658,7 +658,7 @@ static ide_startstop_t 
cdrom_start_packet_command(ide_drive_t *drive,
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
   IDE_TFLAG_NO_SELECT_MASK, xferlen, info-dma);
 
-   if (info-config_flags.drq_interrupt) {
+   if (info-cd_flags  IDE_CD_FLAG_DRQ_INTERRUPT) {
/* waiting for CDB interrupt, not DMA yet. */
if (info-dma)
drive-waiting_for_dma = 0;
@@ -694,7 +694,7 @@ static ide_startstop_t cdrom_transfer_packet_command 
(ide_drive_t *drive,
struct cdrom_info *info = drive-driver_data;
ide_startstop_t startstop;
 
-   if (info-config_flags.drq_interrupt) {
+   if (info-cd_flags  IDE_CD_FLAG_DRQ_INTERRUPT) {
/* Here we should have been called after receiving an interrupt
   from the device.  DRQ should how be set. */
 
@@ -893,11 +893,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t 
*drive)
if ((len % SECTOR_SIZE) != 0) {
printk (KERN_ERR %s: cdrom_read_intr: Bad transfer size %d\n,
drive-name, len);
-   if (info-config_flags.limit_nframes)
+   if (info-cd_flags  IDE_CD_FLAG_LIMIT_NFRAMES)
printk (KERN_ERR   This drive is not supported by this 
version of the driver\n);
else {
printk (KERN_ERR   Trying to limit transfer sizes\n);
-   info-config_flags.limit_nframes = 1;
+   info-cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
}
cdrom_end_request(drive, 0);
return ide_stopped;
@@ -1074,7 +1074,7 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t 
*drive)
if (cdrom_decode_status(drive, 0, stat))
return ide_stopped;
 
-   info-config_flags.seeking = 1;
+   info-cd_flags |= IDE_CD_FLAG_SEEKING;
 
if (retry  time_after(jiffies, info-start_seek + IDECD_SEEK_TIMER)) {
if (--retry == 0) {
@@ -1722,7 +1722,7 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, 
sector_t block)
struct cdrom_info *info = drive-driver_data;
 
if (blk_fs_request(rq)) {
-   if (info-config_flags.seeking) {
+   if (info-cd_flags  IDE_CD_FLAG_SEEKING) {
unsigned long elapsed = jiffies - info-start_seek;
int stat = HWIF(drive)-INB(IDE_STATUS_REG);
 
@@ -1733,7 +1733,7 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, 
sector_t block)
}
printk (KERN_ERR %s: DSC timeout\n, 
drive-name);
}
-   info-config_flags.seeking = 0;
+   info-cd_flags = ~IDE_CD_FLAG_SEEKING;
}
if ((rq_data_dir(rq) == READ)  
IDE_LARGE_SEEK(info-last_block, block, IDECD_SEEK_THRESHOLD)  
drive-dsc_overlap) {
action = cdrom_start_seek(drive, block);
@@ -1854,7 +1854,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct 
request_sense *sense)
sense = my_sense;
 
/* If the drive cannot lock

ide-cd: remove NO_DOOR_LOCKING define

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3fc3cbf786b6e73cd5cfe2f3233410a260405c86
Commit: 3fc3cbf786b6e73cd5cfe2f3233410a260405c86
Parent: 2bc4cf2d826cb497063f6a84ab444cff13537e5f
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:22 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:22 2008 +0100

ide-cd: remove NO_DOOR_LOCKING define

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |3 ---
 drivers/ide/ide-cd.h |7 ---
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index a049750..1232086 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2855,9 +2855,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
 
cd-cd_flags |= IDE_CD_FLAG_MEDIA_CHANGED;
 
-#if NO_DOOR_LOCKING
-   cd-cd_flags |= IDE_CD_FLAG_NO_DOORLOCK;
-#endif
if ((drive-id-config  0x0060) == 0x20)
cd-cd_flags |= IDE_CD_FLAG_DRQ_INTERRUPT;
cd-cd_flags |= IDE_CD_FLAG_NO_EJECT;
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index c19aa23..59b4393 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -28,13 +28,6 @@
 #endif
 
 
-/* Turning this on will disable the door-locking functionality.
-   This is apparently needed for supermount. */
-
-#ifndef NO_DOOR_LOCKING
-#define NO_DOOR_LOCKING 0
-#endif
-
 /*
  * typical timeout for packet command
  */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove STANDARD_ATAPI define

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cdf6000d7e332d0f7f14233e71dee489628f5aae
Commit: cdf6000d7e332d0f7f14233e71dee489628f5aae
Parent: 3fc3cbf786b6e73cd5cfe2f3233410a260405c86
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:22 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:22 2008 +0100

ide-cd: remove STANDARD_ATAPI define

Remove STANDARD_ATAPI define + drive-by coding style fixes.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   43 ++-
 drivers/ide/ide-cd.h |   10 --
 2 files changed, 10 insertions(+), 43 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 1232086..206d038 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1775,7 +1775,6 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, 
sector_t block)
  * can also be NULL, in which case no sense information is returned.
  */
 
-#if ! STANDARD_ATAPI
 static inline
 int bin2bcd (int x)
 {
@@ -1797,9 +1796,6 @@ void msf_from_bcd (struct atapi_msf *msf)
msf-frame  = bcd2bin (msf-frame);
 }
 
-#endif /* not STANDARD_ATAPI */
-
-
 static inline
 void lba_to_msf (int lba, byte *m, byte *s, byte *f)
 {
@@ -1830,12 +1826,11 @@ static int cdrom_check_status(ide_drive_t *drive, 
struct request_sense *sense)
req.cmd[0] = GPCMD_TEST_UNIT_READY;
req.cmd_flags |= REQ_QUIET;
 
-#if ! STANDARD_ATAPI
-/* the Sanyo 3 CD changer uses byte 7 of TEST_UNIT_READY to 
-   switch CDs instead of supporting the LOAD_UNLOAD opcode   */
-
+   /*
+* Sanyo 3 CD changer uses byte 7 of TEST_UNIT_READY to
+* switch CDs instead of supporting the LOAD_UNLOAD opcode.
+*/
req.cmd[7] = cdi-sanyo_slot % 3;
-#endif /* not STANDARD_ATAPI */
 
return cdrom_queue_packet_command(drive, req);
 }
@@ -2024,12 +2019,10 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
if (stat)
return stat;
 
-#if ! STANDARD_ATAPI
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
toc-hdr.first_track = bcd2bin(toc-hdr.first_track);
toc-hdr.last_track  = bcd2bin(toc-hdr.last_track);
}
-#endif  /* not STANDARD_ATAPI */
 
ntracks = toc-hdr.last_track - toc-hdr.first_track + 1;
if (ntracks = 0)
@@ -2061,16 +2054,13 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
   (ntracks + 1) *
   sizeof(struct atapi_toc_entry),
   sense);
-   if (stat) {
+   if (stat)
return stat;
-   }
-#if ! STANDARD_ATAPI
+
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
toc-hdr.first_track = bin2bcd(CDROM_LEADOUT);
toc-hdr.last_track = bin2bcd(CDROM_LEADOUT);
-   } else
-#endif  /* not STANDARD_ATAPI */
-   {
+   } else {
toc-hdr.first_track = CDROM_LEADOUT;
toc-hdr.last_track = CDROM_LEADOUT;
}
@@ -2081,21 +2071,17 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
 
toc-hdr.toc_length = ntohs (toc-hdr.toc_length);
 
-#if ! STANDARD_ATAPI
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
toc-hdr.first_track = bcd2bin(toc-hdr.first_track);
toc-hdr.last_track  = bcd2bin(toc-hdr.last_track);
}
-#endif  /* not STANDARD_ATAPI */
 
-   for (i=0; i=ntracks; i++) {
-#if ! STANDARD_ATAPI
+   for (i = 0; i = ntracks; i++) {
if (info-cd_flags  IDE_CD_FLAG_TOCADDR_AS_BCD) {
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD)
toc-ent[i].track = bcd2bin(toc-ent[i].track);
msf_from_bcd(toc-ent[i].addr.msf);
}
-#endif  /* not STANDARD_ATAPI */
toc-ent[i].addr.lba = msf_to_lba (toc-ent[i].addr.msf.minute,
   toc-ent[i].addr.msf.second,
   toc-ent[i].addr.msf.frame);
@@ -2115,7 +2101,6 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
toc-last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */
}
 
-#if ! STANDARD_ATAPI
if (info-cd_flags  IDE_CD_FLAG_TOCADDR_AS_BCD) {
/* Re-read multisession information using MSF format */
stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)ms_tmp,
@@ -2128,7 +2113,6 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense

ide-cd: use BCD2BIN()/BIN2BCD() macros from linux/bcd.h

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a6dc668d9b4d639936c683879eb1e0f92c5b944
Commit: 9a6dc668d9b4d639936c683879eb1e0f92c5b944
Parent: cdf6000d7e332d0f7f14233e71dee489628f5aae
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:22 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:22 2008 +0100

ide-cd: use BCD2BIN()/BIN2BCD() macros from linux/bcd.h

Use BCD2BIN()/BIN2BCD() macros from linux/bcd.h
and remove the local bcd2bin()/bin2bcd() inlines.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   34 +++---
 1 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 206d038..4bd664d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -46,6 +46,7 @@
 #include linux/ide.h
 #include linux/completion.h
 #include linux/mutex.h
+#include linux/bcd.h
 
 #include scsi/scsi.h /* For SCSI - ATAPI command conversion */
 
@@ -1775,25 +1776,12 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request 
*rq, sector_t block)
  * can also be NULL, in which case no sense information is returned.
  */
 
-static inline
-int bin2bcd (int x)
-{
-   return (x%10) | ((x/10)  4);
-}
-
-
-static inline
-int bcd2bin (int x)
-{
-   return (x  4) * 10 + (x  0x0f);
-}
-
 static
 void msf_from_bcd (struct atapi_msf *msf)
 {
-   msf-minute = bcd2bin (msf-minute);
-   msf-second = bcd2bin (msf-second);
-   msf-frame  = bcd2bin (msf-frame);
+   msf-minute = BCD2BIN(msf-minute);
+   msf-second = BCD2BIN(msf-second);
+   msf-frame  = BCD2BIN(msf-frame);
 }
 
 static inline
@@ -2020,8 +2008,8 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
return stat;
 
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
-   toc-hdr.first_track = bcd2bin(toc-hdr.first_track);
-   toc-hdr.last_track  = bcd2bin(toc-hdr.last_track);
+   toc-hdr.first_track = BCD2BIN(toc-hdr.first_track);
+   toc-hdr.last_track  = BCD2BIN(toc-hdr.last_track);
}
 
ntracks = toc-hdr.last_track - toc-hdr.first_track + 1;
@@ -2058,8 +2046,8 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
return stat;
 
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
-   toc-hdr.first_track = bin2bcd(CDROM_LEADOUT);
-   toc-hdr.last_track = bin2bcd(CDROM_LEADOUT);
+   toc-hdr.first_track = (u8)BIN2BCD(CDROM_LEADOUT);
+   toc-hdr.last_track = (u8)BIN2BCD(CDROM_LEADOUT);
} else {
toc-hdr.first_track = CDROM_LEADOUT;
toc-hdr.last_track = CDROM_LEADOUT;
@@ -2072,14 +2060,14 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
toc-hdr.toc_length = ntohs (toc-hdr.toc_length);
 
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD) {
-   toc-hdr.first_track = bcd2bin(toc-hdr.first_track);
-   toc-hdr.last_track  = bcd2bin(toc-hdr.last_track);
+   toc-hdr.first_track = BCD2BIN(toc-hdr.first_track);
+   toc-hdr.last_track  = BCD2BIN(toc-hdr.last_track);
}
 
for (i = 0; i = ntracks; i++) {
if (info-cd_flags  IDE_CD_FLAG_TOCADDR_AS_BCD) {
if (info-cd_flags  IDE_CD_FLAG_TOCTRACKS_AS_BCD)
-   toc-ent[i].track = bcd2bin(toc-ent[i].track);
+   toc-ent[i].track = BCD2BIN(toc-ent[i].track);
msf_from_bcd(toc-ent[i].addr.msf);
}
toc-ent[i].addr.lba = msf_to_lba (toc-ent[i].addr.msf.minute,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: re-organize handling of quirky devices

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e59724c7db9afd14827f1b737605f54d47f2d226
Commit: e59724c7db9afd14827f1b737605f54d47f2d226
Parent: 9a6dc668d9b4d639936c683879eb1e0f92c5b944
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:22 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:22 2008 +0100

ide-cd: re-organize handling of quirky devices

Re-organize handling of quirky devices:

* Add struct cd_list_entry, ide_cd_quirks_list[] and ide_cd_flags() helper.

* Set flags returned by ide_cd_flags() in ide_cdrom_setup().

* Add IDE_CD_FLAG_VERTOS_{300_SDD,600_ESD} and IDE_CD_FLAG_SANYO_3CD flags.

* Move device quirks from ide_cdrom_setup() to ide_cd_quirks_list[].

* Rename IDE_CD_FLAG_NEC260 to IDE_CD_FLAG_PRE_ATAPI12 and handle
  quirky Stingray 8X CD-ROM using ide_cd_quirks_list[].

* Add IDE_CD_FLAG_FULL_CAPS_PAGE flag and handle quirky ACER 50X CD-ROM
  / WPI 32X CD-ROM using ide_cd_quirk_list[].

* Add IDE_CD_FLAG_PLAY_AUDIO_OK flag and handle quirky MATSHITA DVD-ROMs
  using ide_cd_quirks_list[].

* Add IDE_CD_FLAG_LE_SPEED_FIELDS flag and handle quirky ACER/AOpen 24X
  CD-ROM using ide_cd_quirk_list[].

* Fix some comments about quirky devices while at it.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  140 +++--
 drivers/ide/ide-cd.h |   10 +++-
 2 files changed, 85 insertions(+), 65 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 4bd664d..bd55232 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2377,12 +2377,7 @@ static int ide_cdrom_get_capabilities(ide_drive_t 
*drive, u8 *buf)
struct packet_command cgc;
int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE;
 
-   /*
-* ACER50 (and others?) require the full spec length mode sense
-* page capabilities size, but older drives break.
-*/
-   if (!(!strcmp(drive-id-model, ATAPI CD ROM DRIVE 50X MAX) ||
-   !strcmp(drive-id-model, WPI CDS-32X)))
+   if ((info-cd_flags  IDE_CD_FLAG_FULL_CAPS_PAGE) == 0)
size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE;
 
init_cdrom_command(cgc, buf, size, CGC_DATA_UNKNOWN);
@@ -2402,9 +2397,7 @@ static void ide_cdrom_update_speed(ide_drive_t *drive, u8 
*buf)
curspeed = *(u16 *)buf[8 + 14];
maxspeed = *(u16 *)buf[8 +  8];
 
-   /* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */
-   if (!drive-id-model[0] 
-   !strncmp(drive-id-fw_rev, 241N, 4)) {
+   if (cd-cd_flags  IDE_CD_FLAG_LE_SPEED_FIELDS) {
curspeed = le16_to_cpu(curspeed);
maxspeed = le16_to_cpu(maxspeed);
} else {
@@ -2627,8 +2620,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
return nslots;
}
 
-   if ((cd-cd_flags  IDE_CD_FLAG_NEC260) ||
-   !strcmp(drive-id-model,STINGRAY 8422 IDE 8X CD-ROM 7-27-95)) {
+   if (cd-cd_flags  IDE_CD_FLAG_PRE_ATAPI12) {
cd-cd_flags = ~IDE_CD_FLAG_NO_EJECT;
cdi-mask = ~CDC_PLAY_AUDIO;
return nslots;
@@ -2661,22 +2653,13 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
if (buf[8 + 3]  0x10)
cdi-mask = ~CDC_DVD_R;
-   if (buf[8 + 4]  0x01)
+   if ((buf[8 + 4]  0x01) || (cd-cd_flags  IDE_CD_FLAG_PLAY_AUDIO_OK))
cdi-mask = ~CDC_PLAY_AUDIO;
 
mechtype = buf[8 + 6]  5;
if (mechtype == mechtype_caddy || mechtype == mechtype_popup)
cdi-mask |= CDC_CLOSE_TRAY;
 
-   /* Some drives used by Apple don't advertise audio play
-* but they do support reading TOC  audio datas
-*/
-   if (strcmp(drive-id-model, MATSHITADVD-ROM SR-8187) == 0 ||
-   strcmp(drive-id-model, MATSHITADVD-ROM SR-8186) == 0 ||
-   strcmp(drive-id-model, MATSHITADVD-ROM SR-8176) == 0 ||
-   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0)
-   cdi-mask = ~CDC_PLAY_AUDIO;
-
if (cdi-sanyo_slot  0) {
cdi-mask = ~CDC_SELECT_DISC;
nslots = 3;
@@ -2805,11 +2788,74 @@ static int ide_cdrom_prep_fn(struct request_queue *q, 
struct request *rq)
return 0;
 }
 
+struct cd_list_entry {
+   const char  *id_model;
+   const char  *id_firmware;
+   unsigned intcd_flags;
+};
+
+static const struct cd_list_entry ide_cd_quirks_list[] = {
+   /* Limit transfer size per interrupt. */
+   { SAMSUNG CD-ROM SCR-2430, NULL,   IDE_CD_FLAG_LIMIT_NFRAMES  },
+   { SAMSUNG CD-ROM SCR-2432, NULL

ide-cd: remove duplicate sense keys definitions from ide-cd.h

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1b1215d5e954726b142d5408dfd6d7153b3abe8b
Commit: 1b1215d5e954726b142d5408dfd6d7153b3abe8b
Parent: e59724c7db9afd14827f1b737605f54d47f2d226
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:23 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:23 2008 +0100

ide-cd: remove duplicate sense keys definitions from ide-cd.h

ide-cd.c already uses sense keys definitions from scsi/scsi.h.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.h |   17 -
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index fc8d6d6..33019cb 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -158,23 +158,6 @@ struct cdrom_info {
  */
 
 /* This stuff should be in cdrom.h, since it is now generic... */
-
-/* ATAPI sense keys (from table 140 of ATAPI 2.6) */
-#define NO_SENSE0x00
-#define RECOVERED_ERROR 0x01
-#define NOT_READY   0x02
-#define MEDIUM_ERROR0x03
-#define HARDWARE_ERROR  0x04
-#define ILLEGAL_REQUEST 0x05
-#define UNIT_ATTENTION  0x06
-#define DATA_PROTECT0x07
-#define BLANK_CHECK 0x08
-#define ABORTED_COMMAND 0x0b
-#define MISCOMPARE  0x0e
-
- 
-
-/* This stuff should be in cdrom.h, since it is now generic... */
 #if VERBOSE_IDE_CD_ERRORS
 
  /* The generic packet command opcodes for CD/DVD Logical Units,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: coding style fixes for VERBOSE_IDE_CD_ERRORS code

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=89d13ec7c8b85f3c62a4a12034e65d3d2d3273a8
Commit: 89d13ec7c8b85f3c62a4a12034e65d3d2d3273a8
Parent: 1b1215d5e954726b142d5408dfd6d7153b3abe8b
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:23 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:23 2008 +0100

ide-cd: coding style fixes for VERBOSE_IDE_CD_ERRORS code

* Coding style fixes for VERBOSE_IDE_CD_ERRORS code.

* Add KERN_{ERR,CONT} printk() levels where needed.

This is a preparation for moving this code out of ide-cd.[c,h].

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   65 +
 drivers/ide/ide-cd.h |   33 -
 2 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index bd55232..02488b4 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -205,28 +205,30 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
const char *s = bad sense key!;
char buf[80];
 
-   printk (ATAPI device %s:\n, drive-name);
-   if (sense-error_code==0x70)
-   printk(  Error: );
-   else if (sense-error_code==0x71)
+   printk(KERN_ERR ATAPI device %s:\n, drive-name);
+   if (sense-error_code == 0x70)
+   printk(KERN_CONT   Error: );
+   else if (sense-error_code == 0x71)
printk(  Deferred Error: );
else if (sense-error_code == 0x7f)
-   printk(  Vendor-specific Error: );
+   printk(KERN_CONT   Vendor-specific Error: );
else
-   printk(  Unknown Error Type: );
+   printk(KERN_CONT   Unknown Error Type: );
 
if (sense-sense_key  ARRAY_SIZE(sense_key_texts))
s = sense_key_texts[sense-sense_key];
 
-   printk(%s -- (Sense key=0x%02x)\n, s, sense-sense_key);
+   printk(KERN_CONT %s -- (Sense key=0x%02x)\n,
+s, sense-sense_key);
 
if (sense-asc == 0x40) {
sprintf(buf, Diagnostic failure on component 0x%02x,
-sense-ascq);
+   sense-ascq);
s = buf;
} else {
int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts);
unsigned long key = (sense-sense_key  16);
+
key |= (sense-asc  8);
if (!(sense-ascq = 0x80  sense-ascq = 0xdd))
key |= sense-ascq;
@@ -238,11 +240,10 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
sense_data_texts[mid].asc_ascq == 
(0xff|key)) {
s = sense_data_texts[mid].text;
break;
-   }
-   else if (sense_data_texts[mid].asc_ascq  key)
+   } else if (sense_data_texts[mid].asc_ascq  key)
hi = mid;
else
-   lo = mid+1;
+   lo = mid + 1;
}
}
 
@@ -254,11 +255,10 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
}
 
printk(KERN_ERR   %s -- (asc=0x%02x, ascq=0x%02x)\n,
-   s, sense-asc, sense-ascq);
+   s, sense-asc, sense-ascq);
 
if (failed_command != NULL) {
-
-   int lo=0, mid, hi= ARRAY_SIZE(packet_command_texts);
+   int lo = 0, mid, hi = ARRAY_SIZE(packet_command_texts);
s = NULL;
 
while (hi  lo) {
@@ -272,13 +272,15 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
failed_command-cmd[0])
hi = mid;
else
-   lo = mid+1;
+   lo = mid + 1;
}
 
-   printk (KERN_ERR   The failed \%s\ packet command 
was: \n  \, s);
-   for (i=0; isizeof (failed_command-cmd); i++)
-   printk (%02x , failed_command-cmd[i]);
-   printk (\\n);
+   printk(KERN_ERR   The failed \%s\ packet command 
+   was: \n  \, s);
+   for (i = 0; i  sizeof

ide-cd: move VERBOSE_IDE_CD_ERRORS code to ide-cd_verbose.c

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=972560fb9d9ea7bc7082c0c79c99c24e3f56606c
Commit: 972560fb9d9ea7bc7082c0c79c99c24e3f56606c
Parent: 89d13ec7c8b85f3c62a4a12034e65d3d2d3273a8
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:23 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:23 2008 +0100

ide-cd: move VERBOSE_IDE_CD_ERRORS code to ide-cd_verbose.c

* Rename ide-cd kernel module to ide-cd_mod in preparation to moving code 
out
  from ide-cd.[c,h].   Add MODULE_ALIAS(ide-cd) to preserve compatibility.

* Move VERBOSE_IDE_CD_ERRORS code from ide-cd.[c,h] to ide-cd_verbose.c.

  ide-cd_verbose.c is IDE subsystem independent and may be easily converted
  into generic library usable by other drivers (i.e. libata) if needed.

* Add CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS config option to 
drivers/ide/Kconfig
  replacing VERBOSE_IDE_CD_ERRORS define.  Make this config option enabled 
by
  default and visible only if CONFIG_EMBEDDED is defined.

before the patch:
   textdata bss dec hex filename
  22841 3601056   242575ec1 drivers/ide/ide-cd.o

after the patch w/ CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y:
   textdata bss dec hex filename
  22857 3601056   242735ed1 drivers/ide/ide-cd_mod.o

after the patch w/ CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=n:
   textdata bss dec hex filename
  15091 3601056   16507407b drivers/ide/ide-cd_mod.o

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/Kconfig  |9 +
 drivers/ide/Makefile |4 +-
 drivers/ide/ide-cd.c |  124 +--
 drivers/ide/ide-cd.h |  535 --
 drivers/ide/ide-cd_verbose.c |  359 
 5 files changed, 524 insertions(+), 507 deletions(-)

diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 92b0117..e42a465 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -206,6 +206,15 @@ config BLK_DEV_IDECD
  To compile this driver as a module, choose M here: the
  module will be called ide-cd.
 
+config BLK_DEV_IDECD_VERBOSE_ERRORS
+   bool Verbose error logging for IDE/ATAPI CDROM driver if EMBEDDED
+   depends on BLK_DEV_IDECD
+   default y
+   help
+ Turn this on to have the driver print out the meanings of the
+ ATAPI error codes.  This will use up additional 8kB of kernel-space
+ memory, though.
+
 config BLK_DEV_IDETAPE
tristate Include IDE/ATAPI TAPE support (EXPERIMENTAL)
depends on EXPERIMENTAL
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 0d2da89..5ce1d8f 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -40,8 +40,10 @@ obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
 obj-$(CONFIG_IDE_H8300)+= h8300/
 obj-$(CONFIG_IDE_GENERIC)  += ide-generic.o
 
+ide-cd_mod-y += ide-cd.o ide-cd_verbose.o
+
 obj-$(CONFIG_BLK_DEV_IDEDISK)  += ide-disk.o
-obj-$(CONFIG_BLK_DEV_IDECD)+= ide-cd.o
+obj-$(CONFIG_BLK_DEV_IDECD)+= ide-cd_mod.o
 obj-$(CONFIG_BLK_DEV_IDETAPE)  += ide-tape.o
 obj-$(CONFIG_BLK_DEV_IDEFLOPPY)+= ide-floppy.o
 
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 02488b4..f4a0264 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -199,129 +199,8 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
}
}
}
-#if VERBOSE_IDE_CD_ERRORS
-   {
-   int i;
-   const char *s = bad sense key!;
-   char buf[80];
-
-   printk(KERN_ERR ATAPI device %s:\n, drive-name);
-   if (sense-error_code == 0x70)
-   printk(KERN_CONT   Error: );
-   else if (sense-error_code == 0x71)
-   printk(  Deferred Error: );
-   else if (sense-error_code == 0x7f)
-   printk(KERN_CONT   Vendor-specific Error: );
-   else
-   printk(KERN_CONT   Unknown Error Type: );
-
-   if (sense-sense_key  ARRAY_SIZE(sense_key_texts))
-   s = sense_key_texts[sense-sense_key];
-
-   printk(KERN_CONT %s -- (Sense key=0x%02x)\n,
-s, sense-sense_key);
-
-   if (sense-asc == 0x40) {
-   sprintf(buf, Diagnostic failure on component 0x%02x,
-   sense-ascq);
-   s = buf;
-   } else {
-   int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts);
-   unsigned long key = (sense-sense_key  16

ide-cd: factor out ioctl handlers from ide_cdrom_audio_ioctl()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ba3fab24d210544cba74b3fd640123baf33ed331
Commit: ba3fab24d210544cba74b3fd640123baf33ed331
Parent: 972560fb9d9ea7bc7082c0c79c99c24e3f56606c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:23 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:23 2008 +0100

ide-cd: factor out ioctl handlers from ide_cdrom_audio_ioctl()

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  142 ++---
 1 files changed, 75 insertions(+), 67 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f4a0264..1826c58 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1998,6 +1998,24 @@ static int cdrom_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
return 0;
 }
 
+static int ide_cd_read_tochdr(ide_drive_t *drive, void *arg)
+{
+   struct cdrom_info *cd = drive-driver_data;
+   struct cdrom_tochdr *tochdr = arg;
+   struct atapi_toc *toc;
+   int stat;
+
+   /* Make sure our saved TOC is valid. */
+   stat = cdrom_read_toc(drive, NULL);
+   if (stat)
+   return stat;
+
+   toc = cd-toc;
+   tochdr-cdth_trk0 = toc-hdr.first_track;
+   tochdr-cdth_trk1 = toc-hdr.last_track;
+
+   return 0;
+}
 
 static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf,
 int buflen, struct request_sense *sense)
@@ -2092,6 +2110,55 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int 
track,
return 0;
 }
 
+static int ide_cd_read_tocentry(ide_drive_t *drive, void *arg)
+{
+   struct cdrom_tocentry *tocentry = arg;
+   struct atapi_toc_entry *toce;
+   int stat;
+
+   stat = cdrom_get_toc_entry(drive, tocentry-cdte_track, toce);
+   if (stat)
+   return stat;
+
+   tocentry-cdte_ctrl = toce-control;
+   tocentry-cdte_adr  = toce-adr;
+   if (tocentry-cdte_format == CDROM_MSF) {
+   lba_to_msf(toce-addr.lba,
+  tocentry-cdte_addr.msf.minute,
+  tocentry-cdte_addr.msf.second,
+  tocentry-cdte_addr.msf.frame);
+   } else
+   tocentry-cdte_addr.lba = toce-addr.lba;
+
+   return 0;
+}
+
+static int ide_cd_fake_play_trkind(ide_drive_t *drive, void *arg)
+{
+   struct cdrom_ti *ti = arg;
+   struct atapi_toc_entry *first_toc, *last_toc;
+   unsigned long lba_start, lba_end;
+   int stat;
+
+   stat = cdrom_get_toc_entry(drive, ti-cdti_trk0, first_toc);
+   if (stat)
+   return stat;
+
+   stat = cdrom_get_toc_entry(drive, ti-cdti_trk1, last_toc);
+   if (stat)
+   return stat;
+
+   if (ti-cdti_trk1 != CDROM_LEADOUT)
+   ++last_toc;
+   lba_start = first_toc-addr.lba;
+   lba_end   = last_toc-addr.lba;
+
+   if (lba_end = lba_start)
+   return -EINVAL;
+
+   return cdrom_play_audio(drive, lba_start, lba_end);
+}
+
 /* the generic packet interface to cdrom.c */
 static int ide_cdrom_packet(struct cdrom_device_info *cdi,
struct packet_command *cgc)
@@ -2123,81 +2190,22 @@ static int ide_cdrom_packet(struct cdrom_device_info 
*cdi,
return cgc-stat;
 }
 
-static
-int ide_cdrom_audio_ioctl (struct cdrom_device_info *cdi,
-  unsigned int cmd, void *arg)
-  
+static int ide_cdrom_audio_ioctl(struct cdrom_device_info *cdi,
+unsigned int cmd, void *arg)
 {
ide_drive_t *drive = cdi-handle;
-   struct cdrom_info *info = drive-driver_data;
-   int stat;
 
switch (cmd) {
/*
 * emulate PLAY_AUDIO_TI command with PLAY_AUDIO_10, since
 * atapi doesn't support it
 */
-   case CDROMPLAYTRKIND: {
-   unsigned long lba_start, lba_end;
-   struct cdrom_ti *ti = arg;
-   struct atapi_toc_entry *first_toc, *last_toc;
-
-   stat = cdrom_get_toc_entry(drive, ti-cdti_trk0, first_toc);
-   if (stat)
-   return stat;
-
-   stat = cdrom_get_toc_entry(drive, ti-cdti_trk1, last_toc);
-   if (stat)
-   return stat;
-
-   if (ti-cdti_trk1 != CDROM_LEADOUT)
-   ++last_toc;
-   lba_start = first_toc-addr.lba;
-   lba_end   = last_toc-addr.lba;
-
-   if (lba_end = lba_start)
-   return -EINVAL;
-
-   return cdrom_play_audio(drive, lba_start, lba_end);
-   }
-
-   case CDROMREADTOCHDR: {
-   struct cdrom_tochdr *tochdr = arg;
-   struct atapi_toc *toc;
-
-   /* Make sure our saved

ide-cd: merge cdrom_play_audio() into ide_cd_fake_play_trkind()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a891b1446b02509e5c7e5888a9f2a02edf8651a3
Commit: a891b1446b02509e5c7e5888a9f2a02edf8651a3
Parent: ba3fab24d210544cba74b3fd640123baf33ed331
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:23 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:23 2008 +0100

ide-cd: merge cdrom_play_audio() into ide_cd_fake_play_trkind()

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   26 ++
 1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 1826c58..6f1d6f2 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2068,21 +2068,6 @@ static int cdrom_select_speed(ide_drive_t *drive, int 
speed,
return cdrom_queue_packet_command(drive, req);
 }
 
-static int cdrom_play_audio(ide_drive_t *drive, int lba_start, int lba_end)
-{
-   struct request_sense sense;
-   struct request req;
-
-   cdrom_prepare_request(drive, req);
-
-   req.sense = sense;
-   req.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
-   lba_to_msf(lba_start, req.cmd[3], req.cmd[4], req.cmd[5]);
-   lba_to_msf(lba_end-1, req.cmd[6], req.cmd[7], req.cmd[8]);
-
-   return cdrom_queue_packet_command(drive, req);
-}
-
 static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
struct atapi_toc_entry **ent)
 {
@@ -2139,6 +2124,8 @@ static int ide_cd_fake_play_trkind(ide_drive_t *drive, 
void *arg)
struct atapi_toc_entry *first_toc, *last_toc;
unsigned long lba_start, lba_end;
int stat;
+   struct request rq;
+   struct request_sense sense;
 
stat = cdrom_get_toc_entry(drive, ti-cdti_trk0, first_toc);
if (stat)
@@ -2156,7 +2143,14 @@ static int ide_cd_fake_play_trkind(ide_drive_t *drive, 
void *arg)
if (lba_end = lba_start)
return -EINVAL;
 
-   return cdrom_play_audio(drive, lba_start, lba_end);
+   cdrom_prepare_request(drive, rq);
+
+   rq.sense = sense;
+   rq.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
+   lba_to_msf(lba_start,   rq.cmd[3], rq.cmd[4], rq.cmd[5]);
+   lba_to_msf(lba_end - 1, rq.cmd[6], rq.cmd[7], rq.cmd[8]);
+
+   return cdrom_queue_packet_command(drive, rq);
 }
 
 /* the generic packet interface to cdrom.c */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: merge cdrom_read_subchannel() into ide_cdrom_get_mcn()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=53126b91274b1f2186b17c1f587c662ab74b631f
Commit: 53126b91274b1f2186b17c1f587c662ab74b631f
Parent: a891b1446b02509e5c7e5888a9f2a02edf8651a3
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:24 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:24 2008 +0100

ide-cd: merge cdrom_read_subchannel() into ide_cdrom_get_mcn()

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   53 +++--
 1 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6f1d6f2..d9128a9 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2017,25 +2017,6 @@ static int ide_cd_read_tochdr(ide_drive_t *drive, void 
*arg)
return 0;
 }
 
-static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf,
-int buflen, struct request_sense *sense)
-{
-   struct request req;
-
-   cdrom_prepare_request(drive, req);
-
-   req.sense = sense;
-   req.data = buf;
-   req.data_len = buflen;
-   req.cmd[0] = GPCMD_READ_SUBCHANNEL;
-   req.cmd[1] = 2; /* MSF addressing */
-   req.cmd[2] = 0x40;  /* request subQ data */
-   req.cmd[3] = format;
-   req.cmd[7] = (buflen  8);
-   req.cmd[8] = (buflen  0xff);
-   return cdrom_queue_packet_command(drive, req);
-}
-
 /* ATAPI cdrom drives are free to select the speed you request or any slower
rate :-( Requesting too fast a speed will _not_ produce an error. */
 static int cdrom_select_speed(ide_drive_t *drive, int speed,
@@ -2377,28 +2358,36 @@ int ide_cdrom_get_last_session (struct 
cdrom_device_info *cdi,
return 0;
 }
 
-static
-int ide_cdrom_get_mcn (struct cdrom_device_info *cdi,
-  struct cdrom_mcn *mcn_info)
+static int ide_cdrom_get_mcn(struct cdrom_device_info *cdi,
+struct cdrom_mcn *mcn_info)
 {
-   int stat;
-   char mcnbuf[24];
ide_drive_t *drive = cdi-handle;
+   int stat, mcnlen;
+   struct request rq;
+   char buf[24];
+
+   cdrom_prepare_request(drive, rq);
 
-/* get MCN */
-   if ((stat = cdrom_read_subchannel(drive, 2, mcnbuf, sizeof (mcnbuf), 
NULL)))
+   rq.data = buf;
+   rq.data_len = sizeof(buf);
+
+   rq.cmd[0] = GPCMD_READ_SUBCHANNEL;
+   rq.cmd[1] = 2;  /* MSF addressing */
+   rq.cmd[2] = 0x40;   /* request subQ data */
+   rq.cmd[3] = 2;  /* format */
+   rq.cmd[8] = sizeof(buf);
+
+   stat = cdrom_queue_packet_command(drive, rq);
+   if (stat)
return stat;
 
-   memcpy (mcn_info-medium_catalog_number, mcnbuf+9,
-   sizeof (mcn_info-medium_catalog_number)-1);
-   mcn_info-medium_catalog_number[sizeof 
(mcn_info-medium_catalog_number)-1]
-   = '\0';
+   mcnlen = sizeof(mcn_info-medium_catalog_number) - 1;
+   memcpy(mcn_info-medium_catalog_number, buf + 9, mcnlen);
+   mcn_info-medium_catalog_number[mcnlen] = '\0';
 
return 0;
 }
 
-
-
 /
  * Other driver requests (open, close, check media change).
  */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: merge cdrom_select_speed() into ide_cdrom_select_speed()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5c68429dfe8256c6069555e5851838f8e3175f78
Commit: 5c68429dfe8256c6069555e5851838f8e3175f78
Parent: 53126b91274b1f2186b17c1f587c662ab74b631f
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:24 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:24 2008 +0100

ide-cd: merge cdrom_select_speed() into ide_cdrom_select_speed()

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   66 ++
 1 files changed, 29 insertions(+), 37 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index d9128a9..d290e19 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2017,38 +2017,6 @@ static int ide_cd_read_tochdr(ide_drive_t *drive, void 
*arg)
return 0;
 }
 
-/* ATAPI cdrom drives are free to select the speed you request or any slower
-   rate :-( Requesting too fast a speed will _not_ produce an error. */
-static int cdrom_select_speed(ide_drive_t *drive, int speed,
- struct request_sense *sense)
-{
-   struct cdrom_info *cd = drive-driver_data;
-   struct cdrom_device_info *cdi = cd-devinfo;
-   struct request req;
-   cdrom_prepare_request(drive, req);
-
-   req.sense = sense;
-   if (speed == 0)
-   speed = 0x; /* set to max */
-   else
-   speed *= 177;   /* Nx to kbytes/s */
-
-   req.cmd[0] = GPCMD_SET_SPEED;
-   /* Read Drive speed in kbytes/second MSB */
-   req.cmd[2] = (speed  8)  0xff;   
-   /* Read Drive speed in kbytes/second LSB */
-   req.cmd[3] = speed  0xff;
-   if ((cdi-mask  (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) !=
-   (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) {
-   /* Write Drive speed in kbytes/second MSB */
-   req.cmd[4] = (speed  8)  0xff;
-   /* Write Drive speed in kbytes/second LSB */
-   req.cmd[5] = speed  0xff;
-   }
-
-   return cdrom_queue_packet_command(drive, req);
-}
-
 static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
struct atapi_toc_entry **ent)
 {
@@ -2272,23 +2240,47 @@ static void ide_cdrom_update_speed(ide_drive_t *drive, 
u8 *buf)
cd-max_speed = (maxspeed + (176/2)) / 176;
 }
 
-static
-int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
+/*
+ * ATAPI devices are free to select the speed you request or any slower
+ * rate. :-(  Requesting too fast a speed will _not_ produce an error.
+ */
+static int ide_cdrom_select_speed(struct cdrom_device_info *cdi, int speed)
 {
ide_drive_t *drive = cdi-handle;
struct cdrom_info *cd = drive-driver_data;
+   struct request rq;
struct request_sense sense;
u8 buf[ATAPI_CAPABILITIES_PAGE_SIZE];
int stat;
 
-   if ((stat = cdrom_select_speed(drive, speed, sense))  0)
-   return stat;
+   cdrom_prepare_request(drive, rq);
+
+   rq.sense = sense;
+
+   if (speed == 0)
+   speed = 0x; /* set to max */
+   else
+   speed *= 177;   /* Nx to kbytes/s */
+
+   rq.cmd[0] = GPCMD_SET_SPEED;
+   /* Read Drive speed in kbytes/second MSB/LSB */
+   rq.cmd[2] = (speed  8)  0xff;
+   rq.cmd[3] = speed  0xff;
+   if ((cdi-mask  (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) !=
+   (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) {
+   /* Write Drive speed in kbytes/second MSB/LSB */
+   rq.cmd[4] = (speed  8)  0xff;
+   rq.cmd[5] = speed  0xff;
+   }
+
+   stat = cdrom_queue_packet_command(drive, rq);
 
if (!ide_cdrom_get_capabilities(drive, buf)) {
ide_cdrom_update_speed(drive, buf);
cdi-speed = cd-current_speed;
}
-return 0;
+
+   return 0;
 }
 
 /*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: move lba_to_msf() and msf_to_lba() to linux/cdrom.h

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a1bb9457f06439f22571e93bddcca63144a08296
Commit: a1bb9457f06439f22571e93bddcca63144a08296
Parent: 5c68429dfe8256c6069555e5851838f8e3175f78
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:24 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:24 2008 +0100

ide-cd: move lba_to_msf() and msf_to_lba() to linux/cdrom.h

* Move lba_to_msf() and msf_to_lba() to linux/cdrom.h
  (use 'u8' type instead of 'byte' while at it).

* Remove msf_to_lba() copy from drivers/cdrom/cdrom.c.

Acked-by: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/cdrom/cdrom.c |6 --
 drivers/ide/ide-cd.c  |   18 --
 include/linux/cdrom.h |   14 ++
 3 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index af05610..47e5b40 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2787,12 +2787,6 @@ int cdrom_ioctl(struct file * file, struct 
cdrom_device_info *cdi,
return -ENOSYS;
 }
 
-static inline
-int msf_to_lba(char m, char s, char f)
-{
-   return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
-}
-
 /*
  * Required when we need to use READ_10 to issue other than 2048 block
  * reads
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index d290e19..ee52c8a 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1664,24 +1664,6 @@ void msf_from_bcd (struct atapi_msf *msf)
msf-frame  = BCD2BIN(msf-frame);
 }
 
-static inline
-void lba_to_msf (int lba, byte *m, byte *s, byte *f)
-{
-   lba += CD_MSF_OFFSET;
-   lba = 0xff;  /* negative lbas use only 24 bits */
-   *m = lba / (CD_SECS * CD_FRAMES);
-   lba %= (CD_SECS * CD_FRAMES);
-   *s = lba / CD_FRAMES;
-   *f = lba % CD_FRAMES;
-}
-
-
-static inline
-int msf_to_lba (byte m, byte s, byte f)
-{
-   return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
-}
-
 static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
 {
struct request req;
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index fcdc11b..a5cd204 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -1187,6 +1187,20 @@ struct media_event_desc {
 
 extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct 
media_event_desc *med);
 
+static inline void lba_to_msf(int lba, u8 *m, u8 *s, u8 *f)
+{
+   lba += CD_MSF_OFFSET;
+   lba = 0xff;  /* negative lbas use only 24 bits */
+   *m = lba / (CD_SECS * CD_FRAMES);
+   lba %= (CD_SECS * CD_FRAMES);
+   *s = lba / CD_FRAMES;
+   *f = lba % CD_FRAMES;
+}
+
+static inline int msf_to_lba(u8 m, u8 s, u8 f)
+{
+   return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
+}
 #endif  /* End of kernel only stuff */ 
 
 #endif  /* _LINUX_CDROM_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: coding style fixes for cdrom_get_toc_entry()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5c937ae4e7928f825dde2713e9ebba68d50ece6c
Commit: 5c937ae4e7928f825dde2713e9ebba68d50ece6c
Parent: a1bb9457f06439f22571e93bddcca63144a08296
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:24 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:24 2008 +0100

ide-cd: coding style fixes for cdrom_get_toc_entry()

This is a preparation to move code handling cdrom.c IOCTLs out of ide-cd.c.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ee52c8a..c92f0d4 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2014,11 +2014,13 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int 
track,
 
/* Check validity of requested track number. */
ntracks = toc-hdr.last_track - toc-hdr.first_track + 1;
-   if (toc-hdr.first_track == CDROM_LEADOUT) ntracks = 0;
+
+   if (toc-hdr.first_track == CDROM_LEADOUT)
+   ntracks = 0;
+
if (track == CDROM_LEADOUT)
*ent = toc-ent[ntracks];
-   else if (track  toc-hdr.first_track ||
-track  toc-hdr.last_track)
+   else if (track  toc-hdr.first_track || track  toc-hdr.last_track)
return -EINVAL;
else
*ent = toc-ent[track - toc-hdr.first_track];
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: rename cdrom_* functions to ide_cd_*

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=139c829d9d83cfd6b51682f11a431283121e24b7
Commit: 139c829d9d83cfd6b51682f11a431283121e24b7
Parent: 5c937ae4e7928f825dde2713e9ebba68d50ece6c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:24 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:24 2008 +0100

ide-cd: rename cdrom_* functions to ide_cd_*

* cdrom_prepare_request() - ide_cd_init_rq()
* cdrom_queue_packet_command() - ide_cd_queue_pc()
* cdrom_lockdoor() - ide_cd_lockdoor()
* cdrom_read_toc() - ide_cd_read_toc()
* cdrom_get_toc_entry() - ide_cd_get_toc_entry()

This is a preparation to move code handling cdrom.c IOCTLs out of ide-cd.c.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   83 ++---
 1 files changed, 44 insertions(+), 39 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index c92f0d4..b82cabf 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -206,7 +206,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 /*
  * Initialize a ide-cd packet command request
  */
-static void cdrom_prepare_request(ide_drive_t *drive, struct request *rq)
+static void ide_cd_init_rq(ide_drive_t *drive, struct request *rq)
 {
struct cdrom_info *cd = drive-driver_data;
 
@@ -225,7 +225,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, 
void *sense,
sense = info-sense_data;
 
/* stuff the sense request in front of our current request */
-   cdrom_prepare_request(drive, rq);
+   ide_cd_init_rq(drive, rq);
 
rq-data = sense;
rq-cmd[0] = GPCMD_REQUEST_SENSE;
@@ -1168,8 +1168,7 @@ static ide_startstop_t cdrom_do_packet_command 
(ide_drive_t *drive)
return cdrom_start_packet_command(drive, len, cdrom_do_pc_continuation);
 }
 
-
-static int cdrom_queue_packet_command(ide_drive_t *drive, struct request *rq)
+static int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
 {
struct request_sense sense;
int retries = 10;
@@ -1670,7 +1669,7 @@ static int cdrom_check_status(ide_drive_t *drive, struct 
request_sense *sense)
struct cdrom_info *info = drive-driver_data;
struct cdrom_device_info *cdi = info-devinfo;
 
-   cdrom_prepare_request(drive, req);
+   ide_cd_init_rq(drive, req);
 
req.sense = sense;
req.cmd[0] = GPCMD_TEST_UNIT_READY;
@@ -1682,13 +1681,12 @@ static int cdrom_check_status(ide_drive_t *drive, 
struct request_sense *sense)
 */
req.cmd[7] = cdi-sanyo_slot % 3;
 
-   return cdrom_queue_packet_command(drive, req);
+   return ide_cd_queue_pc(drive, req);
 }
 
-
 /* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */
-static int
-cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
+static int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
+  struct request_sense *sense)
 {
struct cdrom_info *cd = drive-driver_data;
struct request_sense my_sense;
@@ -1702,11 +1700,11 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct 
request_sense *sense)
if (cd-cd_flags  IDE_CD_FLAG_NO_DOORLOCK) {
stat = 0;
} else {
-   cdrom_prepare_request(drive, req);
+   ide_cd_init_rq(drive, req);
req.sense = sense;
req.cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
req.cmd[4] = lockflag ? 1 : 0;
-   stat = cdrom_queue_packet_command(drive, req);
+   stat = ide_cd_queue_pc(drive, req);
}
 
/* If we got an illegal field error, the drive
@@ -1752,7 +1750,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
if ((cd-cd_flags  IDE_CD_FLAG_DOOR_LOCKED)  ejectflag)
return 0;
 
-   cdrom_prepare_request(drive, req);
+   ide_cd_init_rq(drive, req);
 
/* only tell drive to close tray if open, if it can do that */
if (ejectflag  (cdi-mask  CDC_CLOSE_TRAY))
@@ -1761,7 +1759,8 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
req.sense = sense;
req.cmd[0] = GPCMD_START_STOP_UNIT;
req.cmd[4] = loej | (ejectflag != 0);
-   return cdrom_queue_packet_command(drive, req);
+
+   return ide_cd_queue_pc(drive, req);
 }
 
 static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
@@ -1776,7 +1775,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, 
unsigned long *capacity,
int stat;
struct request req;
 
-   cdrom_prepare_request(drive, req);
+   ide_cd_init_rq(drive, req);
 
req.sense = sense;
req.cmd[0] = GPCMD_READ_CDVD_CAPACITY;
@@ -1784,7 +1783,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, 
unsigned long

ide-cd: move code handling cdrom.c IOCTLs to ide-cd_ioctl.c

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=17802998d2c8007d06565c39101d218f579c4454
Commit: 17802998d2c8007d06565c39101d218f579c4454
Parent: 139c829d9d83cfd6b51682f11a431283121e24b7
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:25 2008 +0100

ide-cd: move code handling cdrom.c IOCTLs to ide-cd_ioctl.c

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/Makefile   |2 +-
 drivers/ide/ide-cd.c   |  271 +--
 drivers/ide/ide-cd.h   |   17 +++
 drivers/ide/ide-cd_ioctl.c |  265 +++
 4 files changed, 290 insertions(+), 265 deletions(-)

diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 5ce1d8f..a4a4323 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -40,7 +40,7 @@ obj-$(CONFIG_BLK_DEV_IDEPNP)  += ide-pnp.o
 obj-$(CONFIG_IDE_H8300)+= h8300/
 obj-$(CONFIG_IDE_GENERIC)  += ide-generic.o
 
-ide-cd_mod-y += ide-cd.o ide-cd_verbose.o
+ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o
 
 obj-$(CONFIG_BLK_DEV_IDEDISK)  += ide-disk.o
 obj-$(CONFIG_BLK_DEV_IDECD)+= ide-cd_mod.o
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index b82cabf..1032bec 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -206,7 +206,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 /*
  * Initialize a ide-cd packet command request
  */
-static void ide_cd_init_rq(ide_drive_t *drive, struct request *rq)
+void ide_cd_init_rq(ide_drive_t *drive, struct request *rq)
 {
struct cdrom_info *cd = drive-driver_data;
 
@@ -1168,7 +1168,7 @@ static ide_startstop_t cdrom_do_packet_command 
(ide_drive_t *drive)
return cdrom_start_packet_command(drive, len, cdrom_do_pc_continuation);
 }
 
-static int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
+int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
 {
struct request_sense sense;
int retries = 10;
@@ -1685,8 +1685,8 @@ static int cdrom_check_status(ide_drive_t *drive, struct 
request_sense *sense)
 }
 
 /* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */
-static int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
-  struct request_sense *sense)
+int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
+   struct request_sense *sense)
 {
struct cdrom_info *cd = drive-driver_data;
struct request_sense my_sense;
@@ -1817,9 +1817,8 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int 
trackno, int msf_flag,
return ide_cd_queue_pc(drive, req);
 }
 
-
 /* Try to read the entire TOC for the disk into our internal buffer. */
-static int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense)
+int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense)
 {
int stat, ntracks, i;
struct cdrom_info *info = drive-driver_data;
@@ -1979,112 +1978,6 @@ static int ide_cd_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
return 0;
 }
 
-static int ide_cd_read_tochdr(ide_drive_t *drive, void *arg)
-{
-   struct cdrom_info *cd = drive-driver_data;
-   struct cdrom_tochdr *tochdr = arg;
-   struct atapi_toc *toc;
-   int stat;
-
-   /* Make sure our saved TOC is valid. */
-   stat = ide_cd_read_toc(drive, NULL);
-   if (stat)
-   return stat;
-
-   toc = cd-toc;
-   tochdr-cdth_trk0 = toc-hdr.first_track;
-   tochdr-cdth_trk1 = toc-hdr.last_track;
-
-   return 0;
-}
-
-static int ide_cd_get_toc_entry(ide_drive_t *drive, int track,
-   struct atapi_toc_entry **ent)
-{
-   struct cdrom_info *info = drive-driver_data;
-   struct atapi_toc *toc = info-toc;
-   int ntracks;
-
-   /*
-* don't serve cached data, if the toc isn't valid
-*/
-   if ((info-cd_flags  IDE_CD_FLAG_TOC_VALID) == 0)
-   return -EINVAL;
-
-   /* Check validity of requested track number. */
-   ntracks = toc-hdr.last_track - toc-hdr.first_track + 1;
-
-   if (toc-hdr.first_track == CDROM_LEADOUT)
-   ntracks = 0;
-
-   if (track == CDROM_LEADOUT)
-   *ent = toc-ent[ntracks];
-   else if (track  toc-hdr.first_track || track  toc-hdr.last_track)
-   return -EINVAL;
-   else
-   *ent = toc-ent[track - toc-hdr.first_track];
-
-   return 0;
-}
-
-static int ide_cd_read_tocentry(ide_drive_t *drive, void *arg)
-{
-   struct cdrom_tocentry *tocentry = arg;
-   struct atapi_toc_entry *toce;
-   int stat;
-
-   stat = ide_cd_get_toc_entry(drive, tocentry

ide-cd: unify request end exit path in cdrom_pc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b67ebf6dae0b0743bad1641e9691a1205adbf9e
Commit: 8b67ebf6dae0b0743bad1641e9691a1205adbf9e
Parent: 8ee69f5a83660796ffa1d33e67d0064db44cfc23
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:25 2008 +0100

ide-cd: unify request end exit path in cdrom_pc_intr()

This is a preparation for cdrom_pc_intr() and cdrom_newpc_intr() merge.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   23 +++
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 7eb1aa6..6f698b4 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1066,7 +1066,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
 {
struct request *rq = HWGROUP(drive)-rq;
xfer_func_t *xferfunc = NULL;
-   int stat, ireason, len, thislen, write;
+   int stat, ireason, len, thislen, write, update;
u8 lowcyl = 0, highcyl = 0;
 
/* Check for errors. */
@@ -1084,14 +1084,8 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
   Complain if we still have data left to transfer. */
if ((stat  DRQ_STAT) == 0) {
ide_cd_request_sense_fixup(rq);
-
-   if (rq-data_len == 0)
-   cdrom_end_request(drive, 1);
-   else {
-   rq-cmd_flags |= REQ_FAILED;
-   cdrom_end_request(drive, 0);
-   }
-   return ide_stopped;
+   update = rq-data_len ? 0 : 1;
+   goto end_request;
}
 
/* Figure out how much data to transfer. */
@@ -1130,9 +1124,8 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
appears confused (ireason = 0x%02x). 
Trying to recover by ending request.\n,
drive-name, ireason);
-   rq-cmd_flags |= REQ_FAILED;
-   cdrom_end_request(drive, 0);
-   return ide_stopped;
+   update = 0;
+   goto end_request;
}
 pad:
/*
@@ -1145,6 +1138,12 @@ pad:
/* Now we wait for another interrupt. */
ide_set_handler(drive, cdrom_pc_intr, ATAPI_WAIT_PC, 
cdrom_timer_expiry);
return ide_started;
+
+end_request:
+   if (!update)
+   rq-cmd_flags |= REQ_FAILED;
+   cdrom_end_request(drive, update);
+   return ide_stopped;
 }
 
 static ide_startstop_t cdrom_do_pc_continuation (ide_drive_t *drive)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: call blk_dump_rq_flags() on missing data in cdrom_newpc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=03f537d50af7381317351396480411b3e00e6c7e
Commit: 03f537d50af7381317351396480411b3e00e6c7e
Parent: 98add71ee0af6dbf1496ac8007bcf253c4e23078
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:25 2008 +0100

ide-cd: call blk_dump_rq_flags() on missing data in cdrom_newpc_intr()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 448140b..44267fb 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1365,7 +1365,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
}
 
if (!ptr) {
-   printk(KERN_ERR %s: confused, missing data\n, 
drive-name);
+   printk(KERN_ERR %s: confused, missing data\n,
+   drive-name);
+   blk_dump_rq_flags(rq, rq_data_dir(rq)
+ ? cdrom_newpc_intr, write
+ : cdrom_newpc_intr, read);
break;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove BUG_ON() from cdrom_newpc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=98add71ee0af6dbf1496ac8007bcf253c4e23078
Commit: 98add71ee0af6dbf1496ac8007bcf253c4e23078
Parent: 17802998d2c8007d06565c39101d218f579c4454
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:25 2008 +0100

ide-cd: remove BUG_ON() from cdrom_newpc_intr()

There is no need for it anylonger and ide_set_handler() complains
if -handler is not NULL anyway.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 1032bec..448140b 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1397,8 +1397,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
if (len  0)
ide_cd_pad_transfer(drive, xferfunc, len);
 
-   BUG_ON(HWGROUP(drive)-handler != NULL);
-
ide_set_handler(drive, cdrom_newpc_intr, rq-timeout, NULL);
return ide_started;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: factor out request sense fixup from cdrom_pc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8ee69f5a83660796ffa1d33e67d0064db44cfc23
Commit: 8ee69f5a83660796ffa1d33e67d0064db44cfc23
Parent: 03f537d50af7381317351396480411b3e00e6c7e
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:25 2008 +0100

ide-cd: factor out request sense fixup from cdrom_pc_intr()

This is a preparation for cdrom_pc_intr() and cdrom_newpc_intr() merge.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   25 +++--
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 44267fb..7eb1aa6 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1047,6 +1047,20 @@ static ide_startstop_t cdrom_start_read (ide_drive_t 
*drive, unsigned int block)
  * Execute all other packet commands.
  */
 
+static void ide_cd_request_sense_fixup(struct request *rq)
+{
+   /*
+* Some of the trailing request sense fields are optional,
+* and some drives don't send them.  Sigh.
+*/
+   if (rq-cmd[0] == GPCMD_REQUEST_SENSE 
+   rq-data_len  0  rq-data_len = 5)
+   while (rq-data_len  0) {
+   *(u8 *)rq-data++ = 0;
+   --rq-data_len;
+   }
+}
+
 /* Interrupt routine for packet command completion. */
 static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
 {
@@ -1069,16 +1083,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
/* If DRQ is clear, the command has completed.
   Complain if we still have data left to transfer. */
if ((stat  DRQ_STAT) == 0) {
-   /* Some of the trailing request sense fields are optional, and
-  some drives don't send them.  Sigh. */
-   if (rq-cmd[0] == GPCMD_REQUEST_SENSE 
-   rq-data_len  0 
-   rq-data_len = 5) {
-   while (rq-data_len  0) {
-   *(unsigned char *)rq-data++ = 0;
-   --rq-data_len;
-   }
-   }
+   ide_cd_request_sense_fixup(rq);
 
if (rq-data_len == 0)
cdrom_end_request(drive, 1);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: merge cdrom_pc_intr() and cdrom_newpc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ff1bfbc1f02f7c293a03a64722291c539deb162c
Commit: ff1bfbc1f02f7c293a03a64722291c539deb162c
Parent: 8b67ebf6dae0b0743bad1641e9691a1205adbf9e
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:25 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:25 2008 +0100

ide-cd: merge cdrom_pc_intr() and cdrom_newpc_intr()

Add handling of REQ_TYPE_{SENSE,ATA_PC} requests to cdrom_newpc_intr()
(please note that these requests never have 'bio' attached to them
and they never use DMA), then remove no longer needed cdrom_pc_intr().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  171 +-
 1 files changed, 58 insertions(+), 113 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6f698b4..97d0c13 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1061,90 +1061,7 @@ static void ide_cd_request_sense_fixup(struct request 
*rq)
}
 }
 
-/* Interrupt routine for packet command completion. */
-static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
-{
-   struct request *rq = HWGROUP(drive)-rq;
-   xfer_func_t *xferfunc = NULL;
-   int stat, ireason, len, thislen, write, update;
-   u8 lowcyl = 0, highcyl = 0;
-
-   /* Check for errors. */
-   if (cdrom_decode_status(drive, 0, stat))
-   return ide_stopped;
-
-   /* Read the interrupt reason and the transfer length. */
-   ireason = HWIF(drive)-INB(IDE_IREASON_REG)  0x3;
-   lowcyl  = HWIF(drive)-INB(IDE_BCOUNTL_REG);
-   highcyl = HWIF(drive)-INB(IDE_BCOUNTH_REG);
-
-   len = lowcyl + (256 * highcyl);
-
-   /* If DRQ is clear, the command has completed.
-  Complain if we still have data left to transfer. */
-   if ((stat  DRQ_STAT) == 0) {
-   ide_cd_request_sense_fixup(rq);
-   update = rq-data_len ? 0 : 1;
-   goto end_request;
-   }
-
-   /* Figure out how much data to transfer. */
-   thislen = rq-data_len;
-   if (thislen  len)
-   thislen = len;
-
-   if (ireason == 0) {
-   write = 1;
-   xferfunc = HWIF(drive)-atapi_output_bytes;
-   } else if (ireason == 2) {
-   write = 0;
-   xferfunc = HWIF(drive)-atapi_input_bytes;
-   }
-
-   if (xferfunc) {
-   if (!rq-data) {
-   printk(KERN_ERR %s: confused, missing data\n,
-   drive-name);
-   blk_dump_rq_flags(rq, write ? cdrom_pc_intr, write
-   : cdrom_pc_intr, read);
-   goto pad;
-   }
-   /* Transfer the data. */
-   xferfunc(drive, rq-data, thislen);
-
-   /* Keep count of how much data we've moved. */
-   len -= thislen;
-   rq-data += thislen;
-   rq-data_len -= thislen;
-
-   if (write  blk_sense_request(rq))
-   rq-sense_len += thislen;
-   } else {
-   printk (KERN_ERR %s: cdrom_pc_intr: The drive 
-   appears confused (ireason = 0x%02x). 
-   Trying to recover by ending request.\n,
-   drive-name, ireason);
-   update = 0;
-   goto end_request;
-   }
-pad:
-   /*
-* If we haven't moved enough data to satisfy the drive,
-* add some padding.
-*/
-   if (len  0)
-   ide_cd_pad_transfer(drive, xferfunc, len);
-
-   /* Now we wait for another interrupt. */
-   ide_set_handler(drive, cdrom_pc_intr, ATAPI_WAIT_PC, 
cdrom_timer_expiry);
-   return ide_started;
-
-end_request:
-   if (!update)
-   rq-cmd_flags |= REQ_FAILED;
-   cdrom_end_request(drive, update);
-   return ide_stopped;
-}
+static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);
 
 static ide_startstop_t cdrom_do_pc_continuation (ide_drive_t *drive)
 {
@@ -1154,10 +1071,9 @@ static ide_startstop_t cdrom_do_pc_continuation 
(ide_drive_t *drive)
rq-timeout = ATAPI_WAIT_PC;
 
/* Send the command to the drive and return. */
-   return cdrom_transfer_packet_command(drive, rq, cdrom_pc_intr);
+   return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);
 }
 
-
 static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
 {
int len;
@@ -1263,27 +1179,27 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
 /*
  * best way to deal with dma that is not sector aligned right now... note
  * that in this path we are not using -data or -buffer at all

ide-cd: remove cdrom_do_pc_continuation()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a7c7d16383748029de8187075cabbc3f5df2cd78
Commit: a7c7d16383748029de8187075cabbc3f5df2cd78
Parent: ff1bfbc1f02f7c293a03a64722291c539deb162c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:26 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:26 2008 +0100

ide-cd: remove cdrom_do_pc_continuation()

cdrom_do_pc_continuation() is now identical to cdrom_do_newpc_cont()
so just always use the latter function.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   15 ++-
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 97d0c13..328d26c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1061,18 +1061,7 @@ static void ide_cd_request_sense_fixup(struct request 
*rq)
}
 }
 
-static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);
-
-static ide_startstop_t cdrom_do_pc_continuation (ide_drive_t *drive)
-{
-   struct request *rq = HWGROUP(drive)-rq;
-
-   if (!rq-timeout)
-   rq-timeout = ATAPI_WAIT_PC;
-
-   /* Send the command to the drive and return. */
-   return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);
-}
+static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *);
 
 static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
 {
@@ -1085,7 +1074,7 @@ static ide_startstop_t cdrom_do_packet_command 
(ide_drive_t *drive)
len = rq-data_len;
 
/* Start sending the command to the drive. */
-   return cdrom_start_packet_command(drive, len, cdrom_do_pc_continuation);
+   return cdrom_start_packet_command(drive, len, cdrom_do_newpc_cont);
 }
 
 int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: merge cdrom_do_packet_command() and cdrom_do_block_pc()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9f56a801a3a9d76119868a687bc220d29055625
Commit: c9f56a801a3a9d76119868a687bc220d29055625
Parent: a7c7d16383748029de8187075cabbc3f5df2cd78
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:26 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:26 2008 +0100

ide-cd: merge cdrom_do_packet_command() and cdrom_do_block_pc()

Add REQ_TYPE_{SENSE,ATA_PC} requests handling to cdrom_do_block_pc()
and remove cdrom_do_packet_command().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   25 +
 1 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 328d26c..6c31ce1 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1061,22 +1061,6 @@ static void ide_cd_request_sense_fixup(struct request 
*rq)
}
 }
 
-static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *);
-
-static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
-{
-   int len;
-   struct request *rq = HWGROUP(drive)-rq;
-   struct cdrom_info *info = drive-driver_data;
-
-   info-dma = 0;
-   rq-cmd_flags = ~REQ_FAILED;
-   len = rq-data_len;
-
-   /* Start sending the command to the drive. */
-   return cdrom_start_packet_command(drive, len, cdrom_do_newpc_cont);
-}
-
 int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
 {
struct request_sense sense;
@@ -1505,7 +1489,10 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t 
*drive, struct request *rq)
 {
struct cdrom_info *info = drive-driver_data;
 
-   rq-cmd_flags |= REQ_QUIET;
+   if (blk_pc_request(rq))
+   rq-cmd_flags |= REQ_QUIET;
+   else
+   rq-cmd_flags = ~REQ_FAILED;
 
info-dma = 0;
 
@@ -1565,10 +1552,8 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, 
sector_t block)
}
info-last_block = block;
return action;
-   } else if (rq-cmd_type == REQ_TYPE_SENSE ||
+   } else if (blk_sense_request(rq) || blk_pc_request(rq) ||
   rq-cmd_type == REQ_TYPE_ATA_PC) {
-   return cdrom_do_packet_command(drive);
-   } else if (blk_pc_request(rq)) {
return cdrom_do_block_pc(drive, rq);
} else if (blk_special_request(rq)) {
/*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: add ide_cd_drain_data() helper

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b4ab726c92f8a2c1635958212e8933309de0a37a
Commit: b4ab726c92f8a2c1635958212e8933309de0a37a
Parent: c9f56a801a3a9d76119868a687bc220d29055625
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:26 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:26 2008 +0100

ide-cd: add ide_cd_drain_data() helper

Add ide_cd_drain_data() and use it in cdrom_{buffer_sectors,read_intr}()
(as a nice side-effect this cuts 0.5kB of code from ide-cd.o).

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   28 +++-
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6c31ce1..f0191f0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -626,6 +626,16 @@ static void ide_cd_pad_transfer(ide_drive_t *drive, 
xfer_func_t *xf, int len)
}
 }
 
+static void ide_cd_drain_data(ide_drive_t *drive, int nsects)
+{
+   while (nsects  0) {
+   static char dum[SECTOR_SIZE];
+
+   drive-hwif-atapi_input_bytes(drive, dum, sizeof(dum));
+   nsects--;
+   }
+}
+
 /*
  * Buffer up to SECTORS_TO_TRANSFER sectors from the drive in our sector
  * buffer.  Once the first sector is added, any subsequent sectors are
@@ -664,11 +674,7 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, 
unsigned long sector,
}
 
/* Throw away any remaining data. */
-   while (sectors_to_transfer  0) {
-   static char dum[SECTOR_SIZE];
-   HWIF(drive)-atapi_input_bytes(drive, dum, sizeof (dum));
-   --sectors_to_transfer;
-   }
+   ide_cd_drain_data(drive, sectors_to_transfer);
 }
 
 /*
@@ -791,14 +797,10 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t 
*drive)
   any of the leading sectors. */
nskip = min_t(int, rq-current_nr_sectors - bio_cur_sectors(rq-bio), 
sectors_to_transfer);
 
-   while (nskip  0) {
-   /* We need to throw away a sector. */
-   static char dum[SECTOR_SIZE];
-   HWIF(drive)-atapi_input_bytes(drive, dum, sizeof (dum));
-
-   --rq-current_nr_sectors;
-   --nskip;
-   --sectors_to_transfer;
+   if (nskip  0) {
+   ide_cd_drain_data(drive, nskip);
+   rq-current_nr_sectors -= nskip;
+   sectors_to_transfer -= nskip;
}
 
/* Now loop while we still have data to read from the drive. */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: factor out transfer size checking from cdrom_read_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=64814f2399e7dd1e6e53dd7d08a4ad54d02665d3
Commit: 64814f2399e7dd1e6e53dd7d08a4ad54d02665d3
Parent: b4ab726c92f8a2c1635958212e8933309de0a37a
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:26 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:26 2008 +0100

ide-cd: factor out transfer size checking from cdrom_read_intr()

This is a preparation for cdrom_read_intr() and cdrom_write_intr() merge.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   38 ++
 1 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f0191f0..2e0c933 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -714,6 +714,31 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, 
int ireason)
 }
 
 /*
+ * Assume that the drive will always provide data in multiples of at least
+ * SECTOR_SIZE, as it gets hairy to keep track of the transfers otherwise.
+ */
+static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)
+{
+   struct cdrom_info *cd = drive-driver_data;
+
+   if ((len % SECTOR_SIZE) == 0)
+   return 0;
+
+   printk(KERN_ERR %s: %s: Bad transfer size %d\n,
+   drive-name, __FUNCTION__, len);
+
+   if (cd-cd_flags  IDE_CD_FLAG_LIMIT_NFRAMES)
+   printk(KERN_ERR   This drive is not supported by 
+   this version of the driver\n);
+   else {
+   printk(KERN_ERR   Trying to limit transfer sizes\n);
+   cd-cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
+   }
+
+   return 1;
+}
+
+/*
  * Interrupt routine.  Called when a read request has completed.
  */
 static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
@@ -774,18 +799,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
if (cdrom_read_check_ireason (drive, len, ireason))
return ide_stopped;
 
-   /* Assume that the drive will always provide data in multiples
-  of at least SECTOR_SIZE, as it gets hairy to keep track
-  of the transfers otherwise. */
-   if ((len % SECTOR_SIZE) != 0) {
-   printk (KERN_ERR %s: cdrom_read_intr: Bad transfer size %d\n,
-   drive-name, len);
-   if (info-cd_flags  IDE_CD_FLAG_LIMIT_NFRAMES)
-   printk (KERN_ERR   This drive is not supported by this 
version of the driver\n);
-   else {
-   printk (KERN_ERR   Trying to limit transfer sizes\n);
-   info-cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES;
-   }
+   if (ide_cd_check_transfer_size(drive, len)) {
cdrom_end_request(drive, 0);
return ide_stopped;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: merge cdrom_read_intr() and cdrom_write_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=94f5a86dc37c66b9ec0d7426a7518740fa41d871
Commit: 94f5a86dc37c66b9ec0d7426a7518740fa41d871
Parent: 64814f2399e7dd1e6e53dd7d08a4ad54d02665d3
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:26 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:26 2008 +0100

ide-cd: merge cdrom_read_intr() and cdrom_write_intr()

Add handling of read requests to cdrom_write_intr(), rename it
to cdrom_rw_intr() and remove no longer needed cdrom_read_intr().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  207 +-
 1 files changed, 69 insertions(+), 138 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 2e0c933..5839761 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -739,125 +739,6 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, 
int len)
 }
 
 /*
- * Interrupt routine.  Called when a read request has completed.
- */
-static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
-{
-   int stat;
-   int ireason, len, sectors_to_transfer, nskip;
-   struct cdrom_info *info = drive-driver_data;
-   u8 lowcyl = 0, highcyl = 0;
-   int dma = info-dma, dma_error = 0;
-
-   struct request *rq = HWGROUP(drive)-rq;
-
-   /*
-* handle dma case
-*/
-   if (dma) {
-   info-dma = 0;
-   dma_error = HWIF(drive)-ide_dma_end(drive);
-   if (dma_error) {
-   printk(KERN_ERR %s: DMA read error\n, drive-name);
-   ide_dma_off(drive);
-   }
-   }
-
-   if (cdrom_decode_status(drive, 0, stat))
-   return ide_stopped;
-
-   if (dma) {
-   if (!dma_error) {
-   ide_end_request(drive, 1, rq-nr_sectors);
-   return ide_stopped;
-   } else
-   return ide_error(drive, dma error, stat);
-   }
-
-   /* Read the interrupt reason and the transfer length. */
-   ireason = HWIF(drive)-INB(IDE_IREASON_REG)  0x3;
-   lowcyl  = HWIF(drive)-INB(IDE_BCOUNTL_REG);
-   highcyl = HWIF(drive)-INB(IDE_BCOUNTH_REG);
-
-   len = lowcyl + (256 * highcyl);
-
-   /* If DRQ is clear, the command has completed. */
-   if ((stat  DRQ_STAT) == 0) {
-   /* If we're not done filling the current buffer, complain.
-  Otherwise, complete the command normally. */
-   if (rq-current_nr_sectors  0) {
-   printk (KERN_ERR %s: cdrom_read_intr: data underrun 
(%d blocks)\n,
-   drive-name, rq-current_nr_sectors);
-   rq-cmd_flags |= REQ_FAILED;
-   cdrom_end_request(drive, 0);
-   } else
-   cdrom_end_request(drive, 1);
-   return ide_stopped;
-   }
-
-   /* Check that the drive is expecting to do the same thing we are. */
-   if (cdrom_read_check_ireason (drive, len, ireason))
-   return ide_stopped;
-
-   if (ide_cd_check_transfer_size(drive, len)) {
-   cdrom_end_request(drive, 0);
-   return ide_stopped;
-   }
-
-   /* The number of sectors we need to read from the drive. */
-   sectors_to_transfer = len / SECTOR_SIZE;
-
-   /* First, figure out if we need to bit-bucket
-  any of the leading sectors. */
-   nskip = min_t(int, rq-current_nr_sectors - bio_cur_sectors(rq-bio), 
sectors_to_transfer);
-
-   if (nskip  0) {
-   ide_cd_drain_data(drive, nskip);
-   rq-current_nr_sectors -= nskip;
-   sectors_to_transfer -= nskip;
-   }
-
-   /* Now loop while we still have data to read from the drive. */
-   while (sectors_to_transfer  0) {
-   int this_transfer;
-
-   /* If we've filled the present buffer but there's another
-  chained buffer after it, move on. */
-   if (rq-current_nr_sectors == 0  rq-nr_sectors)
-   cdrom_end_request(drive, 1);
-
-   /* If the buffers are full, cache the rest of the data in our
-  internal buffer. */
-   if (rq-current_nr_sectors == 0) {
-   cdrom_buffer_sectors(drive, rq-sector, 
sectors_to_transfer);
-   sectors_to_transfer = 0;
-   } else {
-   /* Transfer data to the buffers.
-  Figure out how many sectors we can transfer
-  to the current buffer. */
-   this_transfer = min_t(int, sectors_to_transfer

ide-cd: merge cdrom_start_read_continuation() and cdrom_start_rw_cont()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=29f3aaca3c134d14309f6b0254edcfce54a0b00c
Commit: 29f3aaca3c134d14309f6b0254edcfce54a0b00c
Parent: 94f5a86dc37c66b9ec0d7426a7518740fa41d871
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:27 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:27 2008 +0100

ide-cd: merge cdrom_start_read_continuation() and cdrom_start_rw_cont()

* Add handling of write requests to cdrom_start_read_continuation(),
  rename it to cdrom_start_rw_cont() and remove no longer needed
  cdrom_start_write_cont().

* Remove redundant '(rq-sector  (sectors_per_frame - 1)' check.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   74 +++--
 1 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 5839761..edcdc74 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -800,39 +800,48 @@ static int cdrom_read_from_buffer (ide_drive_t *drive)
 static ide_startstop_t cdrom_rw_intr(ide_drive_t *);
 
 /*
- * Routine to send a read packet command to the drive.
- * This is usually called directly from cdrom_start_read.
+ * Routine to send a read/write packet command to the drive.
+ * This is usually called directly from cdrom_start_{read,write}().
  * However, for drq_interrupt devices, it is called from an interrupt
  * when the drive is ready to accept the command.
  */
-static ide_startstop_t cdrom_start_read_continuation (ide_drive_t *drive)
+static ide_startstop_t cdrom_start_rw_cont(ide_drive_t *drive)
 {
struct request *rq = HWGROUP(drive)-rq;
-   unsigned short sectors_per_frame;
-   int nskip;
 
-   sectors_per_frame = queue_hardsect_size(drive-queue)  SECTOR_BITS;
+   if (rq_data_dir(rq) == READ) {
+   unsigned short sectors_per_frame =
+   queue_hardsect_size(drive-queue)  SECTOR_BITS;
+   int nskip = rq-sector  (sectors_per_frame - 1);
 
-   /* If the requested sector doesn't start on a cdrom block boundary,
-  we must adjust the start of the transfer so that it does,
-  and remember to skip the first few sectors.
-  If the CURRENT_NR_SECTORS field is larger than the size
-  of the buffer, it will mean that we're to skip a number
-  of sectors equal to the amount by which CURRENT_NR_SECTORS
-  is larger than the buffer size. */
-   nskip = rq-sector  (sectors_per_frame - 1);
-   if (nskip  0) {
-   /* Sanity check... */
-   if (rq-current_nr_sectors != bio_cur_sectors(rq-bio) 
-   (rq-sector  (sectors_per_frame - 1))) {
-   printk(KERN_ERR %s: cdrom_start_read_continuation: 
buffer botch (%u)\n,
-   drive-name, rq-current_nr_sectors);
-   cdrom_end_request(drive, 0);
-   return ide_stopped;
+   /*
+* If the requested sector doesn't start on a frame boundary,
+* we must adjust the start of the transfer so that it does,
+* and remember to skip the first few sectors.
+*
+* If the rq-current_nr_sectors field is larger than the size
+* of the buffer, it will mean that we're to skip a number of
+* sectors equal to the amount by which rq-current_nr_sectors
+* is larger than the buffer size.
+*/
+   if (nskip  0) {
+   /* Sanity check... */
+   if (rq-current_nr_sectors !=
+   bio_cur_sectors(rq-bio)) {
+   printk(KERN_ERR %s: %s: buffer botch (%u)\n,
+   drive-name, __FUNCTION__,
+   rq-current_nr_sectors);
+   cdrom_end_request(drive, 0);
+   return ide_stopped;
+   }
+   rq-current_nr_sectors += nskip;
}
-   rq-current_nr_sectors += nskip;
}
-
+#if 0
+   else
+   /* the immediate bit */
+   rq-cmd[1] = 1  3;
+#endif
/* Set up the command */
rq-timeout = ATAPI_WAIT_PC;
 
@@ -840,7 +849,6 @@ static ide_startstop_t cdrom_start_read_continuation 
(ide_drive_t *drive)
return cdrom_transfer_packet_command(drive, rq, cdrom_rw_intr);
 }
 
-
 #define IDECD_SEEK_THRESHOLD   (1000)  /* 1000 blocks */
 #define IDECD_SEEK_TIMER   (5 * WAIT_MIN_SLEEP)/* 100 ms */
 #define IDECD_SEEK_TIMEOUT (2 * WAIT_CMD

ide-cd: merge cdrom_start_read() and cdrom_start_write()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21ea1f0f011a5bbfbc3f5c134a4e537e5f5c1c50
Commit: 21ea1f0f011a5bbfbc3f5c134a4e537e5f5c1c50
Parent: 29f3aaca3c134d14309f6b0254edcfce54a0b00c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:27 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:27 2008 +0100

ide-cd: merge cdrom_start_read() and cdrom_start_write()

Add handling of read requests to cdrom_start_write(), rename it
to cdrom_start_rw() and remove no longer needed cdrom_start_read().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  101 --
 1 files changed, 40 insertions(+), 61 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index edcdc74..4b395e0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -918,38 +918,6 @@ static void restore_request (struct request *rq)
rq-q-prep_rq_fn(rq-q, rq);
 }
 
-/*
- * Start a read request from the CD-ROM.
- */
-static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int 
block)
-{
-   struct cdrom_info *info = drive-driver_data;
-   struct request *rq = HWGROUP(drive)-rq;
-   unsigned short sectors_per_frame;
-
-   sectors_per_frame = queue_hardsect_size(drive-queue)  SECTOR_BITS;
-
-   /* We may be retrying this request after an error.  Fix up
-  any weirdness which might be present in the request packet. */
-   restore_request(rq);
-
-   /* Satisfy whatever we can of this request from our cached sector. */
-   if (cdrom_read_from_buffer(drive))
-   return ide_stopped;
-
-   /* Clear the local sector buffer. */
-   info-nsectors_buffered = 0;
-
-   /* use dma, if possible. */
-   info-dma = drive-using_dma;
-   if ((rq-sector  (sectors_per_frame - 1)) ||
-   (rq-nr_sectors  (sectors_per_frame - 1)))
-   info-dma = 0;
-
-   /* Start sending the read request to the drive. */
-   return cdrom_start_packet_command(drive, 32768, cdrom_start_rw_cont);
-}
-
 /
  * Execute all other packet commands.
  */
@@ -1383,38 +1351,53 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
return ide_started;
 }
 
-static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request 
*rq)
+static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
 {
-   struct cdrom_info *info = drive-driver_data;
-   struct gendisk *g = info-disk;
-   unsigned short sectors_per_frame = queue_hardsect_size(drive-queue)  
SECTOR_BITS;
+   struct cdrom_info *cd = drive-driver_data;
+   int write = rq_data_dir(rq) == WRITE;
+   unsigned short sectors_per_frame =
+   queue_hardsect_size(drive-queue)  SECTOR_BITS;
 
-   /*
-* writes *must* be hardware frame aligned
-*/
-   if ((rq-nr_sectors  (sectors_per_frame - 1)) ||
-   (rq-sector  (sectors_per_frame - 1))) {
-   cdrom_end_request(drive, 0);
-   return ide_stopped;
+   if (write) {
+   /*
+* disk has become write protected
+*/
+   if (cd-disk-policy) {
+   cdrom_end_request(drive, 0);
+   return ide_stopped;
+   }
+   } else {
+   /*
+* We may be retrying this request after an error.  Fix up any
+* weirdness which might be present in the request packet.
+*/
+   restore_request(rq);
+
+   /* Satisfy whatever we can of this request from our cache. */
+   if (cdrom_read_from_buffer(drive))
+   return ide_stopped;
}
 
/*
-* disk has become write protected
+* use DMA, if possible / writes *must* be hardware frame aligned
 */
-   if (g-policy) {
-   cdrom_end_request(drive, 0);
-   return ide_stopped;
-   }
-
-   info-nsectors_buffered = 0;
+   if ((rq-nr_sectors  (sectors_per_frame - 1)) ||
+   (rq-sector  (sectors_per_frame - 1))) {
+   if (write) {
+   cdrom_end_request(drive, 0);
+   return ide_stopped;
+   }
+   cd-dma = 0;
+   } else
+   cd-dma = drive-using_dma;
 
-   /* use dma, if possible. we don't need to check more, since we
-* know that the transfer is always (at least!) frame aligned */
-   info-dma = drive-using_dma ? 1 : 0;
+   /* Clear the local sector buffer. */
+   cd-nsectors_buffered = 0;
 
-   info-devinfo.media_written = 1

ide-cd: unify moving to the next buffer in cdrom_rw_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=37782fcefcca437f870e581e6cc316111f8b7660
Commit: 37782fcefcca437f870e581e6cc316111f8b7660
Parent: 21ea1f0f011a5bbfbc3f5c134a4e537e5f5c1c50
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:27 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:27 2008 +0100

ide-cd: unify moving to the next buffer in cdrom_rw_intr()

Use the fact that for the first loop rq-current_nr_sectors is always
set and unify moving to the next buffer for read/write requests.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 4b395e0..0f17117 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1302,13 +1302,6 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
while (sectors_to_transfer  0) {
int this_transfer;
 
-   /*
-* If we've filled the present buffer but there's another
-* chained buffer after it, move on.
-*/
-   if (!write  rq-current_nr_sectors == 0  rq-nr_sectors)
-   cdrom_end_request(drive, 1);
-
if (!rq-current_nr_sectors) {
if (!write)
/*
@@ -1342,7 +1335,7 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
/*
 * current buffer complete, move on
 */
-   if (write  rq-current_nr_sectors == 0  rq-nr_sectors)
+   if (rq-current_nr_sectors == 0  rq-nr_sectors)
cdrom_end_request(drive, 1);
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: prepare cdrom_rw_intr() and cdrom_newpc_intr() to be merged

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a11e77db4982d44bf610dc7257b0fca3f7202403
Commit: a11e77db4982d44bf610dc7257b0fca3f7202403
Parent: 37782fcefcca437f870e581e6cc316111f8b7660
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:27 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:27 2008 +0100

ide-cd: prepare cdrom_rw_intr() and cdrom_newpc_intr() to be merged

In cdrom_newpc_intr():
* cleanup variables in the 'transfer data' loop

In cdrom_rw_intr():
* rename 'sectors_to_transfer' to 'thislen'
* rename 'this_transfer' to 'blen'
* keep number of bytes (instead of sectors) in 'thislen' and 'blen'
* call 'xferfunc' only once for 'blen'
* cache 'rq-buffer' in 'ptr' variable
* check for 'rq-bio' before setting 'ptr' and 'blen'
* check for 'ptr' instead of 'rq-current_nr_sectors'

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   47 ++-
 1 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0f17117..2a520bd 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1123,8 +1123,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 * transfer data
 */
while (thislen  0) {
-   int blen = blen = rq-data_len;
-   char *ptr = rq-data;
+   u8 *ptr = rq-data;
+   int blen = rq-data_len;
 
/*
 * bio backed?
@@ -1207,7 +1207,7 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
struct cdrom_info *info = drive-driver_data;
struct request *rq = HWGROUP(drive)-rq;
xfer_func_t *xferfunc;
-   int stat, ireason, len, sectors_to_transfer, uptodate, nskip;
+   int stat, ireason, len, thislen, uptodate, nskip;
int dma_error = 0, dma = info-dma, write = rq_data_dir(rq) == WRITE;
u8 lowcyl = 0, highcyl = 0;
 
@@ -1262,7 +1262,7 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
return ide_stopped;
}
 
-   sectors_to_transfer = len / SECTOR_SIZE;
+   thislen = len;
 
/* Check that the drive is expecting to do the same thing we are. */
if (write) {
@@ -1285,12 +1285,12 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
 */
nskip = min_t(int, rq-current_nr_sectors
   - bio_cur_sectors(rq-bio),
-  sectors_to_transfer);
+  thislen  9);
 
if (nskip  0) {
ide_cd_drain_data(drive, nskip);
rq-current_nr_sectors -= nskip;
-   sectors_to_transfer -= nskip;
+   thislen -= (nskip  9);
}
 
xferfunc = HWIF(drive)-atapi_input_bytes;
@@ -1299,17 +1299,23 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
/*
 * now loop and read/write the data
 */
-   while (sectors_to_transfer  0) {
-   int this_transfer;
+   while (thislen  0) {
+   u8 *ptr = NULL;
+   int blen;
+
+   if (rq-bio) {
+   ptr = rq-buffer;
+   blen = rq-current_nr_sectors  9;
+   }
 
-   if (!rq-current_nr_sectors) {
+   if (!ptr) {
if (!write)
/*
 * If the buffers are full, cache the rest
 * of the data in our internal buffer.
 */
cdrom_buffer_sectors(drive, rq-sector,
-sectors_to_transfer);
+thislen  9);
else
printk(KERN_ERR %s: %s: confused, missing 
data\n,
@@ -1320,17 +1326,16 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
/*
 * Figure out how many sectors we can transfer
 */
-   this_transfer = min_t(int, sectors_to_transfer, 
rq-current_nr_sectors);
-
-   while (this_transfer  0) {
-   xferfunc(drive, rq-buffer, SECTOR_SIZE);
-   rq-buffer += SECTOR_SIZE;
-   --rq-nr_sectors;
-   --rq-current_nr_sectors;
-   ++rq-sector;
-   --this_transfer;
-   --sectors_to_transfer

ide-cd: call blk_dump_rq_flags() on missing data in cdrom_rw_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=48ea0b216ba96d14228ee0cb4c964b3b495ff0a8
Commit: 48ea0b216ba96d14228ee0cb4c964b3b495ff0a8
Parent: a11e77db4982d44bf610dc7257b0fca3f7202403
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:27 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:27 2008 +0100

ide-cd: call blk_dump_rq_flags() on missing data in cdrom_rw_intr()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 2a520bd..53af68e 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1316,10 +1316,12 @@ static ide_startstop_t cdrom_rw_intr(ide_drive_t *drive)
 */
cdrom_buffer_sectors(drive, rq-sector,
 thislen  9);
-   else
+   else {
printk(KERN_ERR %s: %s: confused, missing 
data\n,
drive-name, __FUNCTION__);
+   blk_dump_rq_flags(rq, cdrom_rw_intr, write);
+   }
break;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: merge cdrom_rw_intr() and cdrom_newpc_intr()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0041e7c6ca9719309bef6a4754e4eb9566b37ae1
Commit: 0041e7c6ca9719309bef6a4754e4eb9566b37ae1
Parent: 48ea0b216ba96d14228ee0cb4c964b3b495ff0a8
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:28 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:28 2008 +0100

ide-cd: merge cdrom_rw_intr() and cdrom_newpc_intr()

Add handling of fs read/write requests to cdrom_nepwc_intr()
and remove no longer needed cdrom_rw_intr().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |  272 +-
 1 files changed, 94 insertions(+), 178 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 53af68e..50f78eb 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -797,7 +797,7 @@ static int cdrom_read_from_buffer (ide_drive_t *drive)
return 0;
 }
 
-static ide_startstop_t cdrom_rw_intr(ide_drive_t *);
+static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);
 
 /*
  * Routine to send a read/write packet command to the drive.
@@ -846,7 +846,7 @@ static ide_startstop_t cdrom_start_rw_cont(ide_drive_t 
*drive)
rq-timeout = ATAPI_WAIT_PC;
 
/* Send the command to the drive and return. */
-   return cdrom_transfer_packet_command(drive, rq, cdrom_rw_intr);
+   return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr);
 }
 
 #define IDECD_SEEK_THRESHOLD   (1000)  /* 1000 blocks */
@@ -1024,17 +1024,12 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
return 1;
 }
 
-/*
- * best way to deal with dma that is not sector aligned right now... note
- * that in this path we are not using -data or -buffer at all. this irs
- * can replace cdrom_rw_intr() in the future.
- */
 static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
 {
struct cdrom_info *info = drive-driver_data;
struct request *rq = HWGROUP(drive)-rq;
xfer_func_t *xferfunc;
-   ide_expiry_t *expiry;
+   ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, stat, ireason, len, thislen, uptodate = 0;
int write = (rq_data_dir(rq) == WRITE) ? 1 : 0;
unsigned int timeout;
@@ -1061,6 +1056,10 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
if (dma) {
if (dma_error)
return ide_error(drive, dma error, stat);
+   if (blk_fs_request(rq)) {
+   ide_end_request(drive, 1, rq-nr_sectors);
+   return ide_stopped;
+   }
goto end_request;
}
 
@@ -1072,7 +1071,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
highcyl = HWIF(drive)-INB(IDE_BCOUNTH_REG);
 
len = lowcyl + (256 * highcyl);
-   thislen = rq-data_len;
+
+   thislen = blk_fs_request(rq) ? len : rq-data_len;
if (thislen  len)
thislen = len;
 
@@ -1080,7 +1080,24 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 * If DRQ is clear, the command has completed.
 */
if ((stat  DRQ_STAT) == 0) {
-   if (!blk_pc_request(rq)) {
+   if (blk_fs_request(rq)) {
+   /*
+* If we're not done reading/writing, complain.
+* Otherwise, complete the command normally.
+*/
+   uptodate = 1;
+   if (rq-current_nr_sectors  0) {
+   printk(KERN_ERR %s: %s: data underrun 
+   (%d blocks)\n,
+   drive-name, __FUNCTION__,
+   rq-current_nr_sectors);
+   if (!write)
+   rq-cmd_flags |= REQ_FAILED;
+   uptodate = 0;
+   }
+   cdrom_end_request(drive, uptodate);
+   return ide_stopped;
+   } else if (!blk_pc_request(rq)) {
ide_cd_request_sense_fixup(rq);
/* Complain if we still have data left to transfer. */
uptodate = rq-data_len ? 0 : 1;
@@ -1091,24 +1108,47 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
/*
 * check which way to transfer data
 */
-   if (blk_pc_request(rq)  rq_data_dir(rq) == WRITE) {
+   if ((blk_fs_request(rq) || blk_pc_request(rq))  write) {
/*
 * write to drive
 */
if (cdrom_write_check_ireason(drive, len, ireason

ide-cd: merge cdrom_write_check_ireason() and cdrom_read_check_ireason()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0d6f7e3a1845165b81adab3fc5fd13916f22aa61
Commit: 0d6f7e3a1845165b81adab3fc5fd13916f22aa61
Parent: 0041e7c6ca9719309bef6a4754e4eb9566b37ae1
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:28 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:28 2008 +0100

ide-cd: merge cdrom_write_check_ireason() and cdrom_read_check_ireason()

Add 'rw' parameter to cdrom_read_check_ireason(), make it handle
both read and write checking, rename it to ide_cd_check_ireason(),
finally remove no longer needed cdrom_write_check_ireason().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   64 +++--
 1 files changed, 15 insertions(+), 49 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 50f78eb..9d2e458 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -683,21 +683,25 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, 
unsigned long sector,
  * ok; nonzero if the request has been terminated.
  */
 static
-int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
+int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw)
 {
-   if (ireason == 2)
+   /*
+* ireason == 0: the drive wants to receive data from us
+* ireason == 2: the drive is expecting to transfer data to us
+*/
+   if (ireason == (!rw  1))
return 0;
-   else if (ireason == 0) {
+   else if (ireason == (rw  1)) {
ide_hwif_t *hwif = drive-hwif;
+   xfer_func_t *xf;
 
-   /* Whoops... The drive is expecting to receive data from us! */
+   /* Whoops... */
printk(KERN_ERR %s: %s: wrong transfer direction!\n,
drive-name, __FUNCTION__);
 
-   /* Throw some data at the drive so it doesn't hang
-  and quit this request. */
-   ide_cd_pad_transfer(drive, hwif-atapi_output_bytes, len);
-   } else  if (ireason == 1) {
+   xf = rw ? hwif-atapi_output_bytes : hwif-atapi_input_bytes;
+   ide_cd_pad_transfer(drive, xf, len);
+   } else  if (rw == 0  ireason == 1) {
/* Some drives (ASUS) seem to tell us that status
 * info is available. just get it and ignore.
 */
@@ -985,35 +989,6 @@ int ide_cd_queue_pc(ide_drive_t *drive, struct request *rq)
 }
 
 /*
- * Write handling
- */
-static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
-{
-   /* Two notes about IDE interrupt reason here - 0 means that
-* the drive wants to receive data from us, 2 means that
-* the drive is expecting to transfer data to us.
-*/
-   if (ireason == 0)
-   return 0;
-   else if (ireason == 2) {
-   ide_hwif_t *hwif = drive-hwif;
-
-   /* Whoops... The drive wants to send data. */
-   printk(KERN_ERR %s: %s: wrong transfer direction!\n,
-   drive-name, __FUNCTION__);
-
-   ide_cd_pad_transfer(drive, hwif-atapi_input_bytes, len);
-   } else {
-   /* Drive wants a command packet, or invalid ireason... */
-   printk(KERN_ERR %s: %s: bad interrupt reason 0x%02x\n,
-   drive-name, __FUNCTION__, ireason);
-   }
-
-   cdrom_end_request(drive, 0);
-   return 1;
-}
-
-/*
  * Called from blk_end_request_callback() after the data of the request
  * is completed and before the request is completed.
  * By returning value '1', blk_end_request_callback() returns immediately
@@ -1108,20 +1083,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
/*
 * check which way to transfer data
 */
-   if ((blk_fs_request(rq) || blk_pc_request(rq))  write) {
-   /*
-* write to drive
-*/
-   if (cdrom_write_check_ireason(drive, len, ireason))
-   return ide_stopped;
-   } else if (blk_fs_request(rq) || blk_pc_request(rq)) {
-   /*
-* read from drive
-*/
-   if (cdrom_read_check_ireason(drive, len, ireason))
+   if (blk_fs_request(rq) || blk_pc_request(rq)) {
+   if (ide_cd_check_ireason(drive, len, ireason, write))
return ide_stopped;
 
-   if (blk_fs_request(rq)) {
+   if (blk_fs_request(rq)  write == 0) {
int nskip;
 
if (ide_cd_check_transfer_size(drive, len)) {
-
To unsubscribe from this list: send the line unsubscribe git

ide-cd: unify request end exit path in cdrom_decode_status()

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bbb89e3d7a7da7a4bac535c42da05143b2db5d71
Commit: bbb89e3d7a7da7a4bac535c42da05143b2db5d71
Parent: 0d6f7e3a1845165b81adab3fc5fd13916f22aa61
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:28 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:28 2008 +0100

ide-cd: unify request end exit path in cdrom_decode_status()

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   50 --
 1 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 9d2e458..c758e63 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -332,7 +332,6 @@ static int cdrom_decode_status(ide_drive_t *drive, int 
good_stat, int *stat_ret)
 
} else if (blk_pc_request(rq) || rq-cmd_type == REQ_TYPE_ATA_PC) {
/* All other functions, except for READ. */
-   unsigned long flags;
 
/*
 * if we have an error, pass back CHECK_CONDITION as the
@@ -370,15 +369,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int 
good_stat, int *stat_ret)
 * remove failed request completely and end it when the
 * request sense has completed
 */
-   if (stat  ERR_STAT) {
-   spin_lock_irqsave(ide_lock, flags);
-   blkdev_dequeue_request(rq);
-   HWGROUP(drive)-rq = NULL;
-   spin_unlock_irqrestore(ide_lock, flags);
-
-   cdrom_queue_request_sense(drive, rq-sense, rq);
-   } else
-   cdrom_end_request(drive, 0);
+   goto end_request;
 
} else if (blk_fs_request(rq)) {
int do_end_request = 0;
@@ -458,23 +449,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int 
good_stat, int *stat_ret)
   sense data. We need this in order to perform end of media
   processing */
 
-   if (do_end_request) {
-   if (stat  ERR_STAT) {
-   unsigned long flags;
-   spin_lock_irqsave(ide_lock, flags);
-   blkdev_dequeue_request(rq);
-   HWGROUP(drive)-rq = NULL;
-   spin_unlock_irqrestore(ide_lock, flags);
+   if (do_end_request)
+   goto end_request;
 
-   cdrom_queue_request_sense(drive, rq-sense, rq);
-   } else
-   cdrom_end_request(drive, 0);
-   } else {
-   /* If we got a CHECK_CONDITION status,
-  queue a request sense command. */
-   if (stat  ERR_STAT)
-   cdrom_queue_request_sense(drive, NULL, NULL);
-   }
+   /*
+* If we got a CHECK_CONDITION status,
+* queue a request sense command.
+*/
+   if (stat  ERR_STAT)
+   cdrom_queue_request_sense(drive, NULL, NULL);
} else {
blk_dump_rq_flags(rq, ide-cd: bad rq);
cdrom_end_request(drive, 0);
@@ -482,6 +465,21 @@ static int cdrom_decode_status(ide_drive_t *drive, int 
good_stat, int *stat_ret)
 
/* Retry, or handle the next request. */
return 1;
+
+end_request:
+   if (stat  ERR_STAT) {
+   unsigned long flags;
+
+   spin_lock_irqsave(ide_lock, flags);
+   blkdev_dequeue_request(rq);
+   HWGROUP(drive)-rq = NULL;
+   spin_unlock_irqrestore(ide_lock, flags);
+
+   cdrom_queue_request_sense(drive, rq-sense, rq);
+   } else
+   cdrom_end_request(drive, 0);
+
+   return 1;
 }
 
 static int cdrom_timer_expiry(ide_drive_t *drive)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: update driver version, comments and copyrights

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3bb4663bd82e6d536a4b46166b00e93d5072e656
Commit: 3bb4663bd82e6d536a4b46166b00e93d5072e656
Parent: bbb89e3d7a7da7a4bac535c42da05143b2db5d71
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:28 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:28 2008 +0100

ide-cd: update driver version, comments and copyrights

* Bump driver version.

* Remove filename and stale TODO from comments.

* Add my copyrights.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   17 -
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index c758e63..accf0d4 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1,14 +1,14 @@
 /*
- * linux/drivers/ide/ide-cd.c
+ * ATAPI CD-ROM driver.
  *
- * Copyright (C) 1994, 1995, 1996  scott snyder  [EMAIL PROTECTED]
+ * Copyright (C) 1994-1996  Scott Snyder [EMAIL PROTECTED]
  * Copyright (C) 1996-1998  Erik Andersen [EMAIL PROTECTED]
  * Copyright (C) 1998-2000  Jens Axboe [EMAIL PROTECTED]
+ * Copyright (C)  2007  Bartlomiej Zolnierkiewicz
  *
  * May be copied or modified under the terms of the GNU General Public
  * License.  See linux/COPYING for more information.
  *
- * ATAPI CD-ROM driver.  To be used with ide.c.
  * See Documentation/cdrom/ide-cd for usage information.
  *
  * Suggestions are welcome. Patches that work are more welcome though. ;-)
@@ -19,20 +19,11 @@
  * 
ftp://fission.dt.wdc.com/pub/standards/SFF_atapi/spec/SFF8020-r2.6/PS/8020r26.ps
  * ftp://ftp.avc-pioneer.com/Mtfuji4/Spec/Fuji4r10.pdf
  *
- * Drives that deviate from these standards will be accommodated as much
- * as possible via compile time or command-line options.  Since I only have
- * a few drives, you generally need to send me patches...
- *
- * --
- * TO DO LIST:
- * -Make it so that Pioneer CD DR-A24X and friends don't get screwed up on
- *   boot
- *
  * For historical changelog please see:
  * Documentation/ide/ChangeLog.ide-cd.1994-2004
  */
 
-#define IDECD_VERSION 4.61
+#define IDECD_VERSION 5.00
 
 #include linux/module.h
 #include linux/types.h
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: move the remaining cdrom.c ioctl handling code to ide-cd_ioctl.c

2008-02-01 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f9afd18b5827be93fd9fb3cc84ab9bba38b00db8
Commit: f9afd18b5827be93fd9fb3cc84ab9bba38b00db8
Parent: d554336514a63342c2e4b06b4287ad93c112b00f
Author: Borislav Petkov [EMAIL PROTECTED]
AuthorDate: Fri Feb 1 23:09:29 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Feb 1 23:09:29 2008 +0100

ide-cd: move the remaining cdrom.c ioctl handling code to ide-cd_ioctl.c

There should be no functional changes from this.

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c   |  217 +---
 drivers/ide/ide-cd.h   |8 ++-
 drivers/ide/ide-cd_ioctl.c |  210 ++
 3 files changed, 218 insertions(+), 217 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index accf0d4..c931685 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1381,7 +1381,7 @@ void msf_from_bcd (struct atapi_msf *msf)
msf-frame  = BCD2BIN(msf-frame);
 }
 
-static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
+int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
 {
struct request req;
struct cdrom_info *info = drive-driver_data;
@@ -1402,85 +1402,6 @@ static int cdrom_check_status(ide_drive_t *drive, struct 
request_sense *sense)
return ide_cd_queue_pc(drive, req);
 }
 
-/* Lock the door if LOCKFLAG is nonzero; unlock it otherwise. */
-int ide_cd_lockdoor(ide_drive_t *drive, int lockflag,
-   struct request_sense *sense)
-{
-   struct cdrom_info *cd = drive-driver_data;
-   struct request_sense my_sense;
-   struct request req;
-   int stat;
-
-   if (sense == NULL)
-   sense = my_sense;
-
-   /* If the drive cannot lock the door, just pretend. */
-   if (cd-cd_flags  IDE_CD_FLAG_NO_DOORLOCK) {
-   stat = 0;
-   } else {
-   ide_cd_init_rq(drive, req);
-   req.sense = sense;
-   req.cmd[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
-   req.cmd[4] = lockflag ? 1 : 0;
-   stat = ide_cd_queue_pc(drive, req);
-   }
-
-   /* If we got an illegal field error, the drive
-  probably cannot lock the door. */
-   if (stat != 0 
-   sense-sense_key == ILLEGAL_REQUEST 
-   (sense-asc == 0x24 || sense-asc == 0x20)) {
-   printk (KERN_ERR %s: door locking not supported\n,
-   drive-name);
-   cd-cd_flags |= IDE_CD_FLAG_NO_DOORLOCK;
-   stat = 0;
-   }
-   
-   /* no medium, that's alright. */
-   if (stat != 0  sense-sense_key == NOT_READY  sense-asc == 0x3a)
-   stat = 0;
-
-   if (stat == 0) {
-   if (lockflag)
-   cd-cd_flags |= IDE_CD_FLAG_DOOR_LOCKED;
-   else
-   cd-cd_flags = ~IDE_CD_FLAG_DOOR_LOCKED;
-   }
-
-   return stat;
-}
-
-
-/* Eject the disk if EJECTFLAG is 0.
-   If EJECTFLAG is 1, try to reload the disk. */
-static int cdrom_eject(ide_drive_t *drive, int ejectflag,
-  struct request_sense *sense)
-{
-   struct cdrom_info *cd = drive-driver_data;
-   struct cdrom_device_info *cdi = cd-devinfo;
-   struct request req;
-   char loej = 0x02;
-
-   if ((cd-cd_flags  IDE_CD_FLAG_NO_EJECT)  !ejectflag)
-   return -EDRIVE_CANT_DO_THIS;
-
-   /* reload fails on some drives, if the tray is locked */
-   if ((cd-cd_flags  IDE_CD_FLAG_DOOR_LOCKED)  ejectflag)
-   return 0;
-
-   ide_cd_init_rq(drive, req);
-
-   /* only tell drive to close tray if open, if it can do that */
-   if (ejectflag  (cdi-mask  CDC_CLOSE_TRAY))
-   loej = 0;
-
-   req.sense = sense;
-   req.cmd[0] = GPCMD_START_STOP_UNIT;
-   req.cmd[4] = loej | (ejectflag != 0);
-
-   return ide_cd_queue_pc(drive, req);
-}
-
 static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
   unsigned long *sectors_per_frame,
   struct request_sense *sense)
@@ -1696,53 +1617,6 @@ int ide_cd_read_toc(ide_drive_t *drive, struct 
request_sense *sense)
return 0;
 }
 
-/* the generic packet interface to cdrom.c */
-static int ide_cdrom_packet(struct cdrom_device_info *cdi,
-   struct packet_command *cgc)
-{
-   struct request req;
-   ide_drive_t *drive = cdi-handle;
-
-   if (cgc-timeout = 0)
-   cgc-timeout = ATAPI_WAIT_PC;
-
-   /* here we queue the commands from the uniform CD-ROM
-  layer. the packet must be complete, as we do not
-  touch it at all. */
-   ide_cd_init_rq(drive, req);
-   memcpy

[ALSA] hda-intel: Enable Analog CD Input from internal ATAPI connector on Asus M2N-SLI

2008-01-31 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=695005cfe4808e300bf76d73012c664bcae90566
Commit: 695005cfe4808e300bf76d73012c664bcae90566
Parent: e1f0d6690817d1296161094106b23a0be9ee6ca0
Author: Johannes Stezenbach [EMAIL PROTECTED]
AuthorDate: Thu Dec 13 17:51:00 2007 +0100
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Thu Jan 31 17:29:34 2008 +0100

[ALSA] hda-intel: Enable Analog CD Input from internal ATAPI connector on 
Asus M2N-SLI

Enable Analog CD Input from internal ATAPI connector on Asus M2N-SLI.

Signed-off-by: Johannes Stezenbach [EMAIL PROTECTED]
Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/hda/patch_analog.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index b2c5380..9b0ecbf 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2084,6 +2084,8 @@ static struct hda_verb ad1988_6stack_init_verbs[] = {
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
{0x3c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
{0x34, AC_VERB_SET_CONNECT_SEL, 0x0},
+   /* Analog CD Input */
+   {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 
{ }
 };
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


blk_end_request: changing ide-cd (take 4)

2008-01-28 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aaa04c28cb9a1efd42541fdb7ab648231c2a2263
Commit: aaa04c28cb9a1efd42541fdb7ab648231c2a2263
Parent: e19a3ab058fe91c8c54d43dc56dccf7eb386478e
Author: Kiyoshi Ueda [EMAIL PROTECTED]
AuthorDate: Tue Dec 11 17:51:23 2007 -0500
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Mon Jan 28 10:37:06 2008 +0100

blk_end_request: changing ide-cd (take 4)

This patch converts ide-cd (cdrom_newpc_intr()) to use blk_end_request
interfaces.  Related 'uptodate' arguments are converted to 'error'.

In PIO mode, ide-cd (cdrom_newpc_intr()) needs to defer
end_that_request_last() until the device clears DRQ_STAT and raises
an interrupt after end_that_request_first().
So blk_end_request() has to return without completing request
even if no leftover in the request.

ide-cd uses blk_end_request_callback() and a dummy callback function,
which just returns value '1', to tell blk_end_request_callback()
about that.

Cc: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   49 +++--
 1 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 282f158..74c6087 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1647,6 +1647,17 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, 
int len, int ireason)
return 1;
 }
 
+/*
+ * Called from blk_end_request_callback() after the data of the request
+ * is completed and before the request is completed.
+ * By returning value '1', blk_end_request_callback() returns immediately
+ * without completing the request.
+ */
+static int cdrom_newpc_intr_dummy_cb(struct request *rq)
+{
+   return 1;
+}
+
 typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
 
 /*
@@ -1685,9 +1696,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
return ide_error(drive, dma error, stat);
}
 
-   end_that_request_chunk(rq, 1, rq-data_len);
-   rq-data_len = 0;
-   goto end_request;
+   spin_lock_irqsave(ide_lock, flags);
+   if (__blk_end_request(rq, 0, rq-data_len))
+   BUG();
+   HWGROUP(drive)-rq = NULL;
+   spin_unlock_irqrestore(ide_lock, flags);
+
+   return ide_stopped;
}
 
/*
@@ -1705,8 +1720,15 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
/*
 * If DRQ is clear, the command has completed.
 */
-   if ((stat  DRQ_STAT) == 0)
-   goto end_request;
+   if ((stat  DRQ_STAT) == 0) {
+   spin_lock_irqsave(ide_lock, flags);
+   if (__blk_end_request(rq, 0, 0))
+   BUG();
+   HWGROUP(drive)-rq = NULL;
+   spin_unlock_irqrestore(ide_lock, flags);
+
+   return ide_stopped;
+   }
 
/*
 * check which way to transfer data
@@ -1759,7 +1781,14 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
rq-data_len -= blen;
 
if (rq-bio)
-   end_that_request_chunk(rq, 1, blen);
+   /*
+* The request can't be completed until DRQ is cleared.
+* So complete the data, but don't complete the request
+* using the dummy function for the callback feature
+* of blk_end_request_callback().
+*/
+   blk_end_request_callback(rq, 0, blen,
+cdrom_newpc_intr_dummy_cb);
else
rq-data += blen;
}
@@ -1780,14 +1809,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 
ide_set_handler(drive, cdrom_newpc_intr, rq-timeout, NULL);
return ide_started;
-
-end_request:
-   spin_lock_irqsave(ide_lock, flags);
-   blkdev_dequeue_request(rq);
-   end_that_request_last(rq, 1);
-   HWGROUP(drive)-rq = NULL;
-   spin_unlock_irqrestore(ide_lock, flags);
-   return ide_stopped;
 }
 
 static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix register loading order in cdrom_start_packet_command()

2008-01-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3a6a3549afe7dfe212b6384106bec957bb393f3a
Commit: 3a6a3549afe7dfe212b6384106bec957bb393f3a
Parent: 8e7657ae0f56c14882e53ffdae8055c2b1624de1
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Fri Jan 25 22:17:13 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Fri Jan 25 22:17:13 2008 +0100

ide-cd: fix register loading order in cdrom_start_packet_command()

Load IDE_CONTROL_REG before other registers in cdrom_start_packet_command().

It shouldn't affect anything (just a usual paranoia to separate changes
which change the way in which hardware is accessed from code cleanups).

While at it move misplaced FIXME comment in the right place.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index c7d77f0..855a23c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -917,19 +917,19 @@ static ide_startstop_t 
cdrom_start_packet_command(ide_drive_t *drive,
if (ide_wait_stat(startstop, drive, 0, BUSY_STAT, WAIT_READY))
return startstop;
 
+   /* FIXME: for Virtual DMA we must check harder */
if (info-dma)
info-dma = !hwif-dma_setup(drive);
 
/* Set up the controller registers. */
-   /* FIXME: for Virtual DMA we must check harder */
+   if (IDE_CONTROL_REG)
+   HWIF(drive)-OUTB(drive-ctl, IDE_CONTROL_REG);
HWIF(drive)-OUTB(info-dma, IDE_FEATURE_REG);
HWIF(drive)-OUTB(0, IDE_IREASON_REG);
HWIF(drive)-OUTB(0, IDE_SECTOR_REG);
 
HWIF(drive)-OUTB(xferlen  0xff, IDE_BCOUNTL_REG);
HWIF(drive)-OUTB(xferlen  8  , IDE_BCOUNTH_REG);
-   if (IDE_CONTROL_REG)
-   HWIF(drive)-OUTB(drive-ctl, IDE_CONTROL_REG);
  
if (CDROM_CONFIG_FLAGS (drive)-drq_interrupt) {
/* waiting for CDB interrupt, not DMA yet. */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix SAMSUNG CD-ROM SCR-3231 quirk

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3cbd814ef3d4c80392377e6ce5816058258f1484
Commit: 3cbd814ef3d4c80392377e6ce5816058258f1484
Parent: a1c6d28c2b3ec919c37cb7026ed8af70fe7cb098
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: fix SAMSUNG CD-ROM SCR-3231 quirk

cdi-mask is cleared by ide_cdrom_register() which is called after the 
quirk.

Fix it by adding new -no_speed_select flag to struct ide_cd_config_flags
and using it in ide_cdrom_register() to set CDC_SELECT_SPEED flag.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |5 -
 drivers/ide/ide-cd.h |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 92ac658..249834b 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2909,6 +2909,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int 
nslots)
if (!CDROM_CONFIG_FLAGS(drive)-ram)
devinfo-mask |= CDC_RAM;
 
+   if (CDROM_CONFIG_FLAGS(drive)-no_speed_select)
+   devinfo-mask |= CDC_SELECT_SPEED;
+
devinfo-disk = info-disk;
return register_cdrom(devinfo);
 }
@@ -3161,7 +3164,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS(drive)-limit_nframes = 1;
/* the 3231 model does not support the SET_CD_SPEED command */
else if (!strcmp(drive-id-model, SAMSUNG CD-ROM SCR-3231))
-   cdi-mask |= CDC_SELECT_SPEED;
+   CDROM_CONFIG_FLAGS(drive)-no_speed_select = 1;
 
 #if ! STANDARD_ATAPI
/* by default Sanyo 3 CD changer support is turned off and
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 228b29c..1b302fe 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -91,7 +91,8 @@ struct ide_cd_config_flags {
__u8 close_tray : 1; /* can close the tray */
__u8 writing: 1; /* pseudo write in progress */
__u8 mo_drive   : 1; /* drive is an MO device */
-   __u8 reserved   : 2;
+   __u8 no_speed_select: 1; /* SET_CD_SPEED command is unsupported. */
+   __u8 reserved   : 1;
byte max_speed;  /* Max speed of the drive */
 };
 #define CDROM_CONFIG_FLAGS(drive) struct cdrom_info 
*)(drive-driver_data))-config_flags))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix ACER/AOpen 24X CDROM speed reporting on big-endian machines

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aa5dc8ebd9ef7521461b1b47ec918be841a21313
Commit: aa5dc8ebd9ef7521461b1b47ec918be841a21313
Parent: 3cbd814ef3d4c80392377e6ce5816058258f1484
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: fix ACER/AOpen 24X CDROM speed reporting on big-endian machines

* Fix ACER/AOpen 24X CDROM speed reporting on big-endian machines
  by adding missing le16_to_cpu() calls.

While at it:
* Replace ntohs() by be16_to_cpu().

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 249834b..97ce584 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2688,14 +2688,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct 
atapi_capabilities_page
if (!drive-id-model[0] 
!strncmp(drive-id-fw_rev, 241N, 4)) {
CDROM_STATE_FLAGS(drive)-current_speed  =
-   (((unsigned int)cap-curspeed) + (176/2)) / 176;
+   (le16_to_cpu(cap-curspeed) + (176/2)) / 176;
CDROM_CONFIG_FLAGS(drive)-max_speed =
-   (((unsigned int)cap-maxspeed) + (176/2)) / 176;
+   (le16_to_cpu(cap-maxspeed) + (176/2)) / 176;
} else {
CDROM_STATE_FLAGS(drive)-current_speed  =
-   (ntohs(cap-curspeed) + (176/2)) / 176;
+   (be16_to_cpu(cap-curspeed) + (176/2)) / 176;
CDROM_CONFIG_FLAGS(drive)-max_speed =
-   (ntohs(cap-maxspeed) + (176/2)) / 176;
+   (be16_to_cpu(cap-maxspeed) + (176/2)) / 176;
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: use ide_cd_release() in ide_cd_probe()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=05017db3b3e0f0a294a38c38d7adb7d2c0c9844b
Commit: 05017db3b3e0f0a294a38c38d7adb7d2c0c9844b
Parent: aa5dc8ebd9ef7521461b1b47ec918be841a21313
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: use ide_cd_release() in ide_cd_probe()

Use ide_cd_release() to do the cleanup if ide_cdrom_setup() fails.

It fixes:
- the default drive-dsc_overlap value not being restored
- the default drive-queue's prep_rq_fn not being restored
- struct gendisk 'g' not being freed
- wrong function name being reported on unregister_cdrom() error

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 97ce584..599bb54 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -3507,15 +3507,8 @@ static int ide_cd_probe(ide_drive_t *drive)
g-driverfs_dev = drive-gendev;
g-flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
if (ide_cdrom_setup(drive)) {
-   struct cdrom_device_info *devinfo = info-devinfo;
ide_proc_unregister_driver(drive, ide_cdrom_driver);
-   kfree(info-buffer);
-   kfree(info-toc);
-   kfree(info-changer_info);
-   if (devinfo-handle == drive  unregister_cdrom(devinfo))
-   printk (KERN_ERR %s: ide_cdrom_cleanup failed to 
unregister device from the cdrom driver.\n, drive-name);
-   kfree(info);
-   drive-driver_data = NULL;
+   ide_cd_release(info-kref);
goto failed;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix error messages in cdrom_{read,write}_check_ireason()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35379c071a61d025153723f2acb2cc19cc3ca78c
Commit: 35379c071a61d025153723f2acb2cc19cc3ca78c
Parent: 05017db3b3e0f0a294a38c38d7adb7d2c0c9844b
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: fix error messages in cdrom_{read,write}_check_ireason()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 599bb54..d4b298e 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int 
len, int ireason)
return 0;
else if (ireason == 0) {
/* Whoops... The drive is expecting to receive data from us! */
-   printk(KERN_ERR %s: read_intr: Drive wants to transfer data 
the 
-   wrong way!\n, drive-name);
+   printk(KERN_ERR %s: %s: wrong transfer direction!\n,
+   drive-name, __FUNCTION__);
 
/* Throw some data at the drive so it doesn't hang
   and quit this request. */
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int 
len, int ireason)
return 0;
} else {
/* Drive wants a command packet, or invalid ireason... */
-   printk(KERN_ERR %s: read_intr: bad interrupt reason %x\n, 
drive-name,
-   ireason);
+   printk(KERN_ERR %s: %s: bad interrupt reason 0x%02x\n,
+   drive-name, __FUNCTION__, ireason);
}
 
cdrom_end_request(drive, 0);
@@ -1632,8 +1632,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, 
int len, int ireason)
return 0;
else if (ireason == 2) {
/* Whoops... The drive wants to send data. */
-   printk(KERN_ERR %s: write_intr: wrong transfer direction!\n,
-   drive-name);
+   printk(KERN_ERR %s: %s: wrong transfer direction!\n,
+   drive-name, __FUNCTION__);
 
while (len  0) {
int dum = 0;
@@ -1642,8 +1642,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, 
int len, int ireason)
}
} else {
/* Drive wants a command packet, or invalid ireason... */
-   printk(KERN_ERR %s: write_intr: bad interrupt reason %x\n,
-   drive-name, ireason);
+   printk(KERN_ERR %s: %s: bad interrupt reason 0x%02x\n,
+   drive-name, __FUNCTION__, ireason);
}
 
cdrom_end_request(drive, 0);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: add missing 'ireason' masking to cdrom_write_intr()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31a71191650dce1bb4a7de6147f1947795826cda
Commit: 31a71191650dce1bb4a7de6147f1947795826cda
Parent: 35379c071a61d025153723f2acb2cc19cc3ca78c
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: add missing 'ireason' masking to cdrom_write_intr()

Mask 'ireason' variable with 0x3 so the valid interrupt reason value
is passed to cdrom_write_check_ireason() for checking.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index d4b298e..30f2758 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1826,7 +1826,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t 
*drive)
}
 
/* Read the interrupt reason and the transfer length. */
-   ireason = HWIF(drive)-INB(IDE_IREASON_REG);
+   ireason = HWIF(drive)-INB(IDE_IREASON_REG)  0x3;
lowcyl  = HWIF(drive)-INB(IDE_BCOUNTL_REG);
highcyl = HWIF(drive)-INB(IDE_BCOUNTH_REG);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix error messages in cdrom_write_intr()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b481b23868928443931190c91e7c06e23913149d
Commit: b481b23868928443931190c91e7c06e23913149d
Parent: 31a71191650dce1bb4a7de6147f1947795826cda
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: fix error messages in cdrom_write_intr()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 30f2758..3d48a02 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1805,8 +1805,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t 
*drive)
/* Check for errors. */
if (dma) {
info-dma = 0;
-   if ((dma_error = HWIF(drive)-ide_dma_end(drive))) {
-   printk(KERN_ERR ide-cd: write dma error\n);
+   dma_error = HWIF(drive)-ide_dma_end(drive);
+   if (dma_error) {
+   printk(KERN_ERR %s: DMA write error\n, drive-name);
ide_dma_off(drive);
}
}
@@ -1839,8 +1840,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t 
*drive)
 */
uptodate = 1;
if (rq-current_nr_sectors  0) {
-   printk(KERN_ERR %s: write_intr: data underrun (%d 
blocks)\n,
-   drive-name, rq-current_nr_sectors);
+   printk(KERN_ERR %s: %s: data underrun (%d blocks)\n,
+   drive-name, __FUNCTION__,
+   rq-current_nr_sectors);
uptodate = 0;
}
cdrom_end_request(drive, uptodate);
@@ -1860,7 +1862,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t 
*drive)
int this_transfer;
 
if (!rq-current_nr_sectors) {
-   printk(KERN_ERR ide-cd: write_intr: oops\n);
+   printk(KERN_ERR %s: %s: confused, missing data\n,
+   drive-name, __FUNCTION__);
break;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: add error message for DMA error to cdrom_read_intr()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=52ef2ed08164dbde07203ee245584d59ebf5c487
Commit: 52ef2ed08164dbde07203ee245584d59ebf5c487
Parent: b481b23868928443931190c91e7c06e23913149d
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:43 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:43 2007 +0100

ide-cd: add error message for DMA error to cdrom_read_intr()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3d48a02..3b23826 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t 
*drive)
 */
if (dma) {
info-dma = 0;
-   if ((dma_error = HWIF(drive)-ide_dma_end(drive)))
+   dma_error = HWIF(drive)-ide_dma_end(drive);
+   if (dma_error) {
+   printk(KERN_ERR %s: DMA read error\n, drive-name);
ide_dma_off(drive);
+   }
}
 
if (cdrom_decode_status(drive, 0, stat))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix error message in cdrom_pc_intr()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5744a06134c8f4e77ad14016420aac308c763454
Commit: 5744a06134c8f4e77ad14016420aac308c763454
Parent: 52ef2ed08164dbde07203ee245584d59ebf5c487
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:44 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:44 2007 +0100

ide-cd: fix error message in cdrom_pc_intr()

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3b23826..522580f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1511,7 +1511,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
/* Same drill for reading. */
else if ((ireason  3) == 2) {
if (!rq-data) {
-   blk_dump_rq_flags(rq, cdrom_pc_intr, write);
+   blk_dump_rq_flags(rq, cdrom_pc_intr, read);
goto confused;
}
/* Transfer the data. */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: fix 'ireason' reporting in cdrom_pc_intr()

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8606ab094cfe909f83deedf1fac86993d7c9a9ad
Commit: 8606ab094cfe909f83deedf1fac86993d7c9a9ad
Parent: 5744a06134c8f4e77ad14016420aac308c763454
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:44 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:44 2007 +0100

ide-cd: fix 'ireason' reporting in cdrom_pc_intr()

Mask 'ireason' variable so only the valid interrupt reason bits
will be reported on drive appears confused error.

Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 522580f..c7d77f0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1446,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
return ide_stopped;
 
/* Read the interrupt reason and the transfer length. */
-   ireason = HWIF(drive)-INB(IDE_IREASON_REG);
+   ireason = HWIF(drive)-INB(IDE_IREASON_REG)  0x3;
lowcyl  = HWIF(drive)-INB(IDE_BCOUNTL_REG);
highcyl = HWIF(drive)-INB(IDE_BCOUNTH_REG);
 
@@ -1487,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
if (thislen  len) thislen = len;
 
/* The drive wants to be written to. */
-   if ((ireason  3) == 0) {
+   if (ireason == 0) {
if (!rq-data) {
blk_dump_rq_flags(rq, cdrom_pc_intr, write);
goto confused;
@@ -1509,7 +1509,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
}
 
/* Same drill for reading. */
-   else if ((ireason  3) == 2) {
+   else if (ireason == 2) {
if (!rq-data) {
blk_dump_rq_flags(rq, cdrom_pc_intr, read);
goto confused;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


MAINTAINERS: update ide-cd entry

2007-12-25 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c404c199f71127ebc1929e6657d3d4f0d6c2f08a
Commit: c404c199f71127ebc1929e6657d3d4f0d6c2f08a
Parent: 8606ab094cfe909f83deedf1fac86993d7c9a9ad
Author: Borislav Petkov [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 15:23:44 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Dec 24 15:23:44 2007 +0100

MAINTAINERS: update ide-cd entry

Reopen ide-cd for maintainership.

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 MAINTAINERS |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3d567fd..79c711e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1870,8 +1870,10 @@ T:   quilt 
kernel.org/pub/linux/kernel/people/bart/pata-2.6/
 S: Maintained
 
 IDE/ATAPI CDROM DRIVER
+P: Borislav Petkov
+M: [EMAIL PROTECTED]
 L: [EMAIL PROTECTED]
-S: Unmaintained
+S: Maintained
 
 IDE/ATAPI FLOPPY DRIVERS
 P: Paul Bristow
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd: remove dead post_transform_command()

2007-12-17 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c86ae7df90a26708e9e54e3a362046873d874e6c
Commit: c86ae7df90a26708e9e54e3a362046873d874e6c
Parent: 3ab7efe8e2cbcca2d401b43cfcc2fa9a7dac2299
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 23:31:58 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Wed Dec 12 23:31:58 2007 +0100

ide-cd: remove dead post_transform_command()

post_transform_command() call in cdrom_newpc_intr() has no effect because
it is done after the request has already been fully completed (rq-bio and
rq-data are always NULL).  It was verified to be true regardless whether
INQUIRY command is using DMA or PIO to transfer data (by using modified
Tejun Heo's test-shortsg.c utility and adding a few printk()-s to ide-cd).

This was uncovered thanks to the blk_end_request: full I/O completion
handler (take 3) patch series from Kiyoshi Ueda.

Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Kiyoshi Ueda [EMAIL PROTECTED]
Cc: Jun'ichi Nomura [EMAIL PROTECTED]
Cc: Tejun Heo [EMAIL PROTECTED]
Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   28 
 1 files changed, 0 insertions(+), 28 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index db9abd8..92ac658 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1650,31 +1650,6 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, 
int len, int ireason)
return 1;
 }
 
-static void post_transform_command(struct request *req)
-{
-   u8 *c = req-cmd;
-   char *ibuf;
-
-   if (!blk_pc_request(req))
-   return;
-
-   if (req-bio)
-   ibuf = bio_data(req-bio);
-   else
-   ibuf = req-data;
-
-   if (!ibuf)
-   return;
-
-   /*
-* set ansi-revision and response data as atapi
-*/
-   if (c[0] == GPCMD_INQUIRY) {
-   ibuf[2] |= 2;
-   ibuf[3] = (ibuf[3]  0xf0) | 2;
-   }
-}
-
 typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
 
 /*
@@ -1810,9 +1785,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
return ide_started;
 
 end_request:
-   if (!rq-data_len)
-   post_transform_command(rq);
-
spin_lock_irqsave(ide_lock, flags);
blkdev_dequeue_request(rq);
end_that_request_last(rq, 1);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide: add TORiSAN model: CD-ROM CDR_U200 fw: 1.09 to DMA blacklist

2007-11-27 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b0bc65b9aa7d9eb8af4895ed772ef7fe2c10687c
Commit: b0bc65b9aa7d9eb8af4895ed772ef7fe2c10687c
Parent: 9130201003cf3a9f3afe830fe8e544018beab61b
Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
AuthorDate: Tue Nov 27 21:35:56 2007 +0100
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Tue Nov 27 21:35:56 2007 +0100

ide: add TORiSAN model: CD-ROM CDR_U200 fw: 1.09 to DMA blacklist

Based on the report from [EMAIL PROTECTED]

Fixes kernel bugzilla bug #9195.

Tested-by: [EMAIL PROTECTED]
Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-dma.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index e3add70..0d795a1 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -130,6 +130,7 @@ static const struct drive_list_entry drive_blacklist [] = {
{ _NEC DV5800A,   NULL},
{ SAMSUNG CD-ROM SN-124,  N001 },
{ Seagate STT2A,  NULL  },
+   { CD-ROM CDR_U200,1.09 },
{ NULL  ,   NULL}
 
 };
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide-cd is unmaintained

2007-10-17 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ca025282e9f13471cd4bf44d854bbd6dcbcb39c1
Commit: ca025282e9f13471cd4bf44d854bbd6dcbcb39c1
Parent: cd215237d2c2c1efb501f70be8e9ed1f81f3c068
Author: Alan Cox [EMAIL PROTECTED]
AuthorDate: Tue Oct 16 23:30:06 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Wed Oct 17 08:42:58 2007 -0700

ide-cd is unmaintained

I simply don't have any old IDE systems any more or time to really look
after this.  Nobody responded to the previous linux-ide mail about
maintainers so...

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 MAINTAINERS |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 50d29bc..38d11f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1877,10 +1877,8 @@ T:   quilt 
kernel.org/pub/linux/kernel/people/bart/pata-2.6/
 S: Maintained
 
 IDE/ATAPI CDROM DRIVER
-P: Alan Cox
-M: [EMAIL PROTECTED]
 L: [EMAIL PROTECTED]
-S: Maintained
+S: Unmaintained
 
 IDE/ATAPI FLOPPY DRIVERS
 P: Paul Bristow
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ps3: BD/DVD/CD-ROM Storage Driver

2007-07-21 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9aea8cbf2866c5680e30ff473341b7c5e93f7442
Commit: 9aea8cbf2866c5680e30ff473341b7c5e93f7442
Parent: c6131fa528c4fc57605c474bf8c83821aff164c0
Author: Geert Uytterhoeven [EMAIL PROTECTED]
AuthorDate: Sat Jul 21 04:37:47 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Sat Jul 21 17:49:16 2007 -0700

ps3: BD/DVD/CD-ROM Storage Driver

Add a BD/DVD/CD-ROM Storage Driver for the PS3:
  - Implemented as a SCSI device driver
  - Uses software scatter-gather with a 64 KiB bounce buffer as the 
hypervisor
doesn't support scatter-gather

Cc: Geoff Levand [EMAIL PROTECTED]
Signed-off-by: Geert Uytterhoeven [EMAIL PROTECTED]
Cc: Jens Axboe [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]
Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/powerpc/platforms/ps3/Kconfig |   11 +
 drivers/scsi/Makefile  |1 +
 drivers/scsi/ps3rom.c  |  533 
 3 files changed, 545 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/Kconfig 
b/arch/powerpc/platforms/ps3/Kconfig
index 8da927c..f609291 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -112,4 +112,15 @@ config PS3_DISK
  This support is required to access the PS3 hard disk.
  In general, all users will say Y or M.
 
+config PS3_ROM
+   tristate PS3 BD/DVD/CD-ROM Storage Driver
+   depends on PPC_PS3  SCSI
+   select PS3_STORAGE
+   help
+ Include support for the PS3 ROM Storage.
+
+ This support is required to access the PS3 BD/DVD/CD-ROM drive.
+ In general, all users will say Y or M.
+ Also make sure to say Y or M to SCSI CDROM support later.
+
 endmenu
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 0f86895..86a7ba7 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -132,6 +132,7 @@ obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/
 obj-$(CONFIG_SCSI_IBMVSCSIS)   += ibmvscsi/
 obj-$(CONFIG_SCSI_HPTIOP)  += hptiop.o
 obj-$(CONFIG_SCSI_STEX)+= stex.o
+obj-$(CONFIG_PS3_ROM)  += ps3rom.o
 
 obj-$(CONFIG_ARM)  += arm/
 
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
new file mode 100644
index 000..b50f1e1
--- /dev/null
+++ b/drivers/scsi/ps3rom.c
@@ -0,0 +1,533 @@
+/*
+ * PS3 BD/DVD/CD-ROM Storage Driver
+ *
+ * Copyright (C) 2007 Sony Computer Entertainment Inc.
+ * Copyright 2007 Sony Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include linux/cdrom.h
+#include linux/highmem.h
+
+#include scsi/scsi.h
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_dbg.h
+#include scsi/scsi_device.h
+#include scsi/scsi_host.h
+
+#include asm/lv1call.h
+#include asm/ps3stor.h
+
+
+#define DEVICE_NAMEps3rom
+
+#define BOUNCE_SIZE(64*1024)
+
+#define PS3ROM_MAX_SECTORS (BOUNCE_SIZE / CD_FRAMESIZE)
+
+
+struct ps3rom_private {
+   struct ps3_storage_device *dev;
+   struct scsi_cmnd *curr_cmd;
+};
+
+
+#define LV1_STORAGE_SEND_ATAPI_COMMAND (1)
+
+struct lv1_atapi_cmnd_block {
+   u8  pkt[32];/* packet command block   */
+   u32 pktlen; /* should be 12 for ATAPI 8020*/
+   u32 blocks;
+   u32 block_size;
+   u32 proto;  /* transfer mode  */
+   u32 in_out; /* transfer direction */
+   u64 buffer; /* parameter except command block */
+   u32 arglen; /* length above   */
+};
+
+enum lv1_atapi_proto {
+   NON_DATA_PROTO = 0,
+   PIO_DATA_IN_PROTO  = 1,
+   PIO_DATA_OUT_PROTO = 2,
+   DMA_PROTO = 3
+};
+
+enum lv1_atapi_in_out {
+   DIR_WRITE = 0,  /* memory - device */
+   DIR_READ = 1/* device - memory */
+};
+
+
+static int ps3rom_slave_configure(struct scsi_device *scsi_dev)
+{
+   struct ps3rom_private *priv = shost_priv(scsi_dev-host);
+   struct ps3_storage_device *dev = priv-dev

ide-cd: replace C code with call to ARRAY_SIZE() macro

2007-07-09 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=74c8f97a6c2d12fb144ad34076e969e8a01dc4b3
Commit: 74c8f97a6c2d12fb144ad34076e969e8a01dc4b3
Parent: f3577db0c294ab4ce8460a8003312474b509e95f
Author: Robert P. J. Day [EMAIL PROTECTED]
AuthorDate: Mon Jul 9 23:17:57 2007 +0200
Committer:  Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
CommitDate: Mon Jul 9 23:17:57 2007 +0200

ide-cd: replace C code with call to ARRAY_SIZE() macro

Delete the unnecessary macro ARY_LEN and use ARRAY_SIZE directly.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |6 +++---
 drivers/ide/ide-cd.h |2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 252ab82..1486eb2 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -481,7 +481,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
else
printk(  Unknown Error Type: );
 
-   if (sense-sense_key  ARY_LEN(sense_key_texts))
+   if (sense-sense_key  ARRAY_SIZE(sense_key_texts))
s = sense_key_texts[sense-sense_key];
 
printk(%s -- (Sense key=0x%02x)\n, s, sense-sense_key);
@@ -491,7 +491,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 sense-ascq);
s = buf;
} else {
-   int lo = 0, mid, hi = ARY_LEN(sense_data_texts);
+   int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts);
unsigned long key = (sense-sense_key  16);
key |= (sense-asc  8);
if (!(sense-ascq = 0x80  sense-ascq = 0xdd))
@@ -524,7 +524,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 
if (failed_command != NULL) {
 
-   int lo=0, mid, hi= ARY_LEN (packet_command_texts);
+   int lo=0, mid, hi= ARRAY_SIZE(packet_command_texts);
s = NULL;
 
while (hi  lo) {
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index ad1f2ed..228b29c 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -498,8 +498,6 @@ struct cdrom_info {
  * Descriptions of ATAPI error codes.
  */
 
-#define ARY_LEN(a) ((sizeof(a) / sizeof(a[0])))
-
 /* This stuff should be in cdrom.h, since it is now generic... */
 
 /* ATAPI sense keys (from table 140 of ATAPI 2.6) */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCSI] fusion: fix for BZ 8426 - massive slowdown on SCSI CD/DVD drive

2007-06-18 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=29982e9acd3e81a289c73321401427d02eaa8adc
Commit: 29982e9acd3e81a289c73321401427d02eaa8adc
Parent: 5ecd3100e695228ac5e0ce0e325e252c0f11806f
Author: Doug Chapman [EMAIL PROTECTED]
AuthorDate: Mon May 7 15:59:46 2007 -0400
Committer:  James Bottomley [EMAIL PROTECTED]
CommitDate: Tue Jun 5 11:04:56 2007 -0500

[SCSI] fusion: fix for BZ 8426 - massive slowdown on SCSI CD/DVD drive

Patch for: http://bugzilla.kernel.org/show_bug.cgi?id=8426

A recent code cleanup that moved code from mptscsih to mptspi
inadvertently change the order some code was called.  This caused
a massive slowdown (of 150x to 300x) on the CD/DVD drive on the
high-end HP Integrity servers.

Signed-off-by: Doug Chapman [EMAIL PROTECTED]
Acked-by: Eric Moore [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]
---
 drivers/message/fusion/mptspi.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index d75f7ff..37bf653 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -727,13 +727,15 @@ static int mptspi_slave_configure(struct scsi_device 
*sdev)
struct _MPT_SCSI_HOST *hd =
(struct _MPT_SCSI_HOST *)sdev-host-hostdata;
VirtTarget *vtarget = scsi_target(sdev)-hostdata;
-   int ret = mptscsih_slave_configure(sdev);
+   int ret;
+
+   mptspi_initTarget(hd, vtarget, sdev);
+
+   ret = mptscsih_slave_configure(sdev);
 
if (ret)
return ret;
 
-   mptspi_initTarget(hd, vtarget, sdev);
-
ddvprintk((MYIOC_s_INFO_FMT id=%d min_period=0x%02x
 max_offset=0x%02x max_width=%d\n, hd-ioc-name,
sdev-id, spi_min_period(scsi_target(sdev)),
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >