diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-21 16:48:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-21 16:48:37 -0400 |
commit | 61311e1bbc299b3a3a42b8d7f491b428ded964f0 (patch) | |
tree | b86af58eee0d637224f010cf8a431e6d1b47ed48 | |
parent | 691a55998cc2fc645b51d28edb4f4d36b512826e (diff) | |
parent | 5e4c6564c95ce127beeefe75e15cd11c93487436 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
pnp: fix "add acpi:* modalias entries"
UIO: generic irq handling for some uio platform devices
UIO: uio_pdrv: fix license specification
UIO: uio_pdrv: fix memory leak
block: drop references taken by class_find_device()
block: fix partial read() of /proc/{partitions,diskstats}
PM: Remove WARN_ON from device_pm_add
driver core: add init_name to struct device
PM: don't skip device PM init when CONFIG_PM_SLEEP isn't set and CONFIG_PM is set
driver model: anti-oopsing medicine
dev_printk(): constify the `dev' argument
drivers/base/driver.c: remove unused to_dev() macro
Documentation: HOWTO-ja_JP-sync patch
Japanese translation of Documentation/SubmitChecklist
kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
-rw-r--r-- | Documentation/ja_JP/HOWTO | 67 | ||||
-rw-r--r-- | Documentation/ja_JP/SubmitChecklist | 111 | ||||
-rw-r--r-- | block/genhd.c | 36 | ||||
-rw-r--r-- | drivers/base/class.c | 11 | ||||
-rw-r--r-- | drivers/base/core.c | 31 | ||||
-rw-r--r-- | drivers/base/driver.c | 3 | ||||
-rw-r--r-- | drivers/base/power/main.c | 19 | ||||
-rw-r--r-- | drivers/base/power/power.h | 9 | ||||
-rw-r--r-- | drivers/uio/Kconfig | 13 | ||||
-rw-r--r-- | drivers/uio/Makefile | 1 | ||||
-rw-r--r-- | drivers/uio/uio_pdrv.c | 4 | ||||
-rw-r--r-- | drivers/uio/uio_pdrv_genirq.c | 188 | ||||
-rw-r--r-- | include/linux/device.h | 5 | ||||
-rw-r--r-- | lib/kobject.c | 3 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 16 |
15 files changed, 445 insertions, 72 deletions
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO index 488c77fa3aae..0775cf4798b2 100644 --- a/Documentation/ja_JP/HOWTO +++ b/Documentation/ja_JP/HOWTO | |||
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a | |||
11 | fork. So if you have any comments or updates for this file, please try | 11 | fork. So if you have any comments or updates for this file, please try |
12 | to update the original English file first. | 12 | to update the original English file first. |
13 | 13 | ||
14 | Last Updated: 2007/11/16 | 14 | Last Updated: 2008/08/21 |
15 | ================================== | 15 | ================================== |
16 | これは、 | 16 | これは、 |
17 | linux-2.6.24/Documentation/HOWTO | 17 | linux-2.6.27/Documentation/HOWTO |
18 | の和訳です。 | 18 | の和訳です。 |
19 | 19 | ||
20 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > | 20 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > |
21 | 翻訳日: 2007/11/10 | 21 | 翻訳日: 2008/8/5 |
22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | 22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> |
23 | 校正者: 松倉さん <nbh--mats at nifty dot com> | 23 | 校正者: 松倉さん <nbh--mats at nifty dot com> |
24 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | 24 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> |
@@ -287,13 +287,15 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン | |||
287 | に安定した状態にあると判断したときにリリースされます。目標は毎週新 | 287 | に安定した状態にあると判断したときにリリースされます。目標は毎週新 |
288 | しい -rc カーネルをリリースすることです。 | 288 | しい -rc カーネルをリリースすることです。 |
289 | 289 | ||
290 | - 以下の URL で各 -rc リリースに存在する既知の後戻り問題のリスト | ||
291 | が追跡されます- | ||
292 | http://kernelnewbies.org/known_regressions | ||
293 | |||
294 | - このプロセスはカーネルが 「準備ができた」と考えられるまで継続しま | 290 | - このプロセスはカーネルが 「準備ができた」と考えられるまで継続しま |
295 | す。このプロセスはだいたい 6週間継続します。 | 291 | す。このプロセスはだいたい 6週間継続します。 |
296 | 292 | ||
293 | - 各リリースでの既知の後戻り問題(regression: このリリースの中で新規 | ||
294 | に作り込まれた問題を指す) はその都度 Linux-kernel メーリングリスト | ||
295 | に投稿されます。ゴールとしては、カーネルが 「準備ができた」と宣言 | ||
296 | する前にこのリストの長さをゼロに減らすことですが、現実には、数個の | ||
297 | 後戻り問題がリリース時にたびたび残ってしまいます。 | ||
298 | |||
297 | Andrew Morton が Linux-kernel メーリングリストにカーネルリリースについ | 299 | Andrew Morton が Linux-kernel メーリングリストにカーネルリリースについ |
298 | て書いたことをここで言っておくことは価値があります- | 300 | て書いたことをここで言っておくことは価値があります- |
299 | 「カーネルがいつリリースされるかは誰も知りません。なぜなら、これは現 | 301 | 「カーネルがいつリリースされるかは誰も知りません。なぜなら、これは現 |
@@ -303,18 +305,20 @@ Andrew Morton が Linux-kernel メーリングリストにカーネルリリー | |||
303 | 2.6.x.y -stable カーネルツリー | 305 | 2.6.x.y -stable カーネルツリー |
304 | --------------------------- | 306 | --------------------------- |
305 | 307 | ||
306 | バージョン4つ目の数字がいカーネルは -stable カーネルです。これに | 308 | バージョン番号4つの数字分かいカーネルは -stable カーネルです。 |
307 | は、2.6.x カーネルで見つかったセキュリティ問題や重大な後戻りに対する比 | 309 | れに、2.6.x カーネルで見つかったセキュリティ問題や重大な後戻りに対 |
308 | 較的小さい重要な修正が含まれます。 | 310 | する比較的小さい重要な修正が含まれます。 |
309 | 311 | ||
310 | これは、開発/実験的バージョンのテストに協力することに興味が無く、 | 312 | これは、開発/実験的バージョンのテストに協力することに興味が無く、 |
311 | 最新の安定したカーネルを使いたいユーザに推奨するブランチです。 | 313 | 最新の安定したカーネルを使いたいユーザに推奨するブランチです。 |
312 | 314 | ||
313 | もし、2.6.x.y カーネルが存在しない場合には、番号が一番大きい 2.6.x | 315 | もし、2.6.x.y カーネルが存在しない場合には、番号が一番大きい 2.6.x が |
314 | が最新の安定版カーネルです。 | 316 | 最新の安定版カーネルです。 |
315 | 317 | ||
316 | 2.6.x.y は "stable" チーム <stable@kernel.org> でメンテされており、だ | 318 | 2.6.x.y は "stable" チーム <stable@kernel.org> でメンテされており、必 |
317 | いたい隔週でリリースされています。 | 319 | 要に応じてリリースされます。通常のリリース期間は 2週間毎ですが、差し迫っ |
320 | た問題がなければもう少し長くなることもあります。セキュリティ関連の問題 | ||
321 | の場合はこれに対してだいたいの場合、すぐにリリースがされます。 | ||
318 | 322 | ||
319 | カーネルツリーに入っている、Documentation/stable_kernel_rules.txt ファ | 323 | カーネルツリーに入っている、Documentation/stable_kernel_rules.txt ファ |
320 | イルにはどのような種類の変更が -stable ツリーに受け入れ可能か、またリ | 324 | イルにはどのような種類の変更が -stable ツリーに受け入れ可能か、またリ |
@@ -341,7 +345,9 @@ linux-kernel メーリングリストで収集された多数のパッチと同 | |||
341 | メインラインへ入れるように Linus にプッシュします。 | 345 | メインラインへ入れるように Linus にプッシュします。 |
342 | 346 | ||
343 | メインカーネルツリーに含めるために Linus に送る前に、すべての新しいパッ | 347 | メインカーネルツリーに含めるために Linus に送る前に、すべての新しいパッ |
344 | チが -mm ツリーでテストされることが強く推奨されます。 | 348 | チが -mm ツリーでテストされることが強く推奨されています。マージウィン |
349 | ドウが開く前に -mm ツリーに現れなかったパッチはメインラインにマージさ | ||
350 | れることは困難になります。 | ||
345 | 351 | ||
346 | これらのカーネルは安定して動作すべきシステムとして使うのには適切ではあ | 352 | これらのカーネルは安定して動作すべきシステムとして使うのには適切ではあ |
347 | りませんし、カーネルブランチの中でももっとも動作にリスクが高いものです。 | 353 | りませんし、カーネルブランチの中でももっとも動作にリスクが高いものです。 |
@@ -395,13 +401,15 @@ linux-kernel メーリングリストで収集された多数のパッチと同 | |||
395 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 401 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> |
396 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 402 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git |
397 | 403 | ||
398 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | 404 | - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com> |
399 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 405 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git |
400 | 406 | ||
407 | - x86, Ingo Molnar <mingo@elte.hu> | ||
408 | git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git | ||
409 | |||
401 | quilt ツリー- | 410 | quilt ツリー- |
402 | - USB, PCI ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de> | 411 | - USB, ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de> |
403 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | 412 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ |
404 | - x86-64 と i386 の仲間 Andi Kleen <ak@suse.de> | ||
405 | 413 | ||
406 | その他のカーネルツリーは http://git.kernel.org/ と MAINTAINERS ファ | 414 | その他のカーネルツリーは http://git.kernel.org/ と MAINTAINERS ファ |
407 | イルに一覧表があります。 | 415 | イルに一覧表があります。 |
@@ -412,13 +420,32 @@ linux-kernel メーリングリストで収集された多数のパッチと同 | |||
412 | bugzilla.kernel.org は Linux カーネル開発者がカーネルのバグを追跡する | 420 | bugzilla.kernel.org は Linux カーネル開発者がカーネルのバグを追跡する |
413 | 場所です。ユーザは見つけたバグの全てをこのツールで報告すべきです。 | 421 | 場所です。ユーザは見つけたバグの全てをこのツールで報告すべきです。 |
414 | どう kernel bugzilla を使うかの詳細は、以下を参照してください- | 422 | どう kernel bugzilla を使うかの詳細は、以下を参照してください- |
415 | http://test.kernel.org/bugzilla/faq.html | 423 | http://bugzilla.kernel.org/page.cgi?id=faq.html |
416 | |||
417 | メインカーネルソースディレクトリにあるファイル REPORTING-BUGS はカーネ | 424 | メインカーネルソースディレクトリにあるファイル REPORTING-BUGS はカーネ |
418 | ルバグらしいものについてどうレポートするかの良いテンプレートであり、問 | 425 | ルバグらしいものについてどうレポートするかの良いテンプレートであり、問 |
419 | 題の追跡を助けるためにカーネル開発者にとってどんな情報が必要なのかの詳 | 426 | 題の追跡を助けるためにカーネル開発者にとってどんな情報が必要なのかの詳 |
420 | 細が書かれています。 | 427 | 細が書かれています。 |
421 | 428 | ||
429 | バグレポートの管理 | ||
430 | ------------------- | ||
431 | |||
432 | あなたのハッキングのスキルを訓練する最高の方法のひとつに、他人がレポー | ||
433 | トしたバグを修正することがあります。あなたがカーネルをより安定化させる | ||
434 | こに寄与するということだけでなく、あなたは 現実の問題を修正することを | ||
435 | 学び、自分のスキルも強化でき、また他の開発者があなたの存在に気がつき | ||
436 | ます。バグを修正することは、多くの開発者の中から自分が功績をあげる最善 | ||
437 | の道です、なぜなら多くの人は他人のバグの修正に時間を浪費することを好ま | ||
438 | ないからです。 | ||
439 | |||
440 | すでにレポートされたバグのために仕事をするためには、 | ||
441 | http://bugzilla.kernel.org に行ってください。もし今後のバグレポートに | ||
442 | ついてアドバイスを受けたいのであれば、bugme-new メーリングリスト(新し | ||
443 | いバグレポートだけがここにメールされる) または bugme-janitor メーリン | ||
444 | グリスト(bugzilla の変更毎にここにメールされる)を購読できます。 | ||
445 | |||
446 | http://lists.linux-foundation.org/mailman/listinfo/bugme-new | ||
447 | http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors | ||
448 | |||
422 | メーリングリスト | 449 | メーリングリスト |
423 | ------------- | 450 | ------------- |
424 | 451 | ||
diff --git a/Documentation/ja_JP/SubmitChecklist b/Documentation/ja_JP/SubmitChecklist new file mode 100644 index 000000000000..6c42e071d723 --- /dev/null +++ b/Documentation/ja_JP/SubmitChecklist | |||
@@ -0,0 +1,111 @@ | |||
1 | NOTE: | ||
2 | This is a version of Documentation/SubmitChecklist into Japanese. | ||
3 | This document is maintained by Takenori Nagano <t-nagano@ah.jp.nec.com> | ||
4 | and the JF Project team <http://www.linux.or.jp/JF/>. | ||
5 | If you find any difference between this document and the original file | ||
6 | or a problem with the translation, | ||
7 | please contact the maintainer of this file or JF project. | ||
8 | |||
9 | Please also note that the purpose of this file is to be easier to read | ||
10 | for non English (read: Japanese) speakers and is not intended as a | ||
11 | fork. So if you have any comments or updates of this file, please try | ||
12 | to update the original English file first. | ||
13 | |||
14 | Last Updated: 2008/07/14 | ||
15 | ================================== | ||
16 | これは、 | ||
17 | linux-2.6.26/Documentation/SubmitChecklist の和訳です。 | ||
18 | |||
19 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > | ||
20 | 翻訳日: 2008/07/14 | ||
21 | 翻訳者: Takenori Nagano <t-nagano at ah dot jp dot nec dot com> | ||
22 | 校正者: Masanori Kobayashi さん <zap03216 at nifty dot ne dot jp> | ||
23 | ================================== | ||
24 | |||
25 | |||
26 | Linux カーネルパッチ投稿者向けチェックリスト | ||
27 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
28 | |||
29 | 本書では、パッチをより素早く取り込んでもらいたい開発者が実践すべき基本的な事柄 | ||
30 | をいくつか紹介します。ここにある全ての事柄は、Documentation/SubmittingPatches | ||
31 | などのLinuxカーネルパッチ投稿に際しての心得を補足するものです。 | ||
32 | |||
33 | 1: 妥当なCONFIGオプションや変更されたCONFIGオプション、つまり =y, =m, =n | ||
34 | 全てで正しくビルドできることを確認してください。その際、gcc及びリンカが | ||
35 | warningやerrorを出していないことも確認してください。 | ||
36 | |||
37 | 2: allnoconfig, allmodconfig オプションを用いて正しくビルドできることを | ||
38 | 確認してください。 | ||
39 | |||
40 | 3: 手許のクロスコンパイルツールやOSDLのPLMのようなものを用いて、複数の | ||
41 | アーキテクチャにおいても正しくビルドできることを確認してください。 | ||
42 | |||
43 | 4: 64bit長の'unsigned long'を使用しているppc64は、クロスコンパイルでの | ||
44 | チェックに適当なアーキテクチャです。 | ||
45 | |||
46 | 5: カーネルコーディングスタイルに準拠しているかどうか確認してください(!) | ||
47 | |||
48 | 6: CONFIGオプションの追加・変更をした場合には、CONFIGメニューが壊れていない | ||
49 | ことを確認してください。 | ||
50 | |||
51 | 7: 新しくKconfigのオプションを追加する際には、必ずそのhelpも記述してください。 | ||
52 | |||
53 | 8: 適切なKconfigの依存関係を考えながら慎重にチェックしてください。 | ||
54 | ただし、この作業はマシンを使ったテストできちんと行うのがとても困難です。 | ||
55 | うまくやるには、自分の頭で考えることです。 | ||
56 | |||
57 | 9: sparseを利用してちゃんとしたコードチェックをしてください。 | ||
58 | |||
59 | 10: 'make checkstack' と 'make namespacecheck' を利用し、問題が発見されたら | ||
60 | 修正してください。'make checkstack' は明示的に問題を示しませんが、どれか | ||
61 | 1つの関数が512バイトより大きいスタックを使っていれば、修正すべき候補と | ||
62 | なります。 | ||
63 | |||
64 | 11: グローバルなkernel API を説明する kernel-doc をソースの中に含めてください。 | ||
65 | ( staticな関数においては必須ではありませんが、含めてもらっても結構です ) | ||
66 | そして、'make htmldocs' もしくは 'make mandocs' を利用して追記した | ||
67 | ドキュメントのチェックを行い、問題が見つかった場合には修正を行ってください。 | ||
68 | |||
69 | 12: CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB, | ||
70 | CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_SPINLOCK, | ||
71 | CONFIG_DEBUG_SPINLOCK_SLEEP これら全てを同時に有効にして動作確認を | ||
72 | 行ってください。 | ||
73 | |||
74 | 13: CONFIG_SMP, CONFIG_PREEMPT を有効にした場合と無効にした場合の両方で | ||
75 | ビルドした上、動作確認を行ってください。 | ||
76 | |||
77 | 14: もしパッチがディスクのI/O性能などに影響を与えるようであれば、 | ||
78 | 'CONFIG_LBD'オプションを有効にした場合と無効にした場合の両方で | ||
79 | テストを実施してみてください。 | ||
80 | |||
81 | 15: lockdepの機能を全て有効にした上で、全てのコードパスを評価してください。 | ||
82 | |||
83 | 16: /proc に新しいエントリを追加した場合には、Documentation/ 配下に | ||
84 | 必ずドキュメントを追加してください。 | ||
85 | |||
86 | 17: 新しいブートパラメータを追加した場合には、 | ||
87 | 必ずDocumentation/kernel-parameters.txt に説明を追加してください。 | ||
88 | |||
89 | 18: 新しくmoduleにパラメータを追加した場合には、MODULE_PARM_DESC()を | ||
90 | 利用して必ずその説明を記述してください。 | ||
91 | |||
92 | 19: 新しいuserspaceインタフェースを作成した場合には、Documentation/ABI/ に | ||
93 | Documentation/ABI/README を参考にして必ずドキュメントを追加してください。 | ||
94 | |||
95 | 20: 'make headers_check'を実行して全く問題がないことを確認してください。 | ||
96 | |||
97 | 21: 少なくともslabアロケーションとpageアロケーションに失敗した場合の | ||
98 | 挙動について、fault-injectionを利用して確認してください。 | ||
99 | Documentation/fault-injection/ を参照してください。 | ||
100 | |||
101 | 追加したコードがかなりの量であったならば、サブシステム特有の | ||
102 | fault-injectionを追加したほうが良いかもしれません。 | ||
103 | |||
104 | 22: 新たに追加したコードは、`gcc -W'でコンパイルしてください。 | ||
105 | このオプションは大量の不要なメッセージを出力しますが、 | ||
106 | "warning: comparison between signed and unsigned" のようなメッセージは、 | ||
107 | バグを見つけるのに役に立ちます。 | ||
108 | |||
109 | 23: 投稿したパッチが -mm パッチセットにマージされた後、全ての既存のパッチや | ||
110 | VM, VFS およびその他のサブシステムに関する様々な変更と、現時点でも共存 | ||
111 | できることを確認するテストを行ってください。 | ||
diff --git a/block/genhd.c b/block/genhd.c index c13cc77291af..656c2c7abf99 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -293,27 +293,30 @@ void __init printk_all_partitions(void) | |||
293 | /* iterator */ | 293 | /* iterator */ |
294 | static int find_start(struct device *dev, void *data) | 294 | static int find_start(struct device *dev, void *data) |
295 | { | 295 | { |
296 | loff_t k = *(loff_t *)data; | 296 | loff_t *k = data; |
297 | 297 | ||
298 | if (dev->type != &disk_type) | 298 | if (dev->type != &disk_type) |
299 | return 0; | 299 | return 0; |
300 | if (!k--) | 300 | if (!*k) |
301 | return 1; | 301 | return 1; |
302 | (*k)--; | ||
302 | return 0; | 303 | return 0; |
303 | } | 304 | } |
304 | 305 | ||
305 | static void *part_start(struct seq_file *part, loff_t *pos) | 306 | static void *part_start(struct seq_file *part, loff_t *pos) |
306 | { | 307 | { |
307 | struct device *dev; | 308 | struct device *dev; |
308 | loff_t n = *pos; | 309 | loff_t k = *pos; |
309 | 310 | ||
310 | if (!n) | 311 | if (!k) |
311 | seq_puts(part, "major minor #blocks name\n\n"); | 312 | seq_puts(part, "major minor #blocks name\n\n"); |
312 | 313 | ||
313 | mutex_lock(&block_class_lock); | 314 | mutex_lock(&block_class_lock); |
314 | dev = class_find_device(&block_class, NULL, (void *)pos, find_start); | 315 | dev = class_find_device(&block_class, NULL, &k, find_start); |
315 | if (dev) | 316 | if (dev) { |
317 | put_device(dev); | ||
316 | return dev_to_disk(dev); | 318 | return dev_to_disk(dev); |
319 | } | ||
317 | return NULL; | 320 | return NULL; |
318 | } | 321 | } |
319 | 322 | ||
@@ -330,8 +333,10 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos) | |||
330 | struct device *dev; | 333 | struct device *dev; |
331 | ++*pos; | 334 | ++*pos; |
332 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); | 335 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
333 | if (dev) | 336 | if (dev) { |
337 | put_device(dev); | ||
334 | return dev_to_disk(dev); | 338 | return dev_to_disk(dev); |
339 | } | ||
335 | return NULL; | 340 | return NULL; |
336 | } | 341 | } |
337 | 342 | ||
@@ -568,11 +573,14 @@ static struct device_type disk_type = { | |||
568 | static void *diskstats_start(struct seq_file *part, loff_t *pos) | 573 | static void *diskstats_start(struct seq_file *part, loff_t *pos) |
569 | { | 574 | { |
570 | struct device *dev; | 575 | struct device *dev; |
576 | loff_t k = *pos; | ||
571 | 577 | ||
572 | mutex_lock(&block_class_lock); | 578 | mutex_lock(&block_class_lock); |
573 | dev = class_find_device(&block_class, NULL, (void *)pos, find_start); | 579 | dev = class_find_device(&block_class, NULL, &k, find_start); |
574 | if (dev) | 580 | if (dev) { |
581 | put_device(dev); | ||
575 | return dev_to_disk(dev); | 582 | return dev_to_disk(dev); |
583 | } | ||
576 | return NULL; | 584 | return NULL; |
577 | } | 585 | } |
578 | 586 | ||
@@ -583,8 +591,10 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
583 | 591 | ||
584 | ++*pos; | 592 | ++*pos; |
585 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); | 593 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
586 | if (dev) | 594 | if (dev) { |
595 | put_device(dev); | ||
587 | return dev_to_disk(dev); | 596 | return dev_to_disk(dev); |
597 | } | ||
588 | return NULL; | 598 | return NULL; |
589 | } | 599 | } |
590 | 600 | ||
@@ -712,10 +722,12 @@ dev_t blk_lookup_devt(const char *name, int part) | |||
712 | mutex_lock(&block_class_lock); | 722 | mutex_lock(&block_class_lock); |
713 | find.name = name; | 723 | find.name = name; |
714 | find.part = part; | 724 | find.part = part; |
715 | dev = class_find_device(&block_class, NULL, (void *)&find, match_id); | 725 | dev = class_find_device(&block_class, NULL, &find, match_id); |
716 | if (dev) | 726 | if (dev) { |
727 | put_device(dev); | ||
717 | devt = MKDEV(MAJOR(dev->devt), | 728 | devt = MKDEV(MAJOR(dev->devt), |
718 | MINOR(dev->devt) + part); | 729 | MINOR(dev->devt) + part); |
730 | } | ||
719 | mutex_unlock(&block_class_lock); | 731 | mutex_unlock(&block_class_lock); |
720 | 732 | ||
721 | return devt; | 733 | return devt; |
diff --git a/drivers/base/class.c b/drivers/base/class.c index 5667c2f02c51..cc5e28c8885c 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -295,6 +295,12 @@ int class_for_each_device(struct class *class, struct device *start, | |||
295 | 295 | ||
296 | if (!class) | 296 | if (!class) |
297 | return -EINVAL; | 297 | return -EINVAL; |
298 | if (!class->p) { | ||
299 | WARN(1, "%s called for class '%s' before it was initialized", | ||
300 | __func__, class->name); | ||
301 | return -EINVAL; | ||
302 | } | ||
303 | |||
298 | mutex_lock(&class->p->class_mutex); | 304 | mutex_lock(&class->p->class_mutex); |
299 | list_for_each_entry(dev, &class->p->class_devices, node) { | 305 | list_for_each_entry(dev, &class->p->class_devices, node) { |
300 | if (start) { | 306 | if (start) { |
@@ -344,6 +350,11 @@ struct device *class_find_device(struct class *class, struct device *start, | |||
344 | 350 | ||
345 | if (!class) | 351 | if (!class) |
346 | return NULL; | 352 | return NULL; |
353 | if (!class->p) { | ||
354 | WARN(1, "%s called for class '%s' before it was initialized", | ||
355 | __func__, class->name); | ||
356 | return NULL; | ||
357 | } | ||
347 | 358 | ||
348 | mutex_lock(&class->p->class_mutex); | 359 | mutex_lock(&class->p->class_mutex); |
349 | list_for_each_entry(dev, &class->p->class_devices, node) { | 360 | list_for_each_entry(dev, &class->p->class_devices, node) { |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 068aa1c9538c..d021c98605b3 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -53,7 +53,7 @@ static inline int device_is_not_partition(struct device *dev) | |||
53 | * it is attached to. If it is not attached to a bus either, an empty | 53 | * it is attached to. If it is not attached to a bus either, an empty |
54 | * string will be returned. | 54 | * string will be returned. |
55 | */ | 55 | */ |
56 | const char *dev_driver_string(struct device *dev) | 56 | const char *dev_driver_string(const struct device *dev) |
57 | { | 57 | { |
58 | return dev->driver ? dev->driver->name : | 58 | return dev->driver ? dev->driver->name : |
59 | (dev->bus ? dev->bus->name : | 59 | (dev->bus ? dev->bus->name : |
@@ -541,6 +541,7 @@ void device_initialize(struct device *dev) | |||
541 | spin_lock_init(&dev->devres_lock); | 541 | spin_lock_init(&dev->devres_lock); |
542 | INIT_LIST_HEAD(&dev->devres_head); | 542 | INIT_LIST_HEAD(&dev->devres_head); |
543 | device_init_wakeup(dev, 0); | 543 | device_init_wakeup(dev, 0); |
544 | device_pm_init(dev); | ||
544 | set_dev_node(dev, -1); | 545 | set_dev_node(dev, -1); |
545 | } | 546 | } |
546 | 547 | ||
@@ -843,13 +844,19 @@ int device_add(struct device *dev) | |||
843 | { | 844 | { |
844 | struct device *parent = NULL; | 845 | struct device *parent = NULL; |
845 | struct class_interface *class_intf; | 846 | struct class_interface *class_intf; |
846 | int error; | 847 | int error = -EINVAL; |
847 | 848 | ||
848 | dev = get_device(dev); | 849 | dev = get_device(dev); |
849 | if (!dev || !strlen(dev->bus_id)) { | 850 | if (!dev) |
850 | error = -EINVAL; | 851 | goto done; |
851 | goto Done; | 852 | |
852 | } | 853 | /* Temporarily support init_name if it is set. |
854 | * It will override bus_id for now */ | ||
855 | if (dev->init_name) | ||
856 | dev_set_name(dev, "%s", dev->init_name); | ||
857 | |||
858 | if (!strlen(dev->bus_id)) | ||
859 | goto done; | ||
853 | 860 | ||
854 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); | 861 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); |
855 | 862 | ||
@@ -897,9 +904,10 @@ int device_add(struct device *dev) | |||
897 | error = bus_add_device(dev); | 904 | error = bus_add_device(dev); |
898 | if (error) | 905 | if (error) |
899 | goto BusError; | 906 | goto BusError; |
900 | error = device_pm_add(dev); | 907 | error = dpm_sysfs_add(dev); |
901 | if (error) | 908 | if (error) |
902 | goto PMError; | 909 | goto DPMError; |
910 | device_pm_add(dev); | ||
903 | kobject_uevent(&dev->kobj, KOBJ_ADD); | 911 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
904 | bus_attach_device(dev); | 912 | bus_attach_device(dev); |
905 | if (parent) | 913 | if (parent) |
@@ -917,10 +925,10 @@ int device_add(struct device *dev) | |||
917 | class_intf->add_dev(dev, class_intf); | 925 | class_intf->add_dev(dev, class_intf); |
918 | mutex_unlock(&dev->class->p->class_mutex); | 926 | mutex_unlock(&dev->class->p->class_mutex); |
919 | } | 927 | } |
920 | Done: | 928 | done: |
921 | put_device(dev); | 929 | put_device(dev); |
922 | return error; | 930 | return error; |
923 | PMError: | 931 | DPMError: |
924 | bus_remove_device(dev); | 932 | bus_remove_device(dev); |
925 | BusError: | 933 | BusError: |
926 | if (dev->bus) | 934 | if (dev->bus) |
@@ -944,7 +952,7 @@ int device_add(struct device *dev) | |||
944 | cleanup_device_parent(dev); | 952 | cleanup_device_parent(dev); |
945 | if (parent) | 953 | if (parent) |
946 | put_device(parent); | 954 | put_device(parent); |
947 | goto Done; | 955 | goto done; |
948 | } | 956 | } |
949 | 957 | ||
950 | /** | 958 | /** |
@@ -1007,6 +1015,7 @@ void device_del(struct device *dev) | |||
1007 | struct class_interface *class_intf; | 1015 | struct class_interface *class_intf; |
1008 | 1016 | ||
1009 | device_pm_remove(dev); | 1017 | device_pm_remove(dev); |
1018 | dpm_sysfs_remove(dev); | ||
1010 | if (parent) | 1019 | if (parent) |
1011 | klist_del(&dev->knode_parent); | 1020 | klist_del(&dev->knode_parent); |
1012 | if (MAJOR(dev->devt)) { | 1021 | if (MAJOR(dev->devt)) { |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 2ef5acf4368b..1e2bda780e48 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -16,9 +16,6 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include "base.h" | 17 | #include "base.h" |
18 | 18 | ||
19 | #define to_dev(node) container_of(node, struct device, driver_list) | ||
20 | |||
21 | |||
22 | static struct device *next_device(struct klist_iter *i) | 19 | static struct device *next_device(struct klist_iter *i) |
23 | { | 20 | { |
24 | struct klist_node *n = klist_next(i); | 21 | struct klist_node *n = klist_next(i); |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 3250c5257b74..273a944d4040 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -67,20 +67,16 @@ void device_pm_unlock(void) | |||
67 | * device_pm_add - add a device to the list of active devices | 67 | * device_pm_add - add a device to the list of active devices |
68 | * @dev: Device to be added to the list | 68 | * @dev: Device to be added to the list |
69 | */ | 69 | */ |
70 | int device_pm_add(struct device *dev) | 70 | void device_pm_add(struct device *dev) |
71 | { | 71 | { |
72 | int error; | ||
73 | |||
74 | pr_debug("PM: Adding info for %s:%s\n", | 72 | pr_debug("PM: Adding info for %s:%s\n", |
75 | dev->bus ? dev->bus->name : "No Bus", | 73 | dev->bus ? dev->bus->name : "No Bus", |
76 | kobject_name(&dev->kobj)); | 74 | kobject_name(&dev->kobj)); |
77 | mutex_lock(&dpm_list_mtx); | 75 | mutex_lock(&dpm_list_mtx); |
78 | if (dev->parent) { | 76 | if (dev->parent) { |
79 | if (dev->parent->power.status >= DPM_SUSPENDING) { | 77 | if (dev->parent->power.status >= DPM_SUSPENDING) |
80 | dev_warn(dev, "parent %s is sleeping, will not add\n", | 78 | dev_warn(dev, "parent %s should not be sleeping\n", |
81 | dev->parent->bus_id); | 79 | dev->parent->bus_id); |
82 | WARN_ON(true); | ||
83 | } | ||
84 | } else if (transition_started) { | 80 | } else if (transition_started) { |
85 | /* | 81 | /* |
86 | * We refuse to register parentless devices while a PM | 82 | * We refuse to register parentless devices while a PM |
@@ -89,13 +85,9 @@ int device_pm_add(struct device *dev) | |||
89 | */ | 85 | */ |
90 | WARN_ON(true); | 86 | WARN_ON(true); |
91 | } | 87 | } |
92 | error = dpm_sysfs_add(dev); | 88 | |
93 | if (!error) { | 89 | list_add_tail(&dev->power.entry, &dpm_list); |
94 | dev->power.status = DPM_ON; | ||
95 | list_add_tail(&dev->power.entry, &dpm_list); | ||
96 | } | ||
97 | mutex_unlock(&dpm_list_mtx); | 90 | mutex_unlock(&dpm_list_mtx); |
98 | return error; | ||
99 | } | 91 | } |
100 | 92 | ||
101 | /** | 93 | /** |
@@ -110,7 +102,6 @@ void device_pm_remove(struct device *dev) | |||
110 | dev->bus ? dev->bus->name : "No Bus", | 102 | dev->bus ? dev->bus->name : "No Bus", |
111 | kobject_name(&dev->kobj)); | 103 | kobject_name(&dev->kobj)); |
112 | mutex_lock(&dpm_list_mtx); | 104 | mutex_lock(&dpm_list_mtx); |
113 | dpm_sysfs_remove(dev); | ||
114 | list_del_init(&dev->power.entry); | 105 | list_del_init(&dev->power.entry); |
115 | mutex_unlock(&dpm_list_mtx); | 106 | mutex_unlock(&dpm_list_mtx); |
116 | } | 107 | } |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index a3252c0e2887..41f51fae042f 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
@@ -1,3 +1,8 @@ | |||
1 | static inline void device_pm_init(struct device *dev) | ||
2 | { | ||
3 | dev->power.status = DPM_ON; | ||
4 | } | ||
5 | |||
1 | #ifdef CONFIG_PM_SLEEP | 6 | #ifdef CONFIG_PM_SLEEP |
2 | 7 | ||
3 | /* | 8 | /* |
@@ -11,12 +16,12 @@ static inline struct device *to_device(struct list_head *entry) | |||
11 | return container_of(entry, struct device, power.entry); | 16 | return container_of(entry, struct device, power.entry); |
12 | } | 17 | } |
13 | 18 | ||
14 | extern int device_pm_add(struct device *); | 19 | extern void device_pm_add(struct device *); |
15 | extern void device_pm_remove(struct device *); | 20 | extern void device_pm_remove(struct device *); |
16 | 21 | ||
17 | #else /* CONFIG_PM_SLEEP */ | 22 | #else /* CONFIG_PM_SLEEP */ |
18 | 23 | ||
19 | static inline int device_pm_add(struct device *dev) { return 0; } | 24 | static inline void device_pm_add(struct device *dev) {} |
20 | static inline void device_pm_remove(struct device *dev) {} | 25 | static inline void device_pm_remove(struct device *dev) {} |
21 | 26 | ||
22 | #endif | 27 | #endif |
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 2e9079df26b3..4190be64917f 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
@@ -33,6 +33,19 @@ config UIO_PDRV | |||
33 | 33 | ||
34 | If you don't know what to do here, say N. | 34 | If you don't know what to do here, say N. |
35 | 35 | ||
36 | config UIO_PDRV_GENIRQ | ||
37 | tristate "Userspace I/O platform driver with generic IRQ handling" | ||
38 | help | ||
39 | Platform driver for Userspace I/O devices, including generic | ||
40 | interrupt handling code. Shared interrupts are not supported. | ||
41 | |||
42 | This kernel driver requires that the matching userspace driver | ||
43 | handles interrupts in a special way. Userspace is responsible | ||
44 | for acknowledging the hardware device if needed, and re-enabling | ||
45 | interrupts in the interrupt controller using the write() syscall. | ||
46 | |||
47 | If you don't know what to do here, say N. | ||
48 | |||
36 | config UIO_SMX | 49 | config UIO_SMX |
37 | tristate "SMX cryptengine UIO interface" | 50 | tristate "SMX cryptengine UIO interface" |
38 | default n | 51 | default n |
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index e00ce0def1a0..8667bbdef904 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_UIO) += uio.o | 1 | obj-$(CONFIG_UIO) += uio.o |
2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o | 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o |
3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o | 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o |
4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o | ||
4 | obj-$(CONFIG_UIO_SMX) += uio_smx.o | 5 | obj-$(CONFIG_UIO_SMX) += uio_smx.o |
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c index 5d0d2e85d982..0b4ef39cd85d 100644 --- a/drivers/uio/uio_pdrv.c +++ b/drivers/uio/uio_pdrv.c | |||
@@ -88,6 +88,8 @@ static int uio_pdrv_remove(struct platform_device *pdev) | |||
88 | 88 | ||
89 | uio_unregister_device(pdata->uioinfo); | 89 | uio_unregister_device(pdata->uioinfo); |
90 | 90 | ||
91 | kfree(pdata); | ||
92 | |||
91 | return 0; | 93 | return 0; |
92 | } | 94 | } |
93 | 95 | ||
@@ -114,5 +116,5 @@ module_exit(uio_pdrv_exit); | |||
114 | 116 | ||
115 | MODULE_AUTHOR("Uwe Kleine-Koenig"); | 117 | MODULE_AUTHOR("Uwe Kleine-Koenig"); |
116 | MODULE_DESCRIPTION("Userspace I/O platform driver"); | 118 | MODULE_DESCRIPTION("Userspace I/O platform driver"); |
117 | MODULE_LICENSE("GPL"); | 119 | MODULE_LICENSE("GPL v2"); |
118 | MODULE_ALIAS("platform:" DRIVER_NAME); | 120 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c new file mode 100644 index 000000000000..1f82c83a92ae --- /dev/null +++ b/drivers/uio/uio_pdrv_genirq.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | * drivers/uio/uio_pdrv_genirq.c | ||
3 | * | ||
4 | * Userspace I/O platform driver with generic IRQ handling code. | ||
5 | * | ||
6 | * Copyright (C) 2008 Magnus Damm | ||
7 | * | ||
8 | * Based on uio_pdrv.c by Uwe Kleine-Koenig, | ||
9 | * Copyright (C) 2008 by Digi International Inc. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License version 2 as published by | ||
14 | * the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/uio_driver.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/bitops.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/stringify.h> | ||
23 | |||
24 | #define DRIVER_NAME "uio_pdrv_genirq" | ||
25 | |||
26 | struct uio_pdrv_genirq_platdata { | ||
27 | struct uio_info *uioinfo; | ||
28 | spinlock_t lock; | ||
29 | unsigned long flags; | ||
30 | }; | ||
31 | |||
32 | static irqreturn_t uio_pdrv_genirq_handler(int irq, struct uio_info *dev_info) | ||
33 | { | ||
34 | struct uio_pdrv_genirq_platdata *priv = dev_info->priv; | ||
35 | |||
36 | /* Just disable the interrupt in the interrupt controller, and | ||
37 | * remember the state so we can allow user space to enable it later. | ||
38 | */ | ||
39 | |||
40 | if (!test_and_set_bit(0, &priv->flags)) | ||
41 | disable_irq_nosync(irq); | ||
42 | |||
43 | return IRQ_HANDLED; | ||
44 | } | ||
45 | |||
46 | static int uio_pdrv_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on) | ||
47 | { | ||
48 | struct uio_pdrv_genirq_platdata *priv = dev_info->priv; | ||
49 | unsigned long flags; | ||
50 | |||
51 | /* Allow user space to enable and disable the interrupt | ||
52 | * in the interrupt controller, but keep track of the | ||
53 | * state to prevent per-irq depth damage. | ||
54 | * | ||
55 | * Serialize this operation to support multiple tasks. | ||
56 | */ | ||
57 | |||
58 | spin_lock_irqsave(&priv->lock, flags); | ||
59 | if (irq_on) { | ||
60 | if (test_and_clear_bit(0, &priv->flags)) | ||
61 | enable_irq(dev_info->irq); | ||
62 | } else { | ||
63 | if (!test_and_set_bit(0, &priv->flags)) | ||
64 | disable_irq(dev_info->irq); | ||
65 | } | ||
66 | spin_unlock_irqrestore(&priv->lock, flags); | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static int uio_pdrv_genirq_probe(struct platform_device *pdev) | ||
72 | { | ||
73 | struct uio_info *uioinfo = pdev->dev.platform_data; | ||
74 | struct uio_pdrv_genirq_platdata *priv; | ||
75 | struct uio_mem *uiomem; | ||
76 | int ret = -EINVAL; | ||
77 | int i; | ||
78 | |||
79 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { | ||
80 | dev_err(&pdev->dev, "missing platform_data\n"); | ||
81 | goto bad0; | ||
82 | } | ||
83 | |||
84 | if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) { | ||
85 | dev_err(&pdev->dev, "interrupt configuration error\n"); | ||
86 | goto bad0; | ||
87 | } | ||
88 | |||
89 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
90 | if (!priv) { | ||
91 | ret = -ENOMEM; | ||
92 | dev_err(&pdev->dev, "unable to kmalloc\n"); | ||
93 | goto bad0; | ||
94 | } | ||
95 | |||
96 | priv->uioinfo = uioinfo; | ||
97 | spin_lock_init(&priv->lock); | ||
98 | priv->flags = 0; /* interrupt is enabled to begin with */ | ||
99 | |||
100 | uiomem = &uioinfo->mem[0]; | ||
101 | |||
102 | for (i = 0; i < pdev->num_resources; ++i) { | ||
103 | struct resource *r = &pdev->resource[i]; | ||
104 | |||
105 | if (r->flags != IORESOURCE_MEM) | ||
106 | continue; | ||
107 | |||
108 | if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) { | ||
109 | dev_warn(&pdev->dev, "device has more than " | ||
110 | __stringify(MAX_UIO_MAPS) | ||
111 | " I/O memory resources.\n"); | ||
112 | break; | ||
113 | } | ||
114 | |||
115 | uiomem->memtype = UIO_MEM_PHYS; | ||
116 | uiomem->addr = r->start; | ||
117 | uiomem->size = r->end - r->start + 1; | ||
118 | ++uiomem; | ||
119 | } | ||
120 | |||
121 | while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) { | ||
122 | uiomem->size = 0; | ||
123 | ++uiomem; | ||
124 | } | ||
125 | |||
126 | /* This driver requires no hardware specific kernel code to handle | ||
127 | * interrupts. Instead, the interrupt handler simply disables the | ||
128 | * interrupt in the interrupt controller. User space is responsible | ||
129 | * for performing hardware specific acknowledge and re-enabling of | ||
130 | * the interrupt in the interrupt controller. | ||
131 | * | ||
132 | * Interrupt sharing is not supported. | ||
133 | */ | ||
134 | |||
135 | uioinfo->irq_flags = IRQF_DISABLED; | ||
136 | uioinfo->handler = uio_pdrv_genirq_handler; | ||
137 | uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol; | ||
138 | uioinfo->priv = priv; | ||
139 | |||
140 | ret = uio_register_device(&pdev->dev, priv->uioinfo); | ||
141 | if (ret) { | ||
142 | dev_err(&pdev->dev, "unable to register uio device\n"); | ||
143 | goto bad1; | ||
144 | } | ||
145 | |||
146 | platform_set_drvdata(pdev, priv); | ||
147 | return 0; | ||
148 | bad1: | ||
149 | kfree(priv); | ||
150 | bad0: | ||
151 | return ret; | ||
152 | } | ||
153 | |||
154 | static int uio_pdrv_genirq_remove(struct platform_device *pdev) | ||
155 | { | ||
156 | struct uio_pdrv_genirq_platdata *priv = platform_get_drvdata(pdev); | ||
157 | |||
158 | uio_unregister_device(priv->uioinfo); | ||
159 | kfree(priv); | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static struct platform_driver uio_pdrv_genirq = { | ||
164 | .probe = uio_pdrv_genirq_probe, | ||
165 | .remove = uio_pdrv_genirq_remove, | ||
166 | .driver = { | ||
167 | .name = DRIVER_NAME, | ||
168 | .owner = THIS_MODULE, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static int __init uio_pdrv_genirq_init(void) | ||
173 | { | ||
174 | return platform_driver_register(&uio_pdrv_genirq); | ||
175 | } | ||
176 | |||
177 | static void __exit uio_pdrv_genirq_exit(void) | ||
178 | { | ||
179 | platform_driver_unregister(&uio_pdrv_genirq); | ||
180 | } | ||
181 | |||
182 | module_init(uio_pdrv_genirq_init); | ||
183 | module_exit(uio_pdrv_genirq_exit); | ||
184 | |||
185 | MODULE_AUTHOR("Magnus Damm"); | ||
186 | MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling"); | ||
187 | MODULE_LICENSE("GPL v2"); | ||
188 | MODULE_ALIAS("platform:" DRIVER_NAME); | ||
diff --git a/include/linux/device.h b/include/linux/device.h index d24a47f80f9c..4d8372d135df 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -358,6 +358,7 @@ struct device { | |||
358 | 358 | ||
359 | struct kobject kobj; | 359 | struct kobject kobj; |
360 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 360 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
361 | const char *init_name; /* initial name of the device */ | ||
361 | struct device_type *type; | 362 | struct device_type *type; |
362 | unsigned uevent_suppress:1; | 363 | unsigned uevent_suppress:1; |
363 | 364 | ||
@@ -406,7 +407,7 @@ struct device { | |||
406 | /* Get the wakeup routines, which depend on struct device */ | 407 | /* Get the wakeup routines, which depend on struct device */ |
407 | #include <linux/pm_wakeup.h> | 408 | #include <linux/pm_wakeup.h> |
408 | 409 | ||
409 | static inline const char *dev_name(struct device *dev) | 410 | static inline const char *dev_name(const struct device *dev) |
410 | { | 411 | { |
411 | /* will be changed into kobject_name(&dev->kobj) in the near future */ | 412 | /* will be changed into kobject_name(&dev->kobj) in the near future */ |
412 | return dev->bus_id; | 413 | return dev->bus_id; |
@@ -518,7 +519,7 @@ extern void device_shutdown(void); | |||
518 | extern void sysdev_shutdown(void); | 519 | extern void sysdev_shutdown(void); |
519 | 520 | ||
520 | /* debugging and troubleshooting/diagnostic helpers. */ | 521 | /* debugging and troubleshooting/diagnostic helpers. */ |
521 | extern const char *dev_driver_string(struct device *dev); | 522 | extern const char *dev_driver_string(const struct device *dev); |
522 | #define dev_printk(level, dev, format, arg...) \ | 523 | #define dev_printk(level, dev, format, arg...) \ |
523 | printk(level "%s %s: " format , dev_driver_string(dev) , \ | 524 | printk(level "%s %s: " format , dev_driver_string(dev) , \ |
524 | dev_name(dev) , ## arg) | 525 | dev_name(dev) , ## arg) |
diff --git a/lib/kobject.c b/lib/kobject.c index bd732ffebc85..fbf0ae282376 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -223,8 +223,7 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | |||
223 | return -ENOMEM; | 223 | return -ENOMEM; |
224 | 224 | ||
225 | /* ewww... some of these buggers have '/' in the name ... */ | 225 | /* ewww... some of these buggers have '/' in the name ... */ |
226 | s = strchr(kobj->name, '/'); | 226 | while ((s = strchr(kobj->name, '/'))) |
227 | if (s) | ||
228 | s[0] = '!'; | 227 | s[0] = '!'; |
229 | 228 | ||
230 | kfree(old_name); | 229 | kfree(old_name); |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 4fa1f3ad2513..4c9890ec2528 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -344,14 +344,20 @@ static void do_pnp_device_entry(void *symval, unsigned long size, | |||
344 | struct module *mod) | 344 | struct module *mod) |
345 | { | 345 | { |
346 | const unsigned long id_size = sizeof(struct pnp_device_id); | 346 | const unsigned long id_size = sizeof(struct pnp_device_id); |
347 | const struct pnp_device_id *id = symval; | 347 | const unsigned int count = (size / id_size)-1; |
348 | const struct pnp_device_id *devs = symval; | ||
349 | unsigned int i; | ||
348 | 350 | ||
349 | device_id_check(mod->name, "pnp", size, id_size, symval); | 351 | device_id_check(mod->name, "pnp", size, id_size, symval); |
350 | 352 | ||
351 | buf_printf(&mod->dev_table_buf, | 353 | for (i = 0; i < count; i++) { |
352 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id->id); | 354 | const char *id = (char *)devs[i].id; |
353 | buf_printf(&mod->dev_table_buf, | 355 | |
354 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id->id); | 356 | buf_printf(&mod->dev_table_buf, |
357 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | ||
358 | buf_printf(&mod->dev_table_buf, | ||
359 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | ||
360 | } | ||
355 | } | 361 | } |
356 | 362 | ||
357 | /* looks like: "pnp:dD" for every device of the card */ | 363 | /* looks like: "pnp:dD" for every device of the card */ |