diff options
61 files changed, 1194 insertions, 1324 deletions
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO index b2446a090870..9f08dab1e75b 100644 --- a/Documentation/ja_JP/HOWTO +++ b/Documentation/ja_JP/HOWTO | |||
@@ -1,23 +1,24 @@ | |||
1 | NOTE: | 1 | NOTE: |
2 | This is Japanese translated version of "Documentation/HOWTO". | 2 | This is a version of Documentation/HOWTO translated into Japanese. |
3 | This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> | 3 | This document is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> |
4 | and JF Project team <www.linux.or.jp/JF>. | 4 | and the JF Project team <www.linux.or.jp/JF>. |
5 | If you find difference with original file or problem in translation, | 5 | If you find any difference between this document and the original file |
6 | please contact maintainer of this file or JF project. | 6 | or a problem with the translation, |
7 | 7 | please contact the maintainer of this file or JF project. | |
8 | Please also note that purpose of this file is easier to read for non | 8 | |
9 | English natives and not to be intended to fork. So, if you have any | 9 | Please also note that the purpose of this file is to be easier to read |
10 | comments or updates of this file, please try to update Original(English) | 10 | for non English (read: Japanese) speakers and is not intended as a |
11 | file at first. | 11 | fork. So if you have any comments or updates for this file, please try |
12 | 12 | to update the original English file first. | |
13 | Last Updated: 2007/06/04 | 13 | |
14 | Last Updated: 2007/07/18 | ||
14 | ================================== | 15 | ================================== |
15 | これは、 | 16 | これは、 |
16 | linux-2.6.21/Documentation/HOWTO | 17 | linux-2.6.22/Documentation/HOWTO |
17 | の和訳です。 | 18 | の和訳です。 |
18 | 19 | ||
19 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > | 20 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > |
20 | 翻訳日: 2007/06/04 | 21 | 翻訳日: 2007/07/16 |
21 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | 22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> |
22 | 校正者: 松倉さん <nbh--mats at nifty dot com> | 23 | 校正者: 松倉さん <nbh--mats at nifty dot com> |
23 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | 24 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> |
@@ -52,6 +53,7 @@ Linux カーネル開発コミュニティと共に活動するやり方を学 | |||
52 | また、このコミュニティがなぜ今うまくまわっているのかという理由の一部も | 53 | また、このコミュニティがなぜ今うまくまわっているのかという理由の一部も |
53 | 説明しようと試みています。 | 54 | 説明しようと試みています。 |
54 | 55 | ||
56 | |||
55 | カーネルは 少量のアーキテクチャ依存部分がアセンブリ言語で書かれている | 57 | カーネルは 少量のアーキテクチャ依存部分がアセンブリ言語で書かれている |
56 | 以外は大部分は C 言語で書かれています。C言語をよく理解していることはカー | 58 | 以外は大部分は C 言語で書かれています。C言語をよく理解していることはカー |
57 | ネル開発者には必要です。アーキテクチャ向けの低レベル部分の開発をするの | 59 | ネル開発者には必要です。アーキテクチャ向けの低レベル部分の開発をするの |
@@ -141,6 +143,7 @@ Linux カーネルソースツリーは幅広い範囲のドキュメントを | |||
141 | これらのルールに従えばうまくいくことを保証することではありません | 143 | これらのルールに従えばうまくいくことを保証することではありません |
142 | が (すべてのパッチは内容とスタイルについて精査を受けるので)、 | 144 | が (すべてのパッチは内容とスタイルについて精査を受けるので)、 |
143 | ルールに従わなければ間違いなくうまくいかないでしょう。 | 145 | ルールに従わなければ間違いなくうまくいかないでしょう。 |
146 | |||
144 | この他にパッチを作る方法についてのよくできた記述は- | 147 | この他にパッチを作る方法についてのよくできた記述は- |
145 | 148 | ||
146 | "The Perfect Patch" | 149 | "The Perfect Patch" |
@@ -360,44 +363,42 @@ linux-kernel メーリングリストで収集された多数のパッチと同 | |||
360 | 363 | ||
361 | git ツリー- | 364 | git ツリー- |
362 | - Kbuild の開発ツリー、Sam Ravnborg <sam@ravnborg.org> | 365 | - Kbuild の開発ツリー、Sam Ravnborg <sam@ravnborg.org> |
363 | kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | 366 | git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git |
364 | 367 | ||
365 | - ACPI の開発ツリー、 Len Brown <len.brown@intel.com> | 368 | - ACPI の開発ツリー、 Len Brown <len.brown@intel.com> |
366 | kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | 369 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git |
367 | 370 | ||
368 | - Block の開発ツリー、Jens Axboe <axboe@suse.de> | 371 | - Block の開発ツリー、Jens Axboe <axboe@suse.de> |
369 | kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | 372 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git |
370 | 373 | ||
371 | - DRM の開発ツリー、Dave Airlie <airlied@linux.ie> | 374 | - DRM の開発ツリー、Dave Airlie <airlied@linux.ie> |
372 | kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git | 375 | git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git |
373 | 376 | ||
374 | - ia64 の開発ツリー、Tony Luck <tony.luck@intel.com> | 377 | - ia64 の開発ツリー、Tony Luck <tony.luck@intel.com> |
375 | kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git | 378 | git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git |
376 | |||
377 | - ieee1394 の開発ツリー、Jody McIntyre <scjody@modernduck.com> | ||
378 | kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git | ||
379 | 379 | ||
380 | - infiniband, Roland Dreier <rolandd@cisco.com> | 380 | - infiniband, Roland Dreier <rolandd@cisco.com> |
381 | kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | 381 | git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git |
382 | 382 | ||
383 | - libata, Jeff Garzik <jgarzik@pobox.com> | 383 | - libata, Jeff Garzik <jgarzik@pobox.com> |
384 | kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git | 384 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git |
385 | 385 | ||
386 | - ネットワークドライバ, Jeff Garzik <jgarzik@pobox.com> | 386 | - ネットワークドライバ, Jeff Garzik <jgarzik@pobox.com> |
387 | kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git | 387 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git |
388 | 388 | ||
389 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 389 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> |
390 | kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 390 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git |
391 | 391 | ||
392 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | 392 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> |
393 | kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 393 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git |
394 | |||
395 | その他の git カーネルツリーは http://kernel.org/git に一覧表がありま | ||
396 | す。 | ||
397 | 394 | ||
398 | quilt ツリー- | 395 | quilt ツリー- |
399 | - USB, PCI ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de> | 396 | - USB, PCI ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de> |
400 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | 397 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ |
398 | - x86-64 と i386 の仲間 Andi Kleen <ak@suse.de> | ||
399 | |||
400 | その他のカーネルツリーは http://git.kernel.org/ と MAINTAINERS ファ | ||
401 | イルに一覧表があります。 | ||
401 | 402 | ||
402 | バグレポート | 403 | バグレポート |
403 | ------------- | 404 | ------------- |
@@ -508,6 +509,7 @@ MAINTAINERS ファイルにリストがありますので参照してくださ | |||
508 | せん*。単に自分のパッチに対して指摘された問題を全て修正して再送すれば | 509 | せん*。単に自分のパッチに対して指摘された問題を全て修正して再送すれば |
509 | いいのです。 | 510 | いいのです。 |
510 | 511 | ||
512 | |||
511 | カーネルコミュニティと企業組織のちがい | 513 | カーネルコミュニティと企業組織のちがい |
512 | ----------------------------------------------------------------- | 514 | ----------------------------------------------------------------- |
513 | 515 | ||
@@ -577,6 +579,7 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を | |||
577 | かし、500行のパッチは、正しいことをレビューするのに数時間かかるかも | 579 | かし、500行のパッチは、正しいことをレビューするのに数時間かかるかも |
578 | しれません(時間はパッチのサイズなどにより指数関数に比例してかかりま | 580 | しれません(時間はパッチのサイズなどにより指数関数に比例してかかりま |
579 | す) | 581 | す) |
582 | |||
580 | 小さいパッチは何かあったときにデバッグもとても簡単になります。パッ | 583 | 小さいパッチは何かあったときにデバッグもとても簡単になります。パッ |
581 | チを1個1個取り除くのは、とても大きなパッチを当てた後に(かつ、何かお | 584 | チを1個1個取り除くのは、とても大きなパッチを当てた後に(かつ、何かお |
582 | かしくなった後で)解剖するのに比べればとても簡単です。 | 585 | かしくなった後で)解剖するのに比べればとても簡単です。 |
@@ -591,6 +594,7 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を | |||
591 | う。先生は簡潔な最高の解をみたいのです。良い生徒はこれを知って | 594 | う。先生は簡潔な最高の解をみたいのです。良い生徒はこれを知って |
592 | おり、そして最終解の前の中間作業を提出することは決してないので | 595 | おり、そして最終解の前の中間作業を提出することは決してないので |
593 | す" | 596 | す" |
597 | |||
594 | カーネル開発でもこれは同じです。メンテナー達とレビューア達は、 | 598 | カーネル開発でもこれは同じです。メンテナー達とレビューア達は、 |
595 | 問題を解決する解の背後になる思考プロセスをみたいとは思いません。 | 599 | 問題を解決する解の背後になる思考プロセスをみたいとは思いません。 |
596 | 彼らは単純であざやかな解決方法をみたいのです。 | 600 | 彼らは単純であざやかな解決方法をみたいのです。 |
diff --git a/Documentation/ja_JP/stable_api_nonsense.txt b/Documentation/ja_JP/stable_api_nonsense.txt index b3f2b27f0881..7653b5cbfed2 100644 --- a/Documentation/ja_JP/stable_api_nonsense.txt +++ b/Documentation/ja_JP/stable_api_nonsense.txt | |||
@@ -1,17 +1,17 @@ | |||
1 | NOTE: | 1 | NOTE: |
2 | This is a Japanese translated version of | 2 | This is a version of Documentation/stable_api_nonsense.txt into Japanese. |
3 | "Documentation/stable_api_nonsense.txt". | 3 | This document is maintained by IKEDA, Munehiro <m-ikeda@ds.jp.nec.com> |
4 | This one is maintained by | 4 | and the JF Project team <http://www.linux.or.jp/JF/>. |
5 | IKEDA, Munehiro <m-ikeda@ds.jp.nec.com> | 5 | If you find any difference between this document and the original file |
6 | and JF Project team <http://www.linux.or.jp/JF/>. | 6 | or a problem with the translation, |
7 | If you find difference with original file or problem in translation, | ||
8 | please contact the maintainer of this file or JF project. | 7 | please contact the maintainer of this file or JF project. |
9 | 8 | ||
10 | Please also note that purpose of this file is easier to read for non | 9 | Please also note that the purpose of this file is to be easier to read |
11 | English natives and not to be intended to fork. So, if you have any | 10 | for non English (read: Japanese) speakers and is not intended as a |
12 | comments or updates of this file, please try to update | 11 | fork. So if you have any comments or updates of this file, please try |
13 | Original(English) file at first. | 12 | to update the original English file first. |
14 | 13 | ||
14 | Last Updated: 2007/07/18 | ||
15 | ================================== | 15 | ================================== |
16 | これは、 | 16 | これは、 |
17 | linux-2.6.22-rc4/Documentation/stable_api_nonsense.txt の和訳 | 17 | linux-2.6.22-rc4/Documentation/stable_api_nonsense.txt の和訳 |
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index e44855513b3d..8ee49ee7c963 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt | |||
@@ -27,7 +27,6 @@ in detail, and briefly here: | |||
27 | - kobjects a simple object. | 27 | - kobjects a simple object. |
28 | - kset a set of objects of a certain type. | 28 | - kset a set of objects of a certain type. |
29 | - ktype a set of helpers for objects of a common type. | 29 | - ktype a set of helpers for objects of a common type. |
30 | - subsystem a controlling object for a number of ksets. | ||
31 | 30 | ||
32 | 31 | ||
33 | The kobject infrastructure maintains a close relationship with the | 32 | The kobject infrastructure maintains a close relationship with the |
@@ -54,13 +53,15 @@ embedded in larger data structures and replace fields they duplicate. | |||
54 | 1.2 Definition | 53 | 1.2 Definition |
55 | 54 | ||
56 | struct kobject { | 55 | struct kobject { |
56 | const char * k_name; | ||
57 | char name[KOBJ_NAME_LEN]; | 57 | char name[KOBJ_NAME_LEN]; |
58 | atomic_t refcount; | 58 | struct kref kref; |
59 | struct list_head entry; | 59 | struct list_head entry; |
60 | struct kobject * parent; | 60 | struct kobject * parent; |
61 | struct kset * kset; | 61 | struct kset * kset; |
62 | struct kobj_type * ktype; | 62 | struct kobj_type * ktype; |
63 | struct dentry * dentry; | 63 | struct sysfs_dirent * sd; |
64 | wait_queue_head_t poll; | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | void kobject_init(struct kobject *); | 67 | void kobject_init(struct kobject *); |
@@ -137,8 +138,7 @@ If a kobject does not have a parent when it is registered, its parent | |||
137 | becomes its dominant kset. | 138 | becomes its dominant kset. |
138 | 139 | ||
139 | If a kobject does not have a parent nor a dominant kset, its directory | 140 | If a kobject does not have a parent nor a dominant kset, its directory |
140 | is created at the top-level of the sysfs partition. This should only | 141 | is created at the top-level of the sysfs partition. |
141 | happen for kobjects that are embedded in a struct subsystem. | ||
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
@@ -150,10 +150,10 @@ A kset is a set of kobjects that are embedded in the same type. | |||
150 | 150 | ||
151 | 151 | ||
152 | struct kset { | 152 | struct kset { |
153 | struct subsystem * subsys; | ||
154 | struct kobj_type * ktype; | 153 | struct kobj_type * ktype; |
155 | struct list_head list; | 154 | struct list_head list; |
156 | struct kobject kobj; | 155 | struct kobject kobj; |
156 | struct kset_uevent_ops * uevent_ops; | ||
157 | }; | 157 | }; |
158 | 158 | ||
159 | 159 | ||
@@ -169,8 +169,7 @@ struct kobject * kset_find_obj(struct kset *, char *); | |||
169 | 169 | ||
170 | 170 | ||
171 | The type that the kobjects are embedded in is described by the ktype | 171 | The type that the kobjects are embedded in is described by the ktype |
172 | pointer. The subsystem that the kobject belongs to is pointed to by the | 172 | pointer. |
173 | subsys pointer. | ||
174 | 173 | ||
175 | A kset contains a kobject itself, meaning that it may be registered in | 174 | A kset contains a kobject itself, meaning that it may be registered in |
176 | the kobject hierarchy and exported via sysfs. More importantly, the | 175 | the kobject hierarchy and exported via sysfs. More importantly, the |
@@ -209,6 +208,58 @@ the hierarchy. | |||
209 | kset_find_obj() may be used to locate a kobject with a particular | 208 | kset_find_obj() may be used to locate a kobject with a particular |
210 | name. The kobject, if found, is returned. | 209 | name. The kobject, if found, is returned. |
211 | 210 | ||
211 | There are also some helper functions which names point to the formerly | ||
212 | existing "struct subsystem", whose functions have been taken over by | ||
213 | ksets. | ||
214 | |||
215 | |||
216 | decl_subsys(name,type,uevent_ops) | ||
217 | |||
218 | Declares a kset named '<name>_subsys' of type <type> with | ||
219 | uevent_ops <uevent_ops>. For example, | ||
220 | |||
221 | decl_subsys(devices, &ktype_device, &device_uevent_ops); | ||
222 | |||
223 | is equivalent to doing: | ||
224 | |||
225 | struct kset devices_subsys = { | ||
226 | .kobj = { | ||
227 | .name = "devices", | ||
228 | }, | ||
229 | .ktype = &ktype_devices, | ||
230 | .uevent_ops = &device_uevent_ops, | ||
231 | }; | ||
232 | |||
233 | |||
234 | The objects that are registered with a subsystem that use the | ||
235 | subsystem's default list must have their kset ptr set properly. These | ||
236 | objects may have embedded kobjects or ksets. The | ||
237 | following helpers make setting the kset easier: | ||
238 | |||
239 | |||
240 | kobj_set_kset_s(obj,subsys) | ||
241 | |||
242 | - Assumes that obj->kobj exists, and is a struct kobject. | ||
243 | - Sets the kset of that kobject to the kset <subsys>. | ||
244 | |||
245 | |||
246 | kset_set_kset_s(obj,subsys) | ||
247 | |||
248 | - Assumes that obj->kset exists, and is a struct kset. | ||
249 | - Sets the kset of the embedded kobject to the kset <subsys>. | ||
250 | |||
251 | subsys_set_kset(obj,subsys) | ||
252 | |||
253 | - Assumes obj->subsys exists, and is a struct subsystem. | ||
254 | - Sets obj->subsys.kset.kobj.kset to the subsystem's embedded kset. | ||
255 | |||
256 | void subsystem_init(struct kset *s); | ||
257 | int subsystem_register(struct kset *s); | ||
258 | void subsystem_unregister(struct kset *s); | ||
259 | struct kset *subsys_get(struct kset *s); | ||
260 | void kset_put(struct kset *s); | ||
261 | |||
262 | These are just wrappers around the respective kset_* functions. | ||
212 | 263 | ||
213 | 2.3 sysfs | 264 | 2.3 sysfs |
214 | 265 | ||
@@ -254,114 +305,3 @@ Instances of struct kobj_type are not registered; only referenced by | |||
254 | the kset. A kobj_type may be referenced by an arbitrary number of | 305 | the kset. A kobj_type may be referenced by an arbitrary number of |
255 | ksets, as there may be disparate sets of identical objects. | 306 | ksets, as there may be disparate sets of identical objects. |
256 | 307 | ||
257 | |||
258 | |||
259 | 4. subsystems | ||
260 | |||
261 | 4.1 Description | ||
262 | |||
263 | A subsystem represents a significant entity of code that maintains an | ||
264 | arbitrary number of sets of objects of various types. Since the number | ||
265 | of ksets and the type of objects they contain are variable, a | ||
266 | generic representation of a subsystem is minimal. | ||
267 | |||
268 | |||
269 | struct subsystem { | ||
270 | struct kset kset; | ||
271 | struct rw_semaphore rwsem; | ||
272 | }; | ||
273 | |||
274 | int subsystem_register(struct subsystem *); | ||
275 | void subsystem_unregister(struct subsystem *); | ||
276 | |||
277 | struct subsystem * subsys_get(struct subsystem * s); | ||
278 | void subsys_put(struct subsystem * s); | ||
279 | |||
280 | |||
281 | A subsystem contains an embedded kset so: | ||
282 | |||
283 | - It can be represented in the object hierarchy via the kset's | ||
284 | embedded kobject. | ||
285 | |||
286 | - It can maintain a default list of objects of one type. | ||
287 | |||
288 | Additional ksets may attach to the subsystem simply by referencing the | ||
289 | subsystem before they are registered. (This one-way reference means | ||
290 | that there is no way to determine the ksets that are attached to the | ||
291 | subsystem.) | ||
292 | |||
293 | All ksets that are attached to a subsystem share the subsystem's R/W | ||
294 | semaphore. | ||
295 | |||
296 | |||
297 | 4.2 subsystem Programming Interface. | ||
298 | |||
299 | The subsystem programming interface is simple and does not offer the | ||
300 | flexibility that the kset and kobject programming interfaces do. They | ||
301 | may be registered and unregistered, as well as reference counted. Each | ||
302 | call forwards the calls to their embedded ksets (which forward the | ||
303 | calls to their embedded kobjects). | ||
304 | |||
305 | |||
306 | 4.3 Helpers | ||
307 | |||
308 | A number of macros are available to make dealing with subsystems and | ||
309 | their embedded objects easier. | ||
310 | |||
311 | |||
312 | decl_subsys(name,type) | ||
313 | |||
314 | Declares a subsystem named '<name>_subsys', with an embedded kset of | ||
315 | type <type>. For example, | ||
316 | |||
317 | decl_subsys(devices,&ktype_devices); | ||
318 | |||
319 | is equivalent to doing: | ||
320 | |||
321 | struct subsystem device_subsys = { | ||
322 | .kset = { | ||
323 | .kobj = { | ||
324 | .name = "devices", | ||
325 | }, | ||
326 | .ktype = &ktype_devices, | ||
327 | } | ||
328 | }; | ||
329 | |||
330 | |||
331 | The objects that are registered with a subsystem that use the | ||
332 | subsystem's default list must have their kset ptr set properly. These | ||
333 | objects may have embedded kobjects, ksets, or other subsystems. The | ||
334 | following helpers make setting the kset easier: | ||
335 | |||
336 | |||
337 | kobj_set_kset_s(obj,subsys) | ||
338 | |||
339 | - Assumes that obj->kobj exists, and is a struct kobject. | ||
340 | - Sets the kset of that kobject to the subsystem's embedded kset. | ||
341 | |||
342 | |||
343 | kset_set_kset_s(obj,subsys) | ||
344 | |||
345 | - Assumes that obj->kset exists, and is a struct kset. | ||
346 | - Sets the kset of the embedded kobject to the subsystem's | ||
347 | embedded kset. | ||
348 | |||
349 | subsys_set_kset(obj,subsys) | ||
350 | |||
351 | - Assumes obj->subsys exists, and is a struct subsystem. | ||
352 | - Sets obj->subsys.kset.kobj.kset to the subsystem's embedded kset. | ||
353 | |||
354 | |||
355 | 4.4 sysfs | ||
356 | |||
357 | subsystems are represented in sysfs via their embedded kobjects. They | ||
358 | follow the same rules as previously mentioned with no exceptions. They | ||
359 | typically receive a top-level directory in sysfs, except when their | ||
360 | embedded kobject is part of another kset, or the parent of the | ||
361 | embedded kobject is explicitly set. | ||
362 | |||
363 | Note that the subsystem's embedded kset must be 'attached' to the | ||
364 | subsystem itself in order to use its rwsem. This is done after | ||
365 | kset_add() has been called. (Not before, because kset_add() uses its | ||
366 | subsystem for a default parent if it doesn't already have one). | ||
367 | |||
diff --git a/Documentation/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt index a2afca3b2bab..847b342b7b20 100644 --- a/Documentation/stable_api_nonsense.txt +++ b/Documentation/stable_api_nonsense.txt | |||
@@ -10,7 +10,7 @@ kernel to userspace interfaces. The kernel to userspace interface is | |||
10 | the one that application programs use, the syscall interface. That | 10 | the one that application programs use, the syscall interface. That |
11 | interface is _very_ stable over time, and will not break. I have old | 11 | interface is _very_ stable over time, and will not break. I have old |
12 | programs that were built on a pre 0.9something kernel that still work | 12 | programs that were built on a pre 0.9something kernel that still work |
13 | just fine on the latest 2.6 kernel release. This interface is the one | 13 | just fine on the latest 2.6 kernel release. That interface is the one |
14 | that users and application programmers can count on being stable. | 14 | that users and application programmers can count on being stable. |
15 | 15 | ||
16 | 16 | ||
diff --git a/Documentation/sysfs-rules.txt b/Documentation/sysfs-rules.txt index 42861bb0bc9b..80ef562160bb 100644 --- a/Documentation/sysfs-rules.txt +++ b/Documentation/sysfs-rules.txt | |||
@@ -1,19 +1,18 @@ | |||
1 | Rules on how to access information in the Linux kernel sysfs | 1 | Rules on how to access information in the Linux kernel sysfs |
2 | 2 | ||
3 | The kernel exported sysfs exports internal kernel implementation-details | 3 | The kernel-exported sysfs exports internal kernel implementation details |
4 | and depends on internal kernel structures and layout. It is agreed upon | 4 | and depends on internal kernel structures and layout. It is agreed upon |
5 | by the kernel developers that the Linux kernel does not provide a stable | 5 | by the kernel developers that the Linux kernel does not provide a stable |
6 | internal API. As sysfs is a direct export of kernel internal | 6 | internal API. As sysfs is a direct export of kernel internal |
7 | structures, the sysfs interface can not provide a stable interface eighter, | 7 | structures, the sysfs interface cannot provide a stable interface either; |
8 | it may always change along with internal kernel changes. | 8 | it may always change along with internal kernel changes. |
9 | 9 | ||
10 | To minimize the risk of breaking users of sysfs, which are in most cases | 10 | To minimize the risk of breaking users of sysfs, which are in most cases |
11 | low-level userspace applications, with a new kernel release, the users | 11 | low-level userspace applications, with a new kernel release, the users |
12 | of sysfs must follow some rules to use an as abstract-as-possible way to | 12 | of sysfs must follow some rules to use an as-abstract-as-possible way to |
13 | access this filesystem. The current udev and HAL programs already | 13 | access this filesystem. The current udev and HAL programs already |
14 | implement this and users are encouraged to plug, if possible, into the | 14 | implement this and users are encouraged to plug, if possible, into the |
15 | abstractions these programs provide instead of accessing sysfs | 15 | abstractions these programs provide instead of accessing sysfs directly. |
16 | directly. | ||
17 | 16 | ||
18 | But if you really do want or need to access sysfs directly, please follow | 17 | But if you really do want or need to access sysfs directly, please follow |
19 | the following rules and then your programs should work with future | 18 | the following rules and then your programs should work with future |
@@ -25,22 +24,22 @@ versions of the sysfs interface. | |||
25 | implementation details in its own API. Therefore it is not better than | 24 | implementation details in its own API. Therefore it is not better than |
26 | reading directories and opening the files yourself. | 25 | reading directories and opening the files yourself. |
27 | Also, it is not actively maintained, in the sense of reflecting the | 26 | Also, it is not actively maintained, in the sense of reflecting the |
28 | current kernel-development. The goal of providing a stable interface | 27 | current kernel development. The goal of providing a stable interface |
29 | to sysfs has failed, it causes more problems, than it solves. It | 28 | to sysfs has failed; it causes more problems than it solves. It |
30 | violates many of the rules in this document. | 29 | violates many of the rules in this document. |
31 | 30 | ||
32 | - sysfs is always at /sys | 31 | - sysfs is always at /sys |
33 | Parsing /proc/mounts is a waste of time. Other mount points are a | 32 | Parsing /proc/mounts is a waste of time. Other mount points are a |
34 | system configuration bug you should not try to solve. For test cases, | 33 | system configuration bug you should not try to solve. For test cases, |
35 | possibly support a SYSFS_PATH environment variable to overwrite the | 34 | possibly support a SYSFS_PATH environment variable to overwrite the |
36 | applications behavior, but never try to search for sysfs. Never try | 35 | application's behavior, but never try to search for sysfs. Never try |
37 | to mount it, if you are not an early boot script. | 36 | to mount it, if you are not an early boot script. |
38 | 37 | ||
39 | - devices are only "devices" | 38 | - devices are only "devices" |
40 | There is no such thing like class-, bus-, physical devices, | 39 | There is no such thing like class-, bus-, physical devices, |
41 | interfaces, and such that you can rely on in userspace. Everything is | 40 | interfaces, and such that you can rely on in userspace. Everything is |
42 | just simply a "device". Class-, bus-, physical, ... types are just | 41 | just simply a "device". Class-, bus-, physical, ... types are just |
43 | kernel implementation details, which should not be expected by | 42 | kernel implementation details which should not be expected by |
44 | applications that look for devices in sysfs. | 43 | applications that look for devices in sysfs. |
45 | 44 | ||
46 | The properties of a device are: | 45 | The properties of a device are: |
@@ -48,11 +47,11 @@ versions of the sysfs interface. | |||
48 | - identical to the DEVPATH value in the event sent from the kernel | 47 | - identical to the DEVPATH value in the event sent from the kernel |
49 | at device creation and removal | 48 | at device creation and removal |
50 | - the unique key to the device at that point in time | 49 | - the unique key to the device at that point in time |
51 | - the kernels path to the device-directory without the leading | 50 | - the kernel's path to the device directory without the leading |
52 | /sys, and always starting with with a slash | 51 | /sys, and always starting with with a slash |
53 | - all elements of a devpath must be real directories. Symlinks | 52 | - all elements of a devpath must be real directories. Symlinks |
54 | pointing to /sys/devices must always be resolved to their real | 53 | pointing to /sys/devices must always be resolved to their real |
55 | target, and the target path must be used to access the device. | 54 | target and the target path must be used to access the device. |
56 | That way the devpath to the device matches the devpath of the | 55 | That way the devpath to the device matches the devpath of the |
57 | kernel used at event time. | 56 | kernel used at event time. |
58 | - using or exposing symlink values as elements in a devpath string | 57 | - using or exposing symlink values as elements in a devpath string |
@@ -73,17 +72,17 @@ versions of the sysfs interface. | |||
73 | link | 72 | link |
74 | - it is retrieved by reading the "driver"-link and using only the | 73 | - it is retrieved by reading the "driver"-link and using only the |
75 | last element of the target path | 74 | last element of the target path |
76 | - devices which do not have "driver"-link, just do not have a | 75 | - devices which do not have "driver"-link just do not have a |
77 | driver; copying the driver value in a child device context, is a | 76 | driver; copying the driver value in a child device context is a |
78 | bug in the application | 77 | bug in the application |
79 | 78 | ||
80 | o attributes | 79 | o attributes |
81 | - the files in the device directory or files below a subdirectories | 80 | - the files in the device directory or files below subdirectories |
82 | of the same device directory | 81 | of the same device directory |
83 | - accessing attributes reached by a symlink pointing to another device, | 82 | - accessing attributes reached by a symlink pointing to another device, |
84 | like the "device"-link, is a bug in the application | 83 | like the "device"-link, is a bug in the application |
85 | 84 | ||
86 | Everything else is just a kernel driver-core implementation detail, | 85 | Everything else is just a kernel driver-core implementation detail |
87 | that should not be assumed to be stable across kernel releases. | 86 | that should not be assumed to be stable across kernel releases. |
88 | 87 | ||
89 | - Properties of parent devices never belong into a child device. | 88 | - Properties of parent devices never belong into a child device. |
@@ -91,25 +90,25 @@ versions of the sysfs interface. | |||
91 | context properties. If the device 'eth0' or 'sda' does not have a | 90 | context properties. If the device 'eth0' or 'sda' does not have a |
92 | "driver"-link, then this device does not have a driver. Its value is empty. | 91 | "driver"-link, then this device does not have a driver. Its value is empty. |
93 | Never copy any property of the parent-device into a child-device. Parent | 92 | Never copy any property of the parent-device into a child-device. Parent |
94 | device-properties may change dynamically without any notice to the | 93 | device properties may change dynamically without any notice to the |
95 | child device. | 94 | child device. |
96 | 95 | ||
97 | - Hierarchy in a single device-tree | 96 | - Hierarchy in a single device tree |
98 | There is only one valid place in sysfs where hierarchy can be examined | 97 | There is only one valid place in sysfs where hierarchy can be examined |
99 | and this is below: /sys/devices. | 98 | and this is below: /sys/devices. |
100 | It is planned, that all device directories will end up in the tree | 99 | It is planned that all device directories will end up in the tree |
101 | below this directory. | 100 | below this directory. |
102 | 101 | ||
103 | - Classification by subsystem | 102 | - Classification by subsystem |
104 | There are currently three places for classification of devices: | 103 | There are currently three places for classification of devices: |
105 | /sys/block, /sys/class and /sys/bus. It is planned that these will | 104 | /sys/block, /sys/class and /sys/bus. It is planned that these will |
106 | not contain any device-directories themselves, but only flat lists of | 105 | not contain any device directories themselves, but only flat lists of |
107 | symlinks pointing to the unified /sys/devices tree. | 106 | symlinks pointing to the unified /sys/devices tree. |
108 | All three places have completely different rules on how to access | 107 | All three places have completely different rules on how to access |
109 | device information. It is planned to merge all three | 108 | device information. It is planned to merge all three |
110 | classification-directories into one place at /sys/subsystem, | 109 | classification directories into one place at /sys/subsystem, |
111 | following the layout of the bus-directories. All buses and | 110 | following the layout of the bus directories. All buses and |
112 | classes, including the converted block-subsystem, will show up | 111 | classes, including the converted block subsystem, will show up |
113 | there. | 112 | there. |
114 | The devices belonging to a subsystem will create a symlink in the | 113 | The devices belonging to a subsystem will create a symlink in the |
115 | "devices" directory at /sys/subsystem/<name>/devices. | 114 | "devices" directory at /sys/subsystem/<name>/devices. |
@@ -121,38 +120,38 @@ versions of the sysfs interface. | |||
121 | subsystem name. | 120 | subsystem name. |
122 | 121 | ||
123 | Assuming /sys/class/<subsystem> and /sys/bus/<subsystem>, or | 122 | Assuming /sys/class/<subsystem> and /sys/bus/<subsystem>, or |
124 | /sys/block and /sys/class/block are not interchangeable, is a bug in | 123 | /sys/block and /sys/class/block are not interchangeable is a bug in |
125 | the application. | 124 | the application. |
126 | 125 | ||
127 | - Block | 126 | - Block |
128 | The converted block-subsystem at /sys/class/block, or | 127 | The converted block subsystem at /sys/class/block or |
129 | /sys/subsystem/block will contain the links for disks and partitions | 128 | /sys/subsystem/block will contain the links for disks and partitions |
130 | at the same level, never in a hierarchy. Assuming the block-subsytem to | 129 | at the same level, never in a hierarchy. Assuming the block subsytem to |
131 | contain only disks and not partition-devices in the same flat list is | 130 | contain only disks and not partition devices in the same flat list is |
132 | a bug in the application. | 131 | a bug in the application. |
133 | 132 | ||
134 | - "device"-link and <subsystem>:<kernel name>-links | 133 | - "device"-link and <subsystem>:<kernel name>-links |
135 | Never depend on the "device"-link. The "device"-link is a workaround | 134 | Never depend on the "device"-link. The "device"-link is a workaround |
136 | for the old layout, where class-devices are not created in | 135 | for the old layout, where class devices are not created in |
137 | /sys/devices/ like the bus-devices. If the link-resolving of a | 136 | /sys/devices/ like the bus devices. If the link-resolving of a |
138 | device-directory does not end in /sys/devices/, you can use the | 137 | device directory does not end in /sys/devices/, you can use the |
139 | "device"-link to find the parent devices in /sys/devices/. That is the | 138 | "device"-link to find the parent devices in /sys/devices/. That is the |
140 | single valid use of the "device"-link, it must never appear in any | 139 | single valid use of the "device"-link; it must never appear in any |
141 | path as an element. Assuming the existence of the "device"-link for | 140 | path as an element. Assuming the existence of the "device"-link for |
142 | a device in /sys/devices/ is a bug in the application. | 141 | a device in /sys/devices/ is a bug in the application. |
143 | Accessing /sys/class/net/eth0/device is a bug in the application. | 142 | Accessing /sys/class/net/eth0/device is a bug in the application. |
144 | 143 | ||
145 | Never depend on the class-specific links back to the /sys/class | 144 | Never depend on the class-specific links back to the /sys/class |
146 | directory. These links are also a workaround for the design mistake | 145 | directory. These links are also a workaround for the design mistake |
147 | that class-devices are not created in /sys/devices. If a device | 146 | that class devices are not created in /sys/devices. If a device |
148 | directory does not contain directories for child devices, these links | 147 | directory does not contain directories for child devices, these links |
149 | may be used to find the child devices in /sys/class. That is the single | 148 | may be used to find the child devices in /sys/class. That is the single |
150 | valid use of these links, they must never appear in any path as an | 149 | valid use of these links; they must never appear in any path as an |
151 | element. Assuming the existence of these links for devices which are | 150 | element. Assuming the existence of these links for devices which are |
152 | real child device directories in the /sys/devices tree, is a bug in | 151 | real child device directories in the /sys/devices tree is a bug in |
153 | the application. | 152 | the application. |
154 | 153 | ||
155 | It is planned to remove all these links when when all class-device | 154 | It is planned to remove all these links when all class device |
156 | directories live in /sys/devices. | 155 | directories live in /sys/devices. |
157 | 156 | ||
158 | - Position of devices along device chain can change. | 157 | - Position of devices along device chain can change. |
@@ -161,6 +160,5 @@ versions of the sysfs interface. | |||
161 | the chain. You must always request the parent device you are looking for | 160 | the chain. You must always request the parent device you are looking for |
162 | by its subsystem value. You need to walk up the chain until you find | 161 | by its subsystem value. You need to walk up the chain until you find |
163 | the device that matches the expected subsystem. Depending on a specific | 162 | the device that matches the expected subsystem. Depending on a specific |
164 | position of a parent device, or exposing relative paths, using "../" to | 163 | position of a parent device or exposing relative paths using "../" to |
165 | access the chain of parents, is a bug in the application. | 164 | access the chain of parents is a bug in the application. |
166 | |||
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3599ab2506d2..e6738bcbe5a9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -24,8 +24,6 @@ | |||
24 | #include "base.h" | 24 | #include "base.h" |
25 | #include "power/power.h" | 25 | #include "power/power.h" |
26 | 26 | ||
27 | extern const char *kobject_actions[]; | ||
28 | |||
29 | int (*platform_notify)(struct device * dev) = NULL; | 27 | int (*platform_notify)(struct device * dev) = NULL; |
30 | int (*platform_notify_remove)(struct device * dev) = NULL; | 28 | int (*platform_notify_remove)(struct device * dev) = NULL; |
31 | 29 | ||
@@ -680,8 +678,7 @@ static int device_add_class_symlinks(struct device *dev) | |||
680 | if (error) | 678 | if (error) |
681 | goto out_subsys; | 679 | goto out_subsys; |
682 | } | 680 | } |
683 | /* only bus-device parents get a "device"-link */ | 681 | if (dev->parent) { |
684 | if (dev->parent && dev->parent->bus) { | ||
685 | error = sysfs_create_link(&dev->kobj, &dev->parent->kobj, | 682 | error = sysfs_create_link(&dev->kobj, &dev->parent->kobj, |
686 | "device"); | 683 | "device"); |
687 | if (error) | 684 | if (error) |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 53f0ee6f3016..b24efd4e3e3d 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -232,6 +232,7 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) | |||
232 | /** | 232 | /** |
233 | * firmware_data_write - write method for firmware | 233 | * firmware_data_write - write method for firmware |
234 | * @kobj: kobject for the device | 234 | * @kobj: kobject for the device |
235 | * @bin_attr: bin_attr structure | ||
235 | * @buffer: buffer being written | 236 | * @buffer: buffer being written |
236 | * @offset: buffer offset for write in total data store area | 237 | * @offset: buffer offset for write in total data store area |
237 | * @count: buffer size | 238 | * @count: buffer size |
diff --git a/drivers/infiniband/hw/amso1100/c2_qp.c b/drivers/infiniband/hw/amso1100/c2_qp.c index 420c1380f5c3..01d07862ea86 100644 --- a/drivers/infiniband/hw/amso1100/c2_qp.c +++ b/drivers/infiniband/hw/amso1100/c2_qp.c | |||
@@ -506,6 +506,7 @@ int c2_alloc_qp(struct c2_dev *c2dev, | |||
506 | qp->send_sgl_depth = qp_attrs->cap.max_send_sge; | 506 | qp->send_sgl_depth = qp_attrs->cap.max_send_sge; |
507 | qp->rdma_write_sgl_depth = qp_attrs->cap.max_send_sge; | 507 | qp->rdma_write_sgl_depth = qp_attrs->cap.max_send_sge; |
508 | qp->recv_sgl_depth = qp_attrs->cap.max_recv_sge; | 508 | qp->recv_sgl_depth = qp_attrs->cap.max_recv_sge; |
509 | init_waitqueue_head(&qp->wait); | ||
509 | 510 | ||
510 | /* Initialize the SQ MQ */ | 511 | /* Initialize the SQ MQ */ |
511 | q_size = be32_to_cpu(reply->sq_depth); | 512 | q_size = be32_to_cpu(reply->sq_depth); |
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 3725aa8664d9..b5e960305316 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -322,6 +322,7 @@ extern int ehca_static_rate; | |||
322 | extern int ehca_port_act_time; | 322 | extern int ehca_port_act_time; |
323 | extern int ehca_use_hp_mr; | 323 | extern int ehca_use_hp_mr; |
324 | extern int ehca_scaling_code; | 324 | extern int ehca_scaling_code; |
325 | extern int ehca_mr_largepage; | ||
325 | 326 | ||
326 | struct ipzu_queue_resp { | 327 | struct ipzu_queue_resp { |
327 | u32 qe_size; /* queue entry size */ | 328 | u32 qe_size; /* queue entry size */ |
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c index c1b868b79d67..d97eda3e1da0 100644 --- a/drivers/infiniband/hw/ehca/ehca_mrmw.c +++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c | |||
@@ -40,10 +40,10 @@ | |||
40 | * POSSIBILITY OF SUCH DAMAGE. | 40 | * POSSIBILITY OF SUCH DAMAGE. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <rdma/ib_umem.h> | ||
44 | |||
45 | #include <asm/current.h> | 43 | #include <asm/current.h> |
46 | 44 | ||
45 | #include <rdma/ib_umem.h> | ||
46 | |||
47 | #include "ehca_iverbs.h" | 47 | #include "ehca_iverbs.h" |
48 | #include "ehca_mrmw.h" | 48 | #include "ehca_mrmw.h" |
49 | #include "hcp_if.h" | 49 | #include "hcp_if.h" |
@@ -64,8 +64,6 @@ enum ehca_mr_pgsize { | |||
64 | EHCA_MR_PGSIZE16M = 0x1000000L | 64 | EHCA_MR_PGSIZE16M = 0x1000000L |
65 | }; | 65 | }; |
66 | 66 | ||
67 | extern int ehca_mr_largepage; | ||
68 | |||
69 | static u32 ehca_encode_hwpage_size(u32 pgsize) | 67 | static u32 ehca_encode_hwpage_size(u32 pgsize) |
70 | { | 68 | { |
71 | u32 idx = 0; | 69 | u32 idx = 0; |
diff --git a/drivers/infiniband/hw/ehca/ehca_pd.c b/drivers/infiniband/hw/ehca/ehca_pd.c index 3dafd7ff36cd..43bcf085fcf2 100644 --- a/drivers/infiniband/hw/ehca/ehca_pd.c +++ b/drivers/infiniband/hw/ehca/ehca_pd.c | |||
@@ -88,7 +88,6 @@ int ehca_dealloc_pd(struct ib_pd *pd) | |||
88 | u32 cur_pid = current->tgid; | 88 | u32 cur_pid = current->tgid; |
89 | struct ehca_pd *my_pd = container_of(pd, struct ehca_pd, ib_pd); | 89 | struct ehca_pd *my_pd = container_of(pd, struct ehca_pd, ib_pd); |
90 | int i, leftovers = 0; | 90 | int i, leftovers = 0; |
91 | extern struct kmem_cache *small_qp_cache; | ||
92 | struct ipz_small_queue_page *page, *tmp; | 91 | struct ipz_small_queue_page *page, *tmp; |
93 | 92 | ||
94 | if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context && | 93 | if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context && |
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c b/drivers/infiniband/hw/ehca/hcp_if.c index fdbfebea7d11..24f454162f24 100644 --- a/drivers/infiniband/hw/ehca/hcp_if.c +++ b/drivers/infiniband/hw/ehca/hcp_if.c | |||
@@ -758,7 +758,6 @@ u64 hipz_h_register_rpage_mr(const struct ipz_adapter_handle adapter_handle, | |||
758 | const u64 logical_address_of_page, | 758 | const u64 logical_address_of_page, |
759 | const u64 count) | 759 | const u64 count) |
760 | { | 760 | { |
761 | extern int ehca_debug_level; | ||
762 | u64 ret; | 761 | u64 ret; |
763 | 762 | ||
764 | if (unlikely(ehca_debug_level >= 2)) { | 763 | if (unlikely(ehca_debug_level >= 2)) { |
diff --git a/drivers/infiniband/hw/ehca/ipz_pt_fn.h b/drivers/infiniband/hw/ehca/ipz_pt_fn.h index c6937a044e8a..a801274ea337 100644 --- a/drivers/infiniband/hw/ehca/ipz_pt_fn.h +++ b/drivers/infiniband/hw/ehca/ipz_pt_fn.h | |||
@@ -54,6 +54,8 @@ | |||
54 | struct ehca_pd; | 54 | struct ehca_pd; |
55 | struct ipz_small_queue_page; | 55 | struct ipz_small_queue_page; |
56 | 56 | ||
57 | extern struct kmem_cache *small_qp_cache; | ||
58 | |||
57 | /* struct generic ehca page */ | 59 | /* struct generic ehca page */ |
58 | struct ipz_page { | 60 | struct ipz_page { |
59 | u8 entries[EHCA_PAGESIZE]; | 61 | u8 entries[EHCA_PAGESIZE]; |
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index b4b786d0dfca..6ad822c35930 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h | |||
@@ -100,8 +100,7 @@ struct infinipath_stats { | |||
100 | __u64 sps_hwerrs; | 100 | __u64 sps_hwerrs; |
101 | /* number of times IB link changed state unexpectedly */ | 101 | /* number of times IB link changed state unexpectedly */ |
102 | __u64 sps_iblink; | 102 | __u64 sps_iblink; |
103 | /* kernel receive interrupts that didn't read intstat */ | 103 | __u64 sps_unused; /* was fastrcvint, no longer implemented */ |
104 | __u64 sps_fastrcvint; | ||
105 | /* number of kernel (port0) packets received */ | 104 | /* number of kernel (port0) packets received */ |
106 | __u64 sps_port0pkts; | 105 | __u64 sps_port0pkts; |
107 | /* number of "ethernet" packets sent by driver */ | 106 | /* number of "ethernet" packets sent by driver */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 09c5fd84b1e3..6ccba365a24c 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -740,7 +740,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *dd, unsigned first, | |||
740 | * pioavail updates to memory to stop. | 740 | * pioavail updates to memory to stop. |
741 | */ | 741 | */ |
742 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | 742 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, |
743 | sendorig & ~IPATH_S_PIOBUFAVAILUPD); | 743 | sendorig & ~INFINIPATH_S_PIOBUFAVAILUPD); |
744 | sendorig = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 744 | sendorig = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
745 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | 745 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, |
746 | dd->ipath_sendctrl); | 746 | dd->ipath_sendctrl); |
@@ -1614,7 +1614,7 @@ int ipath_waitfor_mdio_cmdready(struct ipath_devdata *dd) | |||
1614 | * it's safer to always do it. | 1614 | * it's safer to always do it. |
1615 | * PIOAvail bits are updated by the chip as if normal send had happened. | 1615 | * PIOAvail bits are updated by the chip as if normal send had happened. |
1616 | */ | 1616 | */ |
1617 | void ipath_cancel_sends(struct ipath_devdata *dd) | 1617 | void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) |
1618 | { | 1618 | { |
1619 | ipath_dbg("Cancelling all in-progress send buffers\n"); | 1619 | ipath_dbg("Cancelling all in-progress send buffers\n"); |
1620 | dd->ipath_lastcancel = jiffies+HZ/2; /* skip armlaunch errs a bit */ | 1620 | dd->ipath_lastcancel = jiffies+HZ/2; /* skip armlaunch errs a bit */ |
@@ -1627,6 +1627,9 @@ void ipath_cancel_sends(struct ipath_devdata *dd) | |||
1627 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 1627 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
1628 | ipath_disarm_piobufs(dd, 0, | 1628 | ipath_disarm_piobufs(dd, 0, |
1629 | (unsigned)(dd->ipath_piobcnt2k + dd->ipath_piobcnt4k)); | 1629 | (unsigned)(dd->ipath_piobcnt2k + dd->ipath_piobcnt4k)); |
1630 | if (restore_sendctrl) /* else done by caller later */ | ||
1631 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | ||
1632 | dd->ipath_sendctrl); | ||
1630 | 1633 | ||
1631 | /* and again, be sure all have hit the chip */ | 1634 | /* and again, be sure all have hit the chip */ |
1632 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 1635 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
@@ -1655,7 +1658,7 @@ static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) | |||
1655 | /* flush all queued sends when going to DOWN or INIT, to be sure that | 1658 | /* flush all queued sends when going to DOWN or INIT, to be sure that |
1656 | * they don't block MAD packets */ | 1659 | * they don't block MAD packets */ |
1657 | if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) | 1660 | if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) |
1658 | ipath_cancel_sends(dd); | 1661 | ipath_cancel_sends(dd, 1); |
1659 | 1662 | ||
1660 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, | 1663 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, |
1661 | dd->ipath_ibcctrl | which); | 1664 | dd->ipath_ibcctrl | which); |
@@ -2000,7 +2003,7 @@ void ipath_shutdown_device(struct ipath_devdata *dd) | |||
2000 | 2003 | ||
2001 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_DISABLE << | 2004 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_DISABLE << |
2002 | INFINIPATH_IBCC_LINKINITCMD_SHIFT); | 2005 | INFINIPATH_IBCC_LINKINITCMD_SHIFT); |
2003 | ipath_cancel_sends(dd); | 2006 | ipath_cancel_sends(dd, 0); |
2004 | 2007 | ||
2005 | /* disable IBC */ | 2008 | /* disable IBC */ |
2006 | dd->ipath_control &= ~INFINIPATH_C_LINKENABLE; | 2009 | dd->ipath_control &= ~INFINIPATH_C_LINKENABLE; |
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6120.c b/drivers/infiniband/hw/ipath/ipath_iba6120.c index 9868ccda5f26..5b6ac9a1a709 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba6120.c +++ b/drivers/infiniband/hw/ipath/ipath_iba6120.c | |||
@@ -321,6 +321,8 @@ static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = { | |||
321 | << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) | 321 | << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT) |
322 | 322 | ||
323 | static int ipath_pe_txe_recover(struct ipath_devdata *); | 323 | static int ipath_pe_txe_recover(struct ipath_devdata *); |
324 | static void ipath_pe_put_tid_2(struct ipath_devdata *, u64 __iomem *, | ||
325 | u32, unsigned long); | ||
324 | 326 | ||
325 | /** | 327 | /** |
326 | * ipath_pe_handle_hwerrors - display hardware errors. | 328 | * ipath_pe_handle_hwerrors - display hardware errors. |
@@ -555,8 +557,11 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name, | |||
555 | ipath_dev_err(dd, "Unsupported InfiniPath hardware revision %u.%u!\n", | 557 | ipath_dev_err(dd, "Unsupported InfiniPath hardware revision %u.%u!\n", |
556 | dd->ipath_majrev, dd->ipath_minrev); | 558 | dd->ipath_majrev, dd->ipath_minrev); |
557 | ret = 1; | 559 | ret = 1; |
558 | } else | 560 | } else { |
559 | ret = 0; | 561 | ret = 0; |
562 | if (dd->ipath_minrev >= 2) | ||
563 | dd->ipath_f_put_tid = ipath_pe_put_tid_2; | ||
564 | } | ||
560 | 565 | ||
561 | return ret; | 566 | return ret; |
562 | } | 567 | } |
@@ -1220,7 +1225,7 @@ static void ipath_pe_clear_tids(struct ipath_devdata *dd, unsigned port) | |||
1220 | port * dd->ipath_rcvtidcnt * sizeof(*tidbase)); | 1225 | port * dd->ipath_rcvtidcnt * sizeof(*tidbase)); |
1221 | 1226 | ||
1222 | for (i = 0; i < dd->ipath_rcvtidcnt; i++) | 1227 | for (i = 0; i < dd->ipath_rcvtidcnt; i++) |
1223 | ipath_pe_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EXPECTED, | 1228 | dd->ipath_f_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EXPECTED, |
1224 | tidinv); | 1229 | tidinv); |
1225 | 1230 | ||
1226 | tidbase = (u64 __iomem *) | 1231 | tidbase = (u64 __iomem *) |
@@ -1229,7 +1234,7 @@ static void ipath_pe_clear_tids(struct ipath_devdata *dd, unsigned port) | |||
1229 | port * dd->ipath_rcvegrcnt * sizeof(*tidbase)); | 1234 | port * dd->ipath_rcvegrcnt * sizeof(*tidbase)); |
1230 | 1235 | ||
1231 | for (i = 0; i < dd->ipath_rcvegrcnt; i++) | 1236 | for (i = 0; i < dd->ipath_rcvegrcnt; i++) |
1232 | ipath_pe_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EAGER, | 1237 | dd->ipath_f_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EAGER, |
1233 | tidinv); | 1238 | tidinv); |
1234 | } | 1239 | } |
1235 | 1240 | ||
@@ -1395,10 +1400,11 @@ void ipath_init_iba6120_funcs(struct ipath_devdata *dd) | |||
1395 | dd->ipath_f_quiet_serdes = ipath_pe_quiet_serdes; | 1400 | dd->ipath_f_quiet_serdes = ipath_pe_quiet_serdes; |
1396 | dd->ipath_f_bringup_serdes = ipath_pe_bringup_serdes; | 1401 | dd->ipath_f_bringup_serdes = ipath_pe_bringup_serdes; |
1397 | dd->ipath_f_clear_tids = ipath_pe_clear_tids; | 1402 | dd->ipath_f_clear_tids = ipath_pe_clear_tids; |
1398 | if (dd->ipath_minrev >= 2) | 1403 | /* |
1399 | dd->ipath_f_put_tid = ipath_pe_put_tid_2; | 1404 | * this may get changed after we read the chip revision, |
1400 | else | 1405 | * but we start with the safe version for all revs |
1401 | dd->ipath_f_put_tid = ipath_pe_put_tid; | 1406 | */ |
1407 | dd->ipath_f_put_tid = ipath_pe_put_tid; | ||
1402 | dd->ipath_f_cleanup = ipath_setup_pe_cleanup; | 1408 | dd->ipath_f_cleanup = ipath_setup_pe_cleanup; |
1403 | dd->ipath_f_setextled = ipath_setup_pe_setextled; | 1409 | dd->ipath_f_setextled = ipath_setup_pe_setextled; |
1404 | dd->ipath_f_get_base_info = ipath_pe_get_base_info; | 1410 | dd->ipath_f_get_base_info = ipath_pe_get_base_info; |
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index 49951d583804..9dd0bacf8461 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -782,7 +782,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
782 | * Follows early_init because some chips have to initialize | 782 | * Follows early_init because some chips have to initialize |
783 | * PIO buffers in early_init to avoid false parity errors. | 783 | * PIO buffers in early_init to avoid false parity errors. |
784 | */ | 784 | */ |
785 | ipath_cancel_sends(dd); | 785 | ipath_cancel_sends(dd, 0); |
786 | 786 | ||
787 | /* early_init sets rcvhdrentsize and rcvhdrsize, so this must be | 787 | /* early_init sets rcvhdrentsize and rcvhdrsize, so this must be |
788 | * done after early_init */ | 788 | * done after early_init */ |
@@ -851,13 +851,14 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
851 | ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrmask, | 851 | ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrmask, |
852 | dd->ipath_hwerrmask); | 852 | dd->ipath_hwerrmask); |
853 | 853 | ||
854 | dd->ipath_maskederrs = dd->ipath_ignorederrs; | ||
855 | /* clear all */ | 854 | /* clear all */ |
856 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, -1LL); | 855 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, -1LL); |
857 | /* enable errors that are masked, at least this first time. */ | 856 | /* enable errors that are masked, at least this first time. */ |
858 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, | 857 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, |
859 | ~dd->ipath_maskederrs); | 858 | ~dd->ipath_maskederrs); |
860 | /* clear any interrups up to this point (ints still not enabled) */ | 859 | dd->ipath_errormask = ipath_read_kreg64(dd, |
860 | dd->ipath_kregs->kr_errormask); | ||
861 | /* clear any interrupts up to this point (ints still not enabled) */ | ||
861 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, -1LL); | 862 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, -1LL); |
862 | 863 | ||
863 | /* | 864 | /* |
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index 1fd91c59f246..b29fe7e9b11a 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c | |||
@@ -303,7 +303,7 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd, | |||
303 | * Flush all queued sends when link went to DOWN or INIT, | 303 | * Flush all queued sends when link went to DOWN or INIT, |
304 | * to be sure that they don't block SMA and other MAD packets | 304 | * to be sure that they don't block SMA and other MAD packets |
305 | */ | 305 | */ |
306 | ipath_cancel_sends(dd); | 306 | ipath_cancel_sends(dd, 1); |
307 | } | 307 | } |
308 | else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM || | 308 | else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM || |
309 | lstate == IPATH_IBSTATE_ACTIVE) { | 309 | lstate == IPATH_IBSTATE_ACTIVE) { |
@@ -517,10 +517,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) | |||
517 | 517 | ||
518 | supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint); | 518 | supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint); |
519 | 519 | ||
520 | /* | 520 | /* don't report errors that are masked */ |
521 | * don't report errors that are masked (includes those always | ||
522 | * ignored) | ||
523 | */ | ||
524 | errs &= ~dd->ipath_maskederrs; | 521 | errs &= ~dd->ipath_maskederrs; |
525 | 522 | ||
526 | /* do these first, they are most important */ | 523 | /* do these first, they are most important */ |
@@ -566,19 +563,19 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) | |||
566 | * ones on this particular interrupt, which also isn't great | 563 | * ones on this particular interrupt, which also isn't great |
567 | */ | 564 | */ |
568 | dd->ipath_maskederrs |= dd->ipath_lasterror | errs; | 565 | dd->ipath_maskederrs |= dd->ipath_lasterror | errs; |
566 | dd->ipath_errormask &= ~dd->ipath_maskederrs; | ||
569 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, | 567 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, |
570 | ~dd->ipath_maskederrs); | 568 | dd->ipath_errormask); |
571 | s_iserr = ipath_decode_err(msg, sizeof msg, | 569 | s_iserr = ipath_decode_err(msg, sizeof msg, |
572 | (dd->ipath_maskederrs & ~dd-> | 570 | dd->ipath_maskederrs); |
573 | ipath_ignorederrs)); | ||
574 | 571 | ||
575 | if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) & | 572 | if (dd->ipath_maskederrs & |
576 | ~(INFINIPATH_E_RRCVEGRFULL | | 573 | ~(INFINIPATH_E_RRCVEGRFULL | |
577 | INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) | 574 | INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) |
578 | ipath_dev_err(dd, "Temporarily disabling " | 575 | ipath_dev_err(dd, "Temporarily disabling " |
579 | "error(s) %llx reporting; too frequent (%s)\n", | 576 | "error(s) %llx reporting; too frequent (%s)\n", |
580 | (unsigned long long) (dd->ipath_maskederrs & | 577 | (unsigned long long)dd->ipath_maskederrs, |
581 | ~dd->ipath_ignorederrs), msg); | 578 | msg); |
582 | else { | 579 | else { |
583 | /* | 580 | /* |
584 | * rcvegrfull and rcvhdrqfull are "normal", | 581 | * rcvegrfull and rcvhdrqfull are "normal", |
@@ -793,19 +790,22 @@ void ipath_clear_freeze(struct ipath_devdata *dd) | |||
793 | /* disable error interrupts, to avoid confusion */ | 790 | /* disable error interrupts, to avoid confusion */ |
794 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL); | 791 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL); |
795 | 792 | ||
793 | /* also disable interrupts; errormask is sometimes overwriten */ | ||
794 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, 0ULL); | ||
795 | |||
796 | /* | 796 | /* |
797 | * clear all sends, because they have may been | 797 | * clear all sends, because they have may been |
798 | * completed by usercode while in freeze mode, and | 798 | * completed by usercode while in freeze mode, and |
799 | * therefore would not be sent, and eventually | 799 | * therefore would not be sent, and eventually |
800 | * might cause the process to run out of bufs | 800 | * might cause the process to run out of bufs |
801 | */ | 801 | */ |
802 | ipath_cancel_sends(dd); | 802 | ipath_cancel_sends(dd, 0); |
803 | ipath_write_kreg(dd, dd->ipath_kregs->kr_control, | 803 | ipath_write_kreg(dd, dd->ipath_kregs->kr_control, |
804 | dd->ipath_control); | 804 | dd->ipath_control); |
805 | 805 | ||
806 | /* ensure pio avail updates continue */ | 806 | /* ensure pio avail updates continue */ |
807 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | 807 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, |
808 | dd->ipath_sendctrl & ~IPATH_S_PIOBUFAVAILUPD); | 808 | dd->ipath_sendctrl & ~INFINIPATH_S_PIOBUFAVAILUPD); |
809 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 809 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
810 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | 810 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, |
811 | dd->ipath_sendctrl); | 811 | dd->ipath_sendctrl); |
@@ -817,7 +817,7 @@ void ipath_clear_freeze(struct ipath_devdata *dd) | |||
817 | for (i = 0; i < dd->ipath_pioavregs; i++) { | 817 | for (i = 0; i < dd->ipath_pioavregs; i++) { |
818 | /* deal with 6110 chip bug */ | 818 | /* deal with 6110 chip bug */ |
819 | im = i > 3 ? ((i&1) ? i-1 : i+1) : i; | 819 | im = i > 3 ? ((i&1) ? i-1 : i+1) : i; |
820 | val = ipath_read_kreg64(dd, 0x1000+(im*sizeof(u64))); | 820 | val = ipath_read_kreg64(dd, (0x1000/sizeof(u64))+im); |
821 | dd->ipath_pioavailregs_dma[i] = dd->ipath_pioavailshadow[i] | 821 | dd->ipath_pioavailregs_dma[i] = dd->ipath_pioavailshadow[i] |
822 | = le64_to_cpu(val); | 822 | = le64_to_cpu(val); |
823 | } | 823 | } |
@@ -832,7 +832,8 @@ void ipath_clear_freeze(struct ipath_devdata *dd) | |||
832 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, | 832 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, |
833 | E_SPKT_ERRS_IGNORE); | 833 | E_SPKT_ERRS_IGNORE); |
834 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, | 834 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, |
835 | ~dd->ipath_maskederrs); | 835 | dd->ipath_errormask); |
836 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, -1LL); | ||
836 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, 0ULL); | 837 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, 0ULL); |
837 | } | 838 | } |
838 | 839 | ||
@@ -1002,7 +1003,6 @@ irqreturn_t ipath_intr(int irq, void *data) | |||
1002 | u32 istat, chk0rcv = 0; | 1003 | u32 istat, chk0rcv = 0; |
1003 | ipath_err_t estat = 0; | 1004 | ipath_err_t estat = 0; |
1004 | irqreturn_t ret; | 1005 | irqreturn_t ret; |
1005 | u32 oldhead, curtail; | ||
1006 | static unsigned unexpected = 0; | 1006 | static unsigned unexpected = 0; |
1007 | static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) | | 1007 | static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) | |
1008 | (1U<<INFINIPATH_I_RCVURG_SHIFT); | 1008 | (1U<<INFINIPATH_I_RCVURG_SHIFT); |
@@ -1035,36 +1035,6 @@ irqreturn_t ipath_intr(int irq, void *data) | |||
1035 | goto bail; | 1035 | goto bail; |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | /* | ||
1039 | * We try to avoid reading the interrupt status register, since | ||
1040 | * that's a PIO read, and stalls the processor for up to about | ||
1041 | * ~0.25 usec. The idea is that if we processed a port0 packet, | ||
1042 | * we blindly clear the port 0 receive interrupt bits, and nothing | ||
1043 | * else, then return. If other interrupts are pending, the chip | ||
1044 | * will re-interrupt us as soon as we write the intclear register. | ||
1045 | * We then won't process any more kernel packets (if not the 2nd | ||
1046 | * time, then the 3rd or 4th) and we'll then handle the other | ||
1047 | * interrupts. We clear the interrupts first so that we don't | ||
1048 | * lose intr for later packets that arrive while we are processing. | ||
1049 | */ | ||
1050 | oldhead = dd->ipath_port0head; | ||
1051 | curtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr); | ||
1052 | if (oldhead != curtail) { | ||
1053 | if (dd->ipath_flags & IPATH_GPIO_INTR) { | ||
1054 | ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear, | ||
1055 | (u64) (1 << IPATH_GPIO_PORT0_BIT)); | ||
1056 | istat = port0rbits | INFINIPATH_I_GPIO; | ||
1057 | } | ||
1058 | else | ||
1059 | istat = port0rbits; | ||
1060 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat); | ||
1061 | ipath_kreceive(dd); | ||
1062 | if (oldhead != dd->ipath_port0head) { | ||
1063 | ipath_stats.sps_fastrcvint++; | ||
1064 | goto done; | ||
1065 | } | ||
1066 | } | ||
1067 | |||
1068 | istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus); | 1038 | istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus); |
1069 | 1039 | ||
1070 | if (unlikely(!istat)) { | 1040 | if (unlikely(!istat)) { |
@@ -1225,7 +1195,6 @@ irqreturn_t ipath_intr(int irq, void *data) | |||
1225 | handle_layer_pioavail(dd); | 1195 | handle_layer_pioavail(dd); |
1226 | } | 1196 | } |
1227 | 1197 | ||
1228 | done: | ||
1229 | ret = IRQ_HANDLED; | 1198 | ret = IRQ_HANDLED; |
1230 | 1199 | ||
1231 | bail: | 1200 | bail: |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index ace63ef78e6f..7a7966f7e4ff 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -261,18 +261,10 @@ struct ipath_devdata { | |||
261 | * limiting of hwerror reporting | 261 | * limiting of hwerror reporting |
262 | */ | 262 | */ |
263 | ipath_err_t ipath_lasthwerror; | 263 | ipath_err_t ipath_lasthwerror; |
264 | /* | 264 | /* errors masked because they occur too fast */ |
265 | * errors masked because they occur too fast, also includes errors | ||
266 | * that are always ignored (ipath_ignorederrs) | ||
267 | */ | ||
268 | ipath_err_t ipath_maskederrs; | 265 | ipath_err_t ipath_maskederrs; |
269 | /* time in jiffies at which to re-enable maskederrs */ | 266 | /* time in jiffies at which to re-enable maskederrs */ |
270 | unsigned long ipath_unmasktime; | 267 | unsigned long ipath_unmasktime; |
271 | /* | ||
272 | * errors always ignored (masked), at least for a given | ||
273 | * chip/device, because they are wrong or not useful | ||
274 | */ | ||
275 | ipath_err_t ipath_ignorederrs; | ||
276 | /* count of egrfull errors, combined for all ports */ | 268 | /* count of egrfull errors, combined for all ports */ |
277 | u64 ipath_last_tidfull; | 269 | u64 ipath_last_tidfull; |
278 | /* for ipath_qcheck() */ | 270 | /* for ipath_qcheck() */ |
@@ -436,6 +428,7 @@ struct ipath_devdata { | |||
436 | u64 ipath_lastibcstat; | 428 | u64 ipath_lastibcstat; |
437 | /* hwerrmask shadow */ | 429 | /* hwerrmask shadow */ |
438 | ipath_err_t ipath_hwerrmask; | 430 | ipath_err_t ipath_hwerrmask; |
431 | ipath_err_t ipath_errormask; /* errormask shadow */ | ||
439 | /* interrupt config reg shadow */ | 432 | /* interrupt config reg shadow */ |
440 | u64 ipath_intconfig; | 433 | u64 ipath_intconfig; |
441 | /* kr_sendpiobufbase value */ | 434 | /* kr_sendpiobufbase value */ |
@@ -683,7 +676,7 @@ int ipath_unordered_wc(void); | |||
683 | 676 | ||
684 | void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first, | 677 | void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first, |
685 | unsigned cnt); | 678 | unsigned cnt); |
686 | void ipath_cancel_sends(struct ipath_devdata *); | 679 | void ipath_cancel_sends(struct ipath_devdata *, int); |
687 | 680 | ||
688 | int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *); | 681 | int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *); |
689 | void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *); | 682 | void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *); |
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c index 73ed17d03188..bae4f56f7271 100644 --- a/drivers/infiniband/hw/ipath/ipath_stats.c +++ b/drivers/infiniband/hw/ipath/ipath_stats.c | |||
@@ -196,6 +196,45 @@ static void ipath_qcheck(struct ipath_devdata *dd) | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | static void ipath_chk_errormask(struct ipath_devdata *dd) | ||
200 | { | ||
201 | static u32 fixed; | ||
202 | u32 ctrl; | ||
203 | unsigned long errormask; | ||
204 | unsigned long hwerrs; | ||
205 | |||
206 | if (!dd->ipath_errormask || !(dd->ipath_flags & IPATH_INITTED)) | ||
207 | return; | ||
208 | |||
209 | errormask = ipath_read_kreg64(dd, dd->ipath_kregs->kr_errormask); | ||
210 | |||
211 | if (errormask == dd->ipath_errormask) | ||
212 | return; | ||
213 | fixed++; | ||
214 | |||
215 | hwerrs = ipath_read_kreg64(dd, dd->ipath_kregs->kr_hwerrstatus); | ||
216 | ctrl = ipath_read_kreg32(dd, dd->ipath_kregs->kr_control); | ||
217 | |||
218 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, | ||
219 | dd->ipath_errormask); | ||
220 | |||
221 | if ((hwerrs & dd->ipath_hwerrmask) || | ||
222 | (ctrl & INFINIPATH_C_FREEZEMODE)) { | ||
223 | /* force re-interrupt of pending events, just in case */ | ||
224 | ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrclear, 0ULL); | ||
225 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, 0ULL); | ||
226 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, 0ULL); | ||
227 | dev_info(&dd->pcidev->dev, | ||
228 | "errormask fixed(%u) %lx -> %lx, ctrl %x hwerr %lx\n", | ||
229 | fixed, errormask, (unsigned long)dd->ipath_errormask, | ||
230 | ctrl, hwerrs); | ||
231 | } else | ||
232 | ipath_dbg("errormask fixed(%u) %lx -> %lx, no freeze\n", | ||
233 | fixed, errormask, | ||
234 | (unsigned long)dd->ipath_errormask); | ||
235 | } | ||
236 | |||
237 | |||
199 | /** | 238 | /** |
200 | * ipath_get_faststats - get word counters from chip before they overflow | 239 | * ipath_get_faststats - get word counters from chip before they overflow |
201 | * @opaque - contains a pointer to the infinipath device ipath_devdata | 240 | * @opaque - contains a pointer to the infinipath device ipath_devdata |
@@ -251,14 +290,13 @@ void ipath_get_faststats(unsigned long opaque) | |||
251 | dd->ipath_lasterror = 0; | 290 | dd->ipath_lasterror = 0; |
252 | if (dd->ipath_lasthwerror) | 291 | if (dd->ipath_lasthwerror) |
253 | dd->ipath_lasthwerror = 0; | 292 | dd->ipath_lasthwerror = 0; |
254 | if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) | 293 | if (dd->ipath_maskederrs |
255 | && time_after(jiffies, dd->ipath_unmasktime)) { | 294 | && time_after(jiffies, dd->ipath_unmasktime)) { |
256 | char ebuf[256]; | 295 | char ebuf[256]; |
257 | int iserr; | 296 | int iserr; |
258 | iserr = ipath_decode_err(ebuf, sizeof ebuf, | 297 | iserr = ipath_decode_err(ebuf, sizeof ebuf, |
259 | (dd->ipath_maskederrs & ~dd-> | 298 | dd->ipath_maskederrs); |
260 | ipath_ignorederrs)); | 299 | if (dd->ipath_maskederrs & |
261 | if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) & | ||
262 | ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL | | 300 | ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL | |
263 | INFINIPATH_E_PKTERRS )) | 301 | INFINIPATH_E_PKTERRS )) |
264 | ipath_dev_err(dd, "Re-enabling masked errors " | 302 | ipath_dev_err(dd, "Re-enabling masked errors " |
@@ -278,9 +316,12 @@ void ipath_get_faststats(unsigned long opaque) | |||
278 | ipath_cdbg(ERRPKT, "Re-enabling packet" | 316 | ipath_cdbg(ERRPKT, "Re-enabling packet" |
279 | " problem interrupt (%s)\n", ebuf); | 317 | " problem interrupt (%s)\n", ebuf); |
280 | } | 318 | } |
281 | dd->ipath_maskederrs = dd->ipath_ignorederrs; | 319 | |
320 | /* re-enable masked errors */ | ||
321 | dd->ipath_errormask |= dd->ipath_maskederrs; | ||
282 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, | 322 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, |
283 | ~dd->ipath_maskederrs); | 323 | dd->ipath_errormask); |
324 | dd->ipath_maskederrs = 0; | ||
284 | } | 325 | } |
285 | 326 | ||
286 | /* limit qfull messages to ~one per minute per port */ | 327 | /* limit qfull messages to ~one per minute per port */ |
@@ -294,6 +335,7 @@ void ipath_get_faststats(unsigned long opaque) | |||
294 | } | 335 | } |
295 | } | 336 | } |
296 | 337 | ||
338 | ipath_chk_errormask(dd); | ||
297 | done: | 339 | done: |
298 | mod_timer(&dd->ipath_stats_timer, jiffies + HZ * 5); | 340 | mod_timer(&dd->ipath_stats_timer, jiffies + HZ * 5); |
299 | } | 341 | } |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index f6315dfb213e..ba0428d872aa 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1209,7 +1209,6 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg, | |||
1209 | memcpy(dseg->av, &to_mah(wr->wr.ud.ah)->av, sizeof (struct mlx4_av)); | 1209 | memcpy(dseg->av, &to_mah(wr->wr.ud.ah)->av, sizeof (struct mlx4_av)); |
1210 | dseg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn); | 1210 | dseg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn); |
1211 | dseg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey); | 1211 | dseg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey); |
1212 | |||
1213 | } | 1212 | } |
1214 | 1213 | ||
1215 | static void set_data_seg(struct mlx4_wqe_data_seg *dseg, | 1214 | static void set_data_seg(struct mlx4_wqe_data_seg *dseg, |
diff --git a/drivers/media/dvb/dvb-usb/af9005-fe.c b/drivers/media/dvb/dvb-usb/af9005-fe.c index 7195c9461524..b1a9c4cdec93 100644 --- a/drivers/media/dvb/dvb-usb/af9005-fe.c +++ b/drivers/media/dvb/dvb-usb/af9005-fe.c | |||
@@ -29,8 +29,6 @@ | |||
29 | 29 | ||
30 | struct af9005_fe_state { | 30 | struct af9005_fe_state { |
31 | struct dvb_usb_device *d; | 31 | struct dvb_usb_device *d; |
32 | struct dvb_frontend *tuner; | ||
33 | |||
34 | fe_status_t stat; | 32 | fe_status_t stat; |
35 | 33 | ||
36 | /* retraining parameters */ | 34 | /* retraining parameters */ |
@@ -345,8 +343,8 @@ static int af9005_reset_pre_viterbi(struct dvb_frontend *fe) | |||
345 | 1 & 0xff); | 343 | 1 & 0xff); |
346 | if (ret) | 344 | if (ret) |
347 | return ret; | 345 | return ret; |
348 | af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8, | 346 | ret = af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8, |
349 | 1 >> 8); | 347 | 1 >> 8); |
350 | if (ret) | 348 | if (ret) |
351 | return ret; | 349 | return ret; |
352 | /* reset pre viterbi error count */ | 350 | /* reset pre viterbi error count */ |
@@ -447,7 +445,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat) | |||
447 | u8 temp; | 445 | u8 temp; |
448 | int ret; | 446 | int ret; |
449 | 447 | ||
450 | if (state->tuner == NULL) | 448 | if (fe->ops.tuner_ops.release == NULL) |
451 | return -ENODEV; | 449 | return -ENODEV; |
452 | 450 | ||
453 | *stat = 0; | 451 | *stat = 0; |
@@ -493,7 +491,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat) | |||
493 | static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber) | 491 | static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber) |
494 | { | 492 | { |
495 | struct af9005_fe_state *state = fe->demodulator_priv; | 493 | struct af9005_fe_state *state = fe->demodulator_priv; |
496 | if (state->tuner == NULL) | 494 | if (fe->ops.tuner_ops.release == NULL) |
497 | return -ENODEV; | 495 | return -ENODEV; |
498 | af9005_fe_refresh_state(fe); | 496 | af9005_fe_refresh_state(fe); |
499 | *ber = state->ber; | 497 | *ber = state->ber; |
@@ -503,7 +501,7 @@ static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber) | |||
503 | static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc) | 501 | static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc) |
504 | { | 502 | { |
505 | struct af9005_fe_state *state = fe->demodulator_priv; | 503 | struct af9005_fe_state *state = fe->demodulator_priv; |
506 | if (state->tuner == NULL) | 504 | if (fe->ops.tuner_ops.release == NULL) |
507 | return -ENODEV; | 505 | return -ENODEV; |
508 | af9005_fe_refresh_state(fe); | 506 | af9005_fe_refresh_state(fe); |
509 | *unc = state->unc; | 507 | *unc = state->unc; |
@@ -517,7 +515,7 @@ static int af9005_fe_read_signal_strength(struct dvb_frontend *fe, | |||
517 | int ret; | 515 | int ret; |
518 | u8 if_gain, rf_gain; | 516 | u8 if_gain, rf_gain; |
519 | 517 | ||
520 | if (state->tuner == NULL) | 518 | if (fe->ops.tuner_ops.release == NULL) |
521 | return -ENODEV; | 519 | return -ENODEV; |
522 | ret = | 520 | ret = |
523 | af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain, | 521 | af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain, |
@@ -881,10 +879,8 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
881 | af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, | 879 | af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, |
882 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 1))) | 880 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 1))) |
883 | return ret; | 881 | return ret; |
884 | if ((ret = | 882 | ret = af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, |
885 | af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst, | 883 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 0); |
886 | reg_ofdm_rst_pos, reg_ofdm_rst_len, 0))) | ||
887 | return ret; | ||
888 | 884 | ||
889 | if (ret) | 885 | if (ret) |
890 | return ret; | 886 | return ret; |
@@ -1041,7 +1037,7 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
1041 | return ret; | 1037 | return ret; |
1042 | 1038 | ||
1043 | /* attach tuner and init */ | 1039 | /* attach tuner and init */ |
1044 | if (state->tuner == NULL) { | 1040 | if (fe->ops.tuner_ops.release == NULL) { |
1045 | /* read tuner and board id from eeprom */ | 1041 | /* read tuner and board id from eeprom */ |
1046 | ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2); | 1042 | ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2); |
1047 | if (ret) { | 1043 | if (ret) { |
@@ -1058,20 +1054,16 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
1058 | return ret; | 1054 | return ret; |
1059 | } | 1055 | } |
1060 | if1 = (u16) (buf[0] << 8) + buf[1]; | 1056 | if1 = (u16) (buf[0] << 8) + buf[1]; |
1061 | state->tuner = | 1057 | if (dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap, |
1062 | dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap, | 1058 | &af9005_mt2060_config, if1) == NULL) { |
1063 | &af9005_mt2060_config, if1); | ||
1064 | if (state->tuner == NULL) { | ||
1065 | deb_info("MT2060 attach failed\n"); | 1059 | deb_info("MT2060 attach failed\n"); |
1066 | return -ENODEV; | 1060 | return -ENODEV; |
1067 | } | 1061 | } |
1068 | break; | 1062 | break; |
1069 | case 3: /* QT1010 */ | 1063 | case 3: /* QT1010 */ |
1070 | case 9: /* QT1010B */ | 1064 | case 9: /* QT1010B */ |
1071 | state->tuner = | 1065 | if (dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap, |
1072 | dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap, | 1066 | &af9005_qt1010_config) ==NULL) { |
1073 | &af9005_qt1010_config); | ||
1074 | if (state->tuner == NULL) { | ||
1075 | deb_info("QT1010 attach failed\n"); | 1067 | deb_info("QT1010 attach failed\n"); |
1076 | return -ENODEV; | 1068 | return -ENODEV; |
1077 | } | 1069 | } |
@@ -1080,7 +1072,7 @@ static int af9005_fe_init(struct dvb_frontend *fe) | |||
1080 | err("Unsupported tuner type %d", buf[0]); | 1072 | err("Unsupported tuner type %d", buf[0]); |
1081 | return -ENODEV; | 1073 | return -ENODEV; |
1082 | } | 1074 | } |
1083 | ret = state->tuner->ops.tuner_ops.init(state->tuner); | 1075 | ret = fe->ops.tuner_ops.init(fe); |
1084 | if (ret) | 1076 | if (ret) |
1085 | return ret; | 1077 | return ret; |
1086 | } | 1078 | } |
@@ -1118,7 +1110,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1118 | 1110 | ||
1119 | deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency, | 1111 | deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency, |
1120 | fep->u.ofdm.bandwidth); | 1112 | fep->u.ofdm.bandwidth); |
1121 | if (state->tuner == NULL) { | 1113 | if (fe->ops.tuner_ops.release == NULL) { |
1122 | err("Tuner not attached"); | 1114 | err("Tuner not attached"); |
1123 | return -ENODEV; | 1115 | return -ENODEV; |
1124 | } | 1116 | } |
@@ -1199,7 +1191,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe, | |||
1199 | return ret; | 1191 | return ret; |
1200 | /* set tuner */ | 1192 | /* set tuner */ |
1201 | deb_info("set tuner\n"); | 1193 | deb_info("set tuner\n"); |
1202 | ret = state->tuner->ops.tuner_ops.set_params(state->tuner, fep); | 1194 | ret = fe->ops.tuner_ops.set_params(fe, fep); |
1203 | if (ret) | 1195 | if (ret) |
1204 | return ret; | 1196 | return ret; |
1205 | 1197 | ||
@@ -1435,12 +1427,6 @@ static void af9005_fe_release(struct dvb_frontend *fe) | |||
1435 | { | 1427 | { |
1436 | struct af9005_fe_state *state = | 1428 | struct af9005_fe_state *state = |
1437 | (struct af9005_fe_state *)fe->demodulator_priv; | 1429 | (struct af9005_fe_state *)fe->demodulator_priv; |
1438 | if (state->tuner != NULL && state->tuner->ops.tuner_ops.release != NULL) { | ||
1439 | state->tuner->ops.tuner_ops.release(state->tuner); | ||
1440 | #ifdef CONFIG_DVB_CORE_ATTACH | ||
1441 | symbol_put_addr(state->tuner->ops.tuner_ops.release); | ||
1442 | #endif | ||
1443 | } | ||
1444 | kfree(state); | 1430 | kfree(state); |
1445 | } | 1431 | } |
1446 | 1432 | ||
@@ -1458,7 +1444,6 @@ struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d) | |||
1458 | deb_info("attaching frontend af9005\n"); | 1444 | deb_info("attaching frontend af9005\n"); |
1459 | 1445 | ||
1460 | state->d = d; | 1446 | state->d = d; |
1461 | state->tuner = NULL; | ||
1462 | state->opened = 0; | 1447 | state->opened = 0; |
1463 | 1448 | ||
1464 | memcpy(&state->frontend.ops, &af9005_fe_ops, | 1449 | memcpy(&state->frontend.ops, &af9005_fe_ops, |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 0c0b94767bc1..ca99e439c97c 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -501,7 +501,7 @@ static struct dvb_pll_desc dvb_pll_opera1 = { | |||
501 | 501 | ||
502 | /* Philips FCV1236D | 502 | /* Philips FCV1236D |
503 | */ | 503 | */ |
504 | struct dvb_pll_desc dvb_pll_fcv1236d = { | 504 | static struct dvb_pll_desc dvb_pll_fcv1236d = { |
505 | /* Bit_0: RF Input select | 505 | /* Bit_0: RF Input select |
506 | * Bit_1: 0=digital, 1=analog | 506 | * Bit_1: 0=digital, 1=analog |
507 | */ | 507 | */ |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 387cb2122d4f..f6715007d409 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
35 | #include <linux/firmware.h> | 35 | #include <linux/firmware.h> |
36 | #include <net/checksum.h> | ||
36 | 37 | ||
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
38 | 39 | ||
@@ -45,7 +46,7 @@ static void boot_msp34xx(struct bttv *btv, int pin); | |||
45 | static void boot_bt832(struct bttv *btv); | 46 | static void boot_bt832(struct bttv *btv); |
46 | static void hauppauge_eeprom(struct bttv *btv); | 47 | static void hauppauge_eeprom(struct bttv *btv); |
47 | static void avermedia_eeprom(struct bttv *btv); | 48 | static void avermedia_eeprom(struct bttv *btv); |
48 | static void osprey_eeprom(struct bttv *btv); | 49 | static void osprey_eeprom(struct bttv *btv, const u8 ee[256]); |
49 | static void modtec_eeprom(struct bttv *btv); | 50 | static void modtec_eeprom(struct bttv *btv); |
50 | static void init_PXC200(struct bttv *btv); | 51 | static void init_PXC200(struct bttv *btv); |
51 | static void init_RTV24(struct bttv *btv); | 52 | static void init_RTV24(struct bttv *btv); |
@@ -2843,13 +2844,28 @@ struct tvcard bttv_tvcards[] = { | |||
2843 | .has_remote = 1, | 2844 | .has_remote = 1, |
2844 | }, | 2845 | }, |
2845 | /* ---- card 0x8c ---------------------------------- */ | 2846 | /* ---- card 0x8c ---------------------------------- */ |
2847 | /* Has four Bt878 chips behind a PCI bridge, each chip has: | ||
2848 | one external BNC composite input (mux 2) | ||
2849 | three internal composite inputs (unknown muxes) | ||
2850 | an 18-bit stereo A/D (CS5331A), which has: | ||
2851 | one external stereo unblanced (RCA) audio connection | ||
2852 | one (or 3?) internal stereo balanced (XLR) audio connection | ||
2853 | input is selected via gpio to a 14052B mux | ||
2854 | (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300) | ||
2855 | gain is controlled via an X9221A chip on the I2C bus @0x28 | ||
2856 | sample rate is controlled via gpio to an MK1413S | ||
2857 | (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3) | ||
2858 | There is neither a tuner nor an svideo input. */ | ||
2846 | [BTTV_BOARD_OSPREY440] = { | 2859 | [BTTV_BOARD_OSPREY440] = { |
2847 | .name = "Osprey 440", | 2860 | .name = "Osprey 440", |
2848 | .video_inputs = 1, | 2861 | .video_inputs = 4, |
2849 | .audio_inputs = 1, | 2862 | .audio_inputs = 2, /* this is meaningless */ |
2850 | .tuner = UNSET, | 2863 | .tuner = UNSET, |
2851 | .svhs = 1, | 2864 | .svhs = UNSET, |
2852 | .muxsel = { 2 }, | 2865 | .muxsel = { 2, 3, 0, 1 }, /* 3,0,1 are guesses */ |
2866 | .gpiomask = 0x303, | ||
2867 | .gpiomute = 0x000, /* int + 32kHz */ | ||
2868 | .gpiomux = { 0, 0, 0x000, 0x100}, | ||
2853 | .pll = PLL_28, | 2869 | .pll = PLL_28, |
2854 | .tuner_type = UNSET, | 2870 | .tuner_type = UNSET, |
2855 | .tuner_addr = ADDR_UNSET, | 2871 | .tuner_addr = ADDR_UNSET, |
@@ -3453,11 +3469,12 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3453 | case BTTV_BOARD_OSPREY2xx: | 3469 | case BTTV_BOARD_OSPREY2xx: |
3454 | case BTTV_BOARD_OSPREY2x0_SVID: | 3470 | case BTTV_BOARD_OSPREY2x0_SVID: |
3455 | case BTTV_BOARD_OSPREY2x0: | 3471 | case BTTV_BOARD_OSPREY2x0: |
3472 | case BTTV_BOARD_OSPREY440: | ||
3456 | case BTTV_BOARD_OSPREY500: | 3473 | case BTTV_BOARD_OSPREY500: |
3457 | case BTTV_BOARD_OSPREY540: | 3474 | case BTTV_BOARD_OSPREY540: |
3458 | case BTTV_BOARD_OSPREY2000: | 3475 | case BTTV_BOARD_OSPREY2000: |
3459 | bttv_readee(btv,eeprom_data,0xa0); | 3476 | bttv_readee(btv,eeprom_data,0xa0); |
3460 | osprey_eeprom(btv); | 3477 | osprey_eeprom(btv, eeprom_data); |
3461 | break; | 3478 | break; |
3462 | case BTTV_BOARD_IDS_EAGLE: | 3479 | case BTTV_BOARD_IDS_EAGLE: |
3463 | init_ids_eagle(btv); | 3480 | init_ids_eagle(btv); |
@@ -3748,106 +3765,119 @@ static int __devinit pvr_boot(struct bttv *btv) | |||
3748 | /* ----------------------------------------------------------------------- */ | 3765 | /* ----------------------------------------------------------------------- */ |
3749 | /* some osprey specific stuff */ | 3766 | /* some osprey specific stuff */ |
3750 | 3767 | ||
3751 | static void __devinit osprey_eeprom(struct bttv *btv) | 3768 | static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256]) |
3752 | { | 3769 | { |
3753 | int i = 0; | 3770 | int i; |
3754 | unsigned char *ee = eeprom_data; | 3771 | u32 serial = 0; |
3755 | unsigned long serial = 0; | 3772 | int cardid = -1; |
3756 | 3773 | ||
3757 | if (btv->c.type == 0) { | 3774 | /* This code will nevery actually get called in this case.... */ |
3758 | /* this might be an antique... check for MMAC label in eeprom */ | 3775 | if (btv->c.type == BTTV_BOARD_UNKNOWN) { |
3759 | if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) { | 3776 | /* this might be an antique... check for MMAC label in eeprom */ |
3760 | unsigned char checksum = 0; | 3777 | if (!strncmp(ee, "MMAC", 4)) { |
3761 | for (i = 0; i < 21; i++) | 3778 | u8 checksum = 0; |
3762 | checksum += ee[i]; | 3779 | for (i = 0; i < 21; i++) |
3763 | if (checksum != ee[21]) | 3780 | checksum += ee[i]; |
3764 | return; | 3781 | if (checksum != ee[21]) |
3765 | btv->c.type = BTTV_BOARD_OSPREY1x0_848; | 3782 | return; |
3766 | for (i = 12; i < 21; i++) | 3783 | cardid = BTTV_BOARD_OSPREY1x0_848; |
3767 | serial *= 10, serial += ee[i] - '0'; | 3784 | for (i = 12; i < 21; i++) |
3768 | } | 3785 | serial *= 10, serial += ee[i] - '0'; |
3786 | } | ||
3769 | } else { | 3787 | } else { |
3770 | unsigned short type; | 3788 | unsigned short type; |
3771 | int offset = 4*16; | 3789 | |
3772 | 3790 | for (i = 4*16; i < 8*16; i += 16) { | |
3773 | for (; offset < 8*16; offset += 16) { | 3791 | u16 checksum = ip_compute_csum(ee + i, 16); |
3774 | unsigned short checksum = 0; | 3792 | |
3775 | /* verify the checksum */ | 3793 | if ((checksum&0xff) + (checksum>>8) == 0xff) |
3776 | for (i = 0; i < 14; i++) | 3794 | break; |
3777 | checksum += ee[i+offset]; | 3795 | } |
3778 | checksum = ~checksum; /* no idea why */ | 3796 | if (i >= 8*16) |
3779 | if ((((checksum>>8)&0x0FF) == ee[offset+14]) && | 3797 | return; |
3780 | ((checksum & 0x0FF) == ee[offset+15])) { | 3798 | ee += i; |
3781 | break; | 3799 | |
3782 | } | 3800 | /* found a valid descriptor */ |
3783 | } | 3801 | type = be16_to_cpup((u16*)(ee+4)); |
3784 | 3802 | ||
3785 | if (offset >= 8*16) | 3803 | switch(type) { |
3786 | return; | 3804 | /* 848 based */ |
3787 | 3805 | case 0x0004: | |
3788 | /* found a valid descriptor */ | 3806 | cardid = BTTV_BOARD_OSPREY1x0_848; |
3789 | type = (ee[offset+4]<<8) | (ee[offset+5]); | 3807 | break; |
3790 | 3808 | case 0x0005: | |
3791 | switch(type) { | 3809 | cardid = BTTV_BOARD_OSPREY101_848; |
3792 | /* 848 based */ | 3810 | break; |
3793 | case 0x0004: | 3811 | |
3794 | btv->c.type = BTTV_BOARD_OSPREY1x0_848; | 3812 | /* 878 based */ |
3795 | break; | 3813 | case 0x0012: |
3796 | case 0x0005: | 3814 | case 0x0013: |
3797 | btv->c.type = BTTV_BOARD_OSPREY101_848; | 3815 | cardid = BTTV_BOARD_OSPREY1x0; |
3798 | break; | 3816 | break; |
3799 | 3817 | case 0x0014: | |
3800 | /* 878 based */ | 3818 | case 0x0015: |
3801 | case 0x0012: | 3819 | cardid = BTTV_BOARD_OSPREY1x1; |
3802 | case 0x0013: | 3820 | break; |
3803 | btv->c.type = BTTV_BOARD_OSPREY1x0; | 3821 | case 0x0016: |
3804 | break; | 3822 | case 0x0017: |
3805 | case 0x0014: | 3823 | case 0x0020: |
3806 | case 0x0015: | 3824 | cardid = BTTV_BOARD_OSPREY1x1_SVID; |
3807 | btv->c.type = BTTV_BOARD_OSPREY1x1; | 3825 | break; |
3808 | break; | 3826 | case 0x0018: |
3809 | case 0x0016: | 3827 | case 0x0019: |
3810 | case 0x0017: | 3828 | case 0x001E: |
3811 | case 0x0020: | 3829 | case 0x001F: |
3812 | btv->c.type = BTTV_BOARD_OSPREY1x1_SVID; | 3830 | cardid = BTTV_BOARD_OSPREY2xx; |
3813 | break; | 3831 | break; |
3814 | case 0x0018: | 3832 | case 0x001A: |
3815 | case 0x0019: | 3833 | case 0x001B: |
3816 | case 0x001E: | 3834 | cardid = BTTV_BOARD_OSPREY2x0_SVID; |
3817 | case 0x001F: | 3835 | break; |
3818 | btv->c.type = BTTV_BOARD_OSPREY2xx; | 3836 | case 0x0040: |
3819 | break; | 3837 | cardid = BTTV_BOARD_OSPREY500; |
3820 | case 0x001A: | 3838 | break; |
3821 | case 0x001B: | 3839 | case 0x0050: |
3822 | btv->c.type = BTTV_BOARD_OSPREY2x0_SVID; | 3840 | case 0x0056: |
3823 | break; | 3841 | cardid = BTTV_BOARD_OSPREY540; |
3824 | case 0x0040: | 3842 | /* bttv_osprey_540_init(btv); */ |
3825 | btv->c.type = BTTV_BOARD_OSPREY500; | 3843 | break; |
3826 | break; | 3844 | case 0x0060: |
3827 | case 0x0050: | 3845 | case 0x0070: |
3828 | case 0x0056: | 3846 | case 0x00A0: |
3829 | btv->c.type = BTTV_BOARD_OSPREY540; | 3847 | cardid = BTTV_BOARD_OSPREY2x0; |
3830 | /* bttv_osprey_540_init(btv); */ | 3848 | /* enable output on select control lines */ |
3831 | break; | 3849 | gpio_inout(0xffffff,0x000303); |
3832 | case 0x0060: | 3850 | break; |
3833 | case 0x0070: | 3851 | case 0x00D8: |
3834 | case 0x00A0: | 3852 | cardid = BTTV_BOARD_OSPREY440; |
3835 | btv->c.type = BTTV_BOARD_OSPREY2x0; | 3853 | break; |
3836 | /* enable output on select control lines */ | 3854 | default: |
3837 | gpio_inout(0xffffff,0x000303); | 3855 | /* unknown...leave generic, but get serial # */ |
3838 | break; | 3856 | printk(KERN_INFO "bttv%d: " |
3839 | default: | 3857 | "osprey eeprom: unknown card type 0x%04x\n", |
3840 | /* unknown...leave generic, but get serial # */ | 3858 | btv->c.nr, type); |
3841 | break; | 3859 | break; |
3842 | } | 3860 | } |
3843 | serial = (ee[offset+6] << 24) | 3861 | serial = be32_to_cpup((u32*)(ee+6)); |
3844 | | (ee[offset+7] << 16) | 3862 | } |
3845 | | (ee[offset+8] << 8) | 3863 | |
3846 | | (ee[offset+9]); | 3864 | printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n", |
3847 | } | 3865 | btv->c.nr, cardid, |
3848 | 3866 | cardid>0 ? bttv_tvcards[cardid].name : "Unknown", serial); | |
3849 | printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n", | 3867 | |
3850 | btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial); | 3868 | if (cardid<0 || btv->c.type == cardid) |
3869 | return; | ||
3870 | |||
3871 | /* card type isn't set correctly */ | ||
3872 | if (card[btv->c.nr] < bttv_num_tvcards) { | ||
3873 | printk(KERN_WARNING "bttv%d: osprey eeprom: " | ||
3874 | "Not overriding user specified card type\n", btv->c.nr); | ||
3875 | } else { | ||
3876 | printk(KERN_INFO "bttv%d: osprey eeprom: " | ||
3877 | "Changing card type from %d to %d\n", btv->c.nr, | ||
3878 | btv->c.type, cardid); | ||
3879 | btv->c.type = cardid; | ||
3880 | } | ||
3851 | } | 3881 | } |
3852 | 3882 | ||
3853 | /* ----------------------------------------------------------------------- */ | 3883 | /* ----------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 91b588d261ae..8abb34a35816 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -417,6 +417,7 @@ struct ivtv_mailbox_data { | |||
417 | #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ | 417 | #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ |
418 | #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ | 418 | #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ |
419 | #define IVTV_F_I_PIO 19 /* PIO in progress */ | 419 | #define IVTV_F_I_PIO 19 /* PIO in progress */ |
420 | #define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */ | ||
420 | 421 | ||
421 | /* Event notifications */ | 422 | /* Event notifications */ |
422 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ | 423 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 8e97a938398f..5dd519caf81d 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -757,6 +757,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts) | |||
757 | itv->output_mode = OUT_NONE; | 757 | itv->output_mode = OUT_NONE; |
758 | 758 | ||
759 | itv->speed = 0; | 759 | itv->speed = 0; |
760 | clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags); | ||
760 | ivtv_release_stream(s); | 761 | ivtv_release_stream(s); |
761 | } | 762 | } |
762 | 763 | ||
@@ -799,7 +800,16 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) | |||
799 | ivtv_unmute(itv); | 800 | ivtv_unmute(itv); |
800 | ivtv_release_stream(s); | 801 | ivtv_release_stream(s); |
801 | } else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { | 802 | } else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { |
803 | struct ivtv_stream *s_vout = &itv->streams[IVTV_DEC_STREAM_TYPE_VOUT]; | ||
804 | |||
802 | ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0); | 805 | ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0); |
806 | |||
807 | /* If all output streams are closed, and if the user doesn't have | ||
808 | IVTV_DEC_STREAM_TYPE_VOUT open, then disable VBI on TV-out. */ | ||
809 | if (itv->output_mode == OUT_NONE && !test_bit(IVTV_F_S_APPL_IO, &s_vout->s_flags)) { | ||
810 | /* disable VBI on TV-out */ | ||
811 | ivtv_disable_vbi(itv); | ||
812 | } | ||
803 | } else { | 813 | } else { |
804 | ivtv_stop_capture(id, 0); | 814 | ivtv_stop_capture(id, 0); |
805 | } | 815 | } |
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index d0feabf93080..425eb1063904 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -72,8 +72,8 @@ retry: | |||
72 | dst++; | 72 | dst++; |
73 | src++; | 73 | src++; |
74 | } | 74 | } |
75 | release_firmware(fw); | ||
76 | IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size); | 75 | IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size); |
76 | release_firmware(fw); | ||
77 | return size; | 77 | return size; |
78 | } | 78 | } |
79 | IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size); | 79 | IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 4773453e8dab..047624b9e271 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -285,6 +285,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
285 | 285 | ||
286 | if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG) | 286 | if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG) |
287 | return -EBUSY; | 287 | return -EBUSY; |
288 | if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) { | ||
289 | /* forces ivtv_set_speed to be called */ | ||
290 | itv->speed = 0; | ||
291 | } | ||
288 | return ivtv_start_decoding(id, vc->play.speed); | 292 | return ivtv_start_decoding(id, vc->play.speed); |
289 | } | 293 | } |
290 | 294 | ||
@@ -309,6 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
309 | if (atomic_read(&itv->decoding) > 0) { | 313 | if (atomic_read(&itv->decoding) > 0) { |
310 | ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, | 314 | ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, |
311 | (vc->flags & VIDEO_CMD_FREEZE_TO_BLACK) ? 1 : 0); | 315 | (vc->flags & VIDEO_CMD_FREEZE_TO_BLACK) ? 1 : 0); |
316 | set_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags); | ||
312 | } | 317 | } |
313 | break; | 318 | break; |
314 | 319 | ||
@@ -317,8 +322,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
317 | if (try) break; | 322 | if (try) break; |
318 | if (itv->output_mode != OUT_MPG) | 323 | if (itv->output_mode != OUT_MPG) |
319 | return -EBUSY; | 324 | return -EBUSY; |
320 | if (atomic_read(&itv->decoding) > 0) { | 325 | if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) { |
321 | ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, 0, 0); | 326 | int speed = itv->speed; |
327 | itv->speed = 0; | ||
328 | return ivtv_start_decoding(id, speed); | ||
322 | } | 329 | } |
323 | break; | 330 | break; |
324 | 331 | ||
diff --git a/drivers/media/video/ivtv/ivtv-mailbox.c b/drivers/media/video/ivtv/ivtv-mailbox.c index 814a673712b3..5e3b679202ae 100644 --- a/drivers/media/video/ivtv/ivtv-mailbox.c +++ b/drivers/media/video/ivtv/ivtv-mailbox.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #define API_HIGH_VOL (1 << 5) /* High volume command (i.e. called during encoding or decoding) */ | 40 | #define API_HIGH_VOL (1 << 5) /* High volume command (i.e. called during encoding or decoding) */ |
41 | #define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */ | 41 | #define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */ |
42 | #define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */ | 42 | #define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */ |
43 | #define API_NO_POLL (1 << 6) /* Avoid pointless polling */ | ||
43 | 44 | ||
44 | struct ivtv_api_info { | 45 | struct ivtv_api_info { |
45 | int flags; /* Flags, see above */ | 46 | int flags; /* Flags, see above */ |
@@ -51,7 +52,7 @@ struct ivtv_api_info { | |||
51 | static const struct ivtv_api_info api_info[256] = { | 52 | static const struct ivtv_api_info api_info[256] = { |
52 | /* MPEG encoder API */ | 53 | /* MPEG encoder API */ |
53 | API_ENTRY(CX2341X_ENC_PING_FW, API_FAST_RESULT), | 54 | API_ENTRY(CX2341X_ENC_PING_FW, API_FAST_RESULT), |
54 | API_ENTRY(CX2341X_ENC_START_CAPTURE, API_RESULT), | 55 | API_ENTRY(CX2341X_ENC_START_CAPTURE, API_RESULT | API_NO_POLL), |
55 | API_ENTRY(CX2341X_ENC_STOP_CAPTURE, API_RESULT), | 56 | API_ENTRY(CX2341X_ENC_STOP_CAPTURE, API_RESULT), |
56 | API_ENTRY(CX2341X_ENC_SET_AUDIO_ID, API_CACHE), | 57 | API_ENTRY(CX2341X_ENC_SET_AUDIO_ID, API_CACHE), |
57 | API_ENTRY(CX2341X_ENC_SET_VIDEO_ID, API_CACHE), | 58 | API_ENTRY(CX2341X_ENC_SET_VIDEO_ID, API_CACHE), |
@@ -96,7 +97,7 @@ static const struct ivtv_api_info api_info[256] = { | |||
96 | 97 | ||
97 | /* MPEG decoder API */ | 98 | /* MPEG decoder API */ |
98 | API_ENTRY(CX2341X_DEC_PING_FW, API_FAST_RESULT), | 99 | API_ENTRY(CX2341X_DEC_PING_FW, API_FAST_RESULT), |
99 | API_ENTRY(CX2341X_DEC_START_PLAYBACK, API_RESULT), | 100 | API_ENTRY(CX2341X_DEC_START_PLAYBACK, API_RESULT | API_NO_POLL), |
100 | API_ENTRY(CX2341X_DEC_STOP_PLAYBACK, API_RESULT), | 101 | API_ENTRY(CX2341X_DEC_STOP_PLAYBACK, API_RESULT), |
101 | API_ENTRY(CX2341X_DEC_SET_PLAYBACK_SPEED, API_RESULT), | 102 | API_ENTRY(CX2341X_DEC_SET_PLAYBACK_SPEED, API_RESULT), |
102 | API_ENTRY(CX2341X_DEC_STEP_VIDEO, API_RESULT), | 103 | API_ENTRY(CX2341X_DEC_STEP_VIDEO, API_RESULT), |
@@ -290,6 +291,13 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) | |||
290 | /* Get results */ | 291 | /* Get results */ |
291 | then = jiffies; | 292 | then = jiffies; |
292 | 293 | ||
294 | if (!(flags & API_NO_POLL)) { | ||
295 | /* First try to poll, then switch to delays */ | ||
296 | for (i = 0; i < 100; i++) { | ||
297 | if (readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE) | ||
298 | break; | ||
299 | } | ||
300 | } | ||
293 | while (!(readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)) { | 301 | while (!(readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)) { |
294 | if (jiffies - then > api_timeout) { | 302 | if (jiffies - then > api_timeout) { |
295 | IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name); | 303 | IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name); |
@@ -301,7 +309,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) | |||
301 | if (flags & API_NO_WAIT_RES) | 309 | if (flags & API_NO_WAIT_RES) |
302 | mdelay(1); | 310 | mdelay(1); |
303 | else | 311 | else |
304 | ivtv_msleep_timeout(10, 0); | 312 | ivtv_msleep_timeout(1, 0); |
305 | } | 313 | } |
306 | if (jiffies - then > msecs_to_jiffies(100)) | 314 | if (jiffies - then > msecs_to_jiffies(100)) |
307 | IVTV_DEBUG_WARN("%s took %u jiffies\n", | 315 | IVTV_DEBUG_WARN("%s took %u jiffies\n", |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 322b347b67c2..51df3f855031 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -603,10 +603,6 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s) | |||
603 | 603 | ||
604 | IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); | 604 | IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); |
605 | 605 | ||
606 | /* disable VBI signals, if the MPEG stream contains VBI data, | ||
607 | then that data will be processed automatically for you. */ | ||
608 | ivtv_disable_vbi(itv); | ||
609 | |||
610 | /* set audio mode to left/stereo for dual/stereo mode. */ | 606 | /* set audio mode to left/stereo for dual/stereo mode. */ |
611 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); | 607 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); |
612 | 608 | ||
@@ -639,7 +635,7 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s) | |||
639 | } | 635 | } |
640 | if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, | 636 | if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, |
641 | itv->params.width, itv->params.height, itv->params.audio_properties)) { | 637 | itv->params.width, itv->params.height, itv->params.audio_properties)) { |
642 | IVTV_DEBUG_WARN("COULDN'T INITIALIZE DECODER SOURCE\n"); | 638 | IVTV_DEBUG_WARN("Couldn't initialize decoder source\n"); |
643 | } | 639 | } |
644 | return 0; | 640 | return 0; |
645 | } | 641 | } |
@@ -909,11 +905,6 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) | |||
909 | clear_bit(IVTV_F_S_STREAMING, &s->s_flags); | 905 | clear_bit(IVTV_F_S_STREAMING, &s->s_flags); |
910 | ivtv_flush_queues(s); | 906 | ivtv_flush_queues(s); |
911 | 907 | ||
912 | if (!test_bit(IVTV_F_S_PASSTHROUGH, &s->s_flags)) { | ||
913 | /* disable VBI on TV-out */ | ||
914 | ivtv_disable_vbi(itv); | ||
915 | } | ||
916 | |||
917 | /* decrement decoding */ | 908 | /* decrement decoding */ |
918 | atomic_dec(&itv->decoding); | 909 | atomic_dec(&itv->decoding); |
919 | 910 | ||
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 868b6886fe7f..e3371f972240 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -517,6 +517,7 @@ static int vidioc_g_register (struct file *file, void *priv, | |||
517 | __FUNCTION__, errCode); | 517 | __FUNCTION__, errCode); |
518 | return errCode; | 518 | return errCode; |
519 | } | 519 | } |
520 | reg->val = errCode; | ||
520 | return 0; | 521 | return 0; |
521 | } | 522 | } |
522 | 523 | ||
@@ -531,8 +532,8 @@ static int vidioc_s_register (struct file *file, void *priv, | |||
531 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | 532 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
532 | return -EINVAL; | 533 | return -EINVAL; |
533 | /* NT100x has a 8-bit register space */ | 534 | /* NT100x has a 8-bit register space */ |
534 | reg->val = (u8)usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); | 535 | errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); |
535 | if (reg->val < 0) { | 536 | if (errCode < 0) { |
536 | err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", | 537 | err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", |
537 | __FUNCTION__, errCode); | 538 | __FUNCTION__, errCode); |
538 | return errCode; | 539 | return errCode; |
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index 8fb4a3414e0a..937c4a616c0e 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h | |||
@@ -240,11 +240,16 @@ enum gpcs_type { | |||
240 | 240 | ||
241 | struct zoran_format { | 241 | struct zoran_format { |
242 | char *name; | 242 | char *name; |
243 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
243 | int palette; | 244 | int palette; |
245 | #endif | ||
246 | #ifdef CONFIG_VIDEO_V4L2 | ||
244 | __u32 fourcc; | 247 | __u32 fourcc; |
245 | int colorspace; | 248 | int colorspace; |
249 | #endif | ||
246 | int depth; | 250 | int depth; |
247 | __u32 flags; | 251 | __u32 flags; |
252 | __u32 vfespfr; | ||
248 | }; | 253 | }; |
249 | /* flags */ | 254 | /* flags */ |
250 | #define ZORAN_FORMAT_COMPRESSED 1<<0 | 255 | #define ZORAN_FORMAT_COMPRESSED 1<<0 |
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index b0752767ee4f..ba2f4ed29483 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -429,8 +429,6 @@ zr36057_set_vfe (struct zoran *zr, | |||
429 | reg |= (HorDcm << ZR36057_VFESPFR_HorDcm); | 429 | reg |= (HorDcm << ZR36057_VFESPFR_HorDcm); |
430 | reg |= (VerDcm << ZR36057_VFESPFR_VerDcm); | 430 | reg |= (VerDcm << ZR36057_VFESPFR_VerDcm); |
431 | reg |= (DispMode << ZR36057_VFESPFR_DispMode); | 431 | reg |= (DispMode << ZR36057_VFESPFR_DispMode); |
432 | if (format->palette != VIDEO_PALETTE_YUV422 && format->palette != VIDEO_PALETTE_YUYV) | ||
433 | reg |= ZR36057_VFESPFR_LittleEndian; | ||
434 | /* RJ: I don't know, why the following has to be the opposite | 432 | /* RJ: I don't know, why the following has to be the opposite |
435 | * of the corresponding ZR36060 setting, but only this way | 433 | * of the corresponding ZR36060 setting, but only this way |
436 | * we get the correct colors when uncompressing to the screen */ | 434 | * we get the correct colors when uncompressing to the screen */ |
@@ -439,36 +437,6 @@ zr36057_set_vfe (struct zoran *zr, | |||
439 | if (zr->norm != VIDEO_MODE_NTSC) | 437 | if (zr->norm != VIDEO_MODE_NTSC) |
440 | reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang | 438 | reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang |
441 | reg |= ZR36057_VFESPFR_TopField; | 439 | reg |= ZR36057_VFESPFR_TopField; |
442 | switch (format->palette) { | ||
443 | |||
444 | case VIDEO_PALETTE_YUYV: | ||
445 | case VIDEO_PALETTE_YUV422: | ||
446 | reg |= ZR36057_VFESPFR_YUV422; | ||
447 | break; | ||
448 | |||
449 | case VIDEO_PALETTE_RGB555: | ||
450 | reg |= ZR36057_VFESPFR_RGB555 | ZR36057_VFESPFR_ErrDif; | ||
451 | break; | ||
452 | |||
453 | case VIDEO_PALETTE_RGB565: | ||
454 | reg |= ZR36057_VFESPFR_RGB565 | ZR36057_VFESPFR_ErrDif; | ||
455 | break; | ||
456 | |||
457 | case VIDEO_PALETTE_RGB24: | ||
458 | reg |= ZR36057_VFESPFR_RGB888 | ZR36057_VFESPFR_Pack24; | ||
459 | break; | ||
460 | |||
461 | case VIDEO_PALETTE_RGB32: | ||
462 | reg |= ZR36057_VFESPFR_RGB888; | ||
463 | break; | ||
464 | |||
465 | default: | ||
466 | dprintk(1, | ||
467 | KERN_INFO "%s: set_vfe() - unknown color_fmt=%x\n", | ||
468 | ZR_DEVNAME(zr), format->palette); | ||
469 | return; | ||
470 | |||
471 | } | ||
472 | if (HorDcm >= 48) { | 440 | if (HorDcm >= 48) { |
473 | reg |= 3 << ZR36057_VFESPFR_HFilter; /* 5 tap filter */ | 441 | reg |= 3 << ZR36057_VFESPFR_HFilter; /* 5 tap filter */ |
474 | } else if (HorDcm >= 32) { | 442 | } else if (HorDcm >= 32) { |
@@ -476,6 +444,7 @@ zr36057_set_vfe (struct zoran *zr, | |||
476 | } else if (HorDcm >= 16) { | 444 | } else if (HorDcm >= 16) { |
477 | reg |= 1 << ZR36057_VFESPFR_HFilter; /* 3 tap filter */ | 445 | reg |= 1 << ZR36057_VFESPFR_HFilter; /* 3 tap filter */ |
478 | } | 446 | } |
447 | reg |= format->vfespfr; | ||
479 | btwrite(reg, ZR36057_VFESPFR); | 448 | btwrite(reg, ZR36057_VFESPFR); |
480 | 449 | ||
481 | /* display configuration */ | 450 | /* display configuration */ |
@@ -651,11 +620,17 @@ zr36057_set_memgrab (struct zoran *zr, | |||
651 | int mode) | 620 | int mode) |
652 | { | 621 | { |
653 | if (mode) { | 622 | if (mode) { |
654 | if (btread(ZR36057_VSSFGR) & | 623 | /* We only check SnapShot and not FrameGrab here. SnapShot==1 |
655 | (ZR36057_VSSFGR_SnapShot | ZR36057_VSSFGR_FrameGrab)) | 624 | * means a capture is already in progress, but FrameGrab==1 |
625 | * doesn't necessary mean that. It's more correct to say a 1 | ||
626 | * to 0 transition indicates a capture completed. If a | ||
627 | * capture is pending when capturing is tuned off, FrameGrab | ||
628 | * will be stuck at 1 until capturing is turned back on. | ||
629 | */ | ||
630 | if (btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) | ||
656 | dprintk(1, | 631 | dprintk(1, |
657 | KERN_WARNING | 632 | KERN_WARNING |
658 | "%s: zr36057_set_memgrab(1) with SnapShot or FrameGrab on!?\n", | 633 | "%s: zr36057_set_memgrab(1) with SnapShot on!?\n", |
659 | ZR_DEVNAME(zr)); | 634 | ZR_DEVNAME(zr)); |
660 | 635 | ||
661 | /* switch on VSync interrupts */ | 636 | /* switch on VSync interrupts */ |
@@ -672,11 +647,12 @@ zr36057_set_memgrab (struct zoran *zr, | |||
672 | 647 | ||
673 | zr->v4l_memgrab_active = 1; | 648 | zr->v4l_memgrab_active = 1; |
674 | } else { | 649 | } else { |
675 | zr->v4l_memgrab_active = 0; | ||
676 | |||
677 | /* switch off VSync interrupts */ | 650 | /* switch off VSync interrupts */ |
678 | btand(~zr->card.vsync_int, ZR36057_ICR); // SW | 651 | btand(~zr->card.vsync_int, ZR36057_ICR); // SW |
679 | 652 | ||
653 | zr->v4l_memgrab_active = 0; | ||
654 | zr->v4l_grab_frame = NO_GRAB_ACTIVE; | ||
655 | |||
680 | /* reenable grabbing to screen if it was running */ | 656 | /* reenable grabbing to screen if it was running */ |
681 | if (zr->v4l_overlay_active) { | 657 | if (zr->v4l_overlay_active) { |
682 | zr36057_overlay(zr, 1); | 658 | zr36057_overlay(zr, 1); |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 17118a490f81..72a037b75d63 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -99,88 +99,103 @@ | |||
99 | 99 | ||
100 | #include <asm/byteorder.h> | 100 | #include <asm/byteorder.h> |
101 | 101 | ||
102 | const struct zoran_format zoran_formats[] = { | 102 | #if defined(CONFIG_VIDEO_V4L2) && defined(CONFIG_VIDEO_V4L1_COMPAT) |
103 | { | 103 | #define ZFMT(pal, fcc, cs) \ |
104 | .name = "15-bit RGB", | 104 | .palette = (pal), .fourcc = (fcc), .colorspace = (cs) |
105 | .palette = VIDEO_PALETTE_RGB555, | 105 | #elif defined(CONFIG_VIDEO_V4L2) |
106 | #ifdef CONFIG_VIDEO_V4L2 | 106 | #define ZFMT(pal, fcc, cs) \ |
107 | #ifdef __LITTLE_ENDIAN | 107 | .fourcc = (fcc), .colorspace = (cs) |
108 | .fourcc = V4L2_PIX_FMT_RGB555, | ||
109 | #else | 108 | #else |
110 | .fourcc = V4L2_PIX_FMT_RGB555X, | 109 | #define ZFMT(pal, fcc, cs) \ |
111 | #endif | 110 | .palette = (pal) |
112 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
113 | #endif | 111 | #endif |
112 | |||
113 | const struct zoran_format zoran_formats[] = { | ||
114 | { | ||
115 | .name = "15-bit RGB LE", | ||
116 | ZFMT(VIDEO_PALETTE_RGB555, | ||
117 | V4L2_PIX_FMT_RGB555, V4L2_COLORSPACE_SRGB), | ||
114 | .depth = 15, | 118 | .depth = 15, |
115 | .flags = ZORAN_FORMAT_CAPTURE | | 119 | .flags = ZORAN_FORMAT_CAPTURE | |
116 | ZORAN_FORMAT_OVERLAY, | 120 | ZORAN_FORMAT_OVERLAY, |
121 | .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif| | ||
122 | ZR36057_VFESPFR_LittleEndian, | ||
117 | }, { | 123 | }, { |
118 | .name = "16-bit RGB", | 124 | .name = "15-bit RGB BE", |
119 | .palette = VIDEO_PALETTE_RGB565, | 125 | ZFMT(-1, |
120 | #ifdef CONFIG_VIDEO_V4L2 | 126 | V4L2_PIX_FMT_RGB555X, V4L2_COLORSPACE_SRGB), |
121 | #ifdef __LITTLE_ENDIAN | 127 | .depth = 15, |
122 | .fourcc = V4L2_PIX_FMT_RGB565, | 128 | .flags = ZORAN_FORMAT_CAPTURE | |
123 | #else | 129 | ZORAN_FORMAT_OVERLAY, |
124 | .fourcc = V4L2_PIX_FMT_RGB565X, | 130 | .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif, |
125 | #endif | 131 | }, { |
126 | .colorspace = V4L2_COLORSPACE_SRGB, | 132 | .name = "16-bit RGB LE", |
127 | #endif | 133 | ZFMT(VIDEO_PALETTE_RGB565, |
134 | V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB), | ||
128 | .depth = 16, | 135 | .depth = 16, |
129 | .flags = ZORAN_FORMAT_CAPTURE | | 136 | .flags = ZORAN_FORMAT_CAPTURE | |
130 | ZORAN_FORMAT_OVERLAY, | 137 | ZORAN_FORMAT_OVERLAY, |
138 | .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif| | ||
139 | ZR36057_VFESPFR_LittleEndian, | ||
140 | }, { | ||
141 | .name = "16-bit RGB BE", | ||
142 | ZFMT(-1, | ||
143 | V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB), | ||
144 | .depth = 16, | ||
145 | .flags = ZORAN_FORMAT_CAPTURE | | ||
146 | ZORAN_FORMAT_OVERLAY, | ||
147 | .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif, | ||
131 | }, { | 148 | }, { |
132 | .name = "24-bit RGB", | 149 | .name = "24-bit RGB", |
133 | .palette = VIDEO_PALETTE_RGB24, | 150 | ZFMT(VIDEO_PALETTE_RGB24, |
134 | #ifdef CONFIG_VIDEO_V4L2 | 151 | V4L2_PIX_FMT_BGR24, V4L2_COLORSPACE_SRGB), |
135 | #ifdef __LITTLE_ENDIAN | ||
136 | .fourcc = V4L2_PIX_FMT_BGR24, | ||
137 | #else | ||
138 | .fourcc = V4L2_PIX_FMT_RGB24, | ||
139 | #endif | ||
140 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
141 | #endif | ||
142 | .depth = 24, | 152 | .depth = 24, |
143 | .flags = ZORAN_FORMAT_CAPTURE | | 153 | .flags = ZORAN_FORMAT_CAPTURE | |
144 | ZORAN_FORMAT_OVERLAY, | 154 | ZORAN_FORMAT_OVERLAY, |
155 | .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_Pack24, | ||
145 | }, { | 156 | }, { |
146 | .name = "32-bit RGB", | 157 | .name = "32-bit RGB LE", |
147 | .palette = VIDEO_PALETTE_RGB32, | 158 | ZFMT(VIDEO_PALETTE_RGB32, |
148 | #ifdef CONFIG_VIDEO_V4L2 | 159 | V4L2_PIX_FMT_BGR32, V4L2_COLORSPACE_SRGB), |
149 | #ifdef __LITTLE_ENDIAN | 160 | .depth = 32, |
150 | .fourcc = V4L2_PIX_FMT_BGR32, | 161 | .flags = ZORAN_FORMAT_CAPTURE | |
151 | #else | 162 | ZORAN_FORMAT_OVERLAY, |
152 | .fourcc = V4L2_PIX_FMT_RGB32, | 163 | .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_LittleEndian, |
153 | #endif | 164 | }, { |
154 | .colorspace = V4L2_COLORSPACE_SRGB, | 165 | .name = "32-bit RGB BE", |
155 | #endif | 166 | ZFMT(-1, |
167 | V4L2_PIX_FMT_RGB32, V4L2_COLORSPACE_SRGB), | ||
156 | .depth = 32, | 168 | .depth = 32, |
157 | .flags = ZORAN_FORMAT_CAPTURE | | 169 | .flags = ZORAN_FORMAT_CAPTURE | |
158 | ZORAN_FORMAT_OVERLAY, | 170 | ZORAN_FORMAT_OVERLAY, |
171 | .vfespfr = ZR36057_VFESPFR_RGB888, | ||
159 | }, { | 172 | }, { |
160 | .name = "4:2:2, packed, YUYV", | 173 | .name = "4:2:2, packed, YUYV", |
161 | .palette = VIDEO_PALETTE_YUV422, | 174 | ZFMT(VIDEO_PALETTE_YUV422, |
162 | #ifdef CONFIG_VIDEO_V4L2 | 175 | V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_SMPTE170M), |
163 | .fourcc = V4L2_PIX_FMT_YUYV, | 176 | .depth = 16, |
164 | .colorspace = V4L2_COLORSPACE_SMPTE170M, | 177 | .flags = ZORAN_FORMAT_CAPTURE | |
165 | #endif | 178 | ZORAN_FORMAT_OVERLAY, |
179 | .vfespfr = ZR36057_VFESPFR_YUV422, | ||
180 | }, { | ||
181 | .name = "4:2:2, packed, UYVY", | ||
182 | ZFMT(VIDEO_PALETTE_UYVY, | ||
183 | V4L2_PIX_FMT_UYVY, V4L2_COLORSPACE_SMPTE170M), | ||
166 | .depth = 16, | 184 | .depth = 16, |
167 | .flags = ZORAN_FORMAT_CAPTURE | | 185 | .flags = ZORAN_FORMAT_CAPTURE | |
168 | ZORAN_FORMAT_OVERLAY, | 186 | ZORAN_FORMAT_OVERLAY, |
187 | .vfespfr = ZR36057_VFESPFR_YUV422|ZR36057_VFESPFR_LittleEndian, | ||
169 | }, { | 188 | }, { |
170 | .name = "Hardware-encoded Motion-JPEG", | 189 | .name = "Hardware-encoded Motion-JPEG", |
171 | .palette = -1, | 190 | ZFMT(-1, |
172 | #ifdef CONFIG_VIDEO_V4L2 | 191 | V4L2_PIX_FMT_MJPEG, V4L2_COLORSPACE_SMPTE170M), |
173 | .fourcc = V4L2_PIX_FMT_MJPEG, | ||
174 | .colorspace = V4L2_COLORSPACE_SMPTE170M, | ||
175 | #endif | ||
176 | .depth = 0, | 192 | .depth = 0, |
177 | .flags = ZORAN_FORMAT_CAPTURE | | 193 | .flags = ZORAN_FORMAT_CAPTURE | |
178 | ZORAN_FORMAT_PLAYBACK | | 194 | ZORAN_FORMAT_PLAYBACK | |
179 | ZORAN_FORMAT_COMPRESSED, | 195 | ZORAN_FORMAT_COMPRESSED, |
180 | } | 196 | } |
181 | }; | 197 | }; |
182 | static const int zoran_num_formats = | 198 | #define NUM_FORMATS ARRAY_SIZE(zoran_formats) |
183 | (sizeof(zoran_formats) / sizeof(struct zoran_format)); | ||
184 | 199 | ||
185 | // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined | 200 | // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined |
186 | 201 | ||
@@ -768,13 +783,13 @@ v4l_grab (struct file *file, | |||
768 | struct zoran *zr = fh->zr; | 783 | struct zoran *zr = fh->zr; |
769 | int res = 0, i; | 784 | int res = 0, i; |
770 | 785 | ||
771 | for (i = 0; i < zoran_num_formats; i++) { | 786 | for (i = 0; i < NUM_FORMATS; i++) { |
772 | if (zoran_formats[i].palette == mp->format && | 787 | if (zoran_formats[i].palette == mp->format && |
773 | zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE && | 788 | zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE && |
774 | !(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)) | 789 | !(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)) |
775 | break; | 790 | break; |
776 | } | 791 | } |
777 | if (i == zoran_num_formats || zoran_formats[i].depth == 0) { | 792 | if (i == NUM_FORMATS || zoran_formats[i].depth == 0) { |
778 | dprintk(1, | 793 | dprintk(1, |
779 | KERN_ERR | 794 | KERN_ERR |
780 | "%s: v4l_grab() - wrong bytes-per-pixel format\n", | 795 | "%s: v4l_grab() - wrong bytes-per-pixel format\n", |
@@ -1173,10 +1188,14 @@ zoran_close_end_session (struct file *file) | |||
1173 | 1188 | ||
1174 | /* v4l capture */ | 1189 | /* v4l capture */ |
1175 | if (fh->v4l_buffers.active != ZORAN_FREE) { | 1190 | if (fh->v4l_buffers.active != ZORAN_FREE) { |
1191 | long flags; | ||
1192 | |||
1193 | spin_lock_irqsave(&zr->spinlock, flags); | ||
1176 | zr36057_set_memgrab(zr, 0); | 1194 | zr36057_set_memgrab(zr, 0); |
1177 | zr->v4l_buffers.allocated = 0; | 1195 | zr->v4l_buffers.allocated = 0; |
1178 | zr->v4l_buffers.active = fh->v4l_buffers.active = | 1196 | zr->v4l_buffers.active = fh->v4l_buffers.active = |
1179 | ZORAN_FREE; | 1197 | ZORAN_FREE; |
1198 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
1180 | } | 1199 | } |
1181 | 1200 | ||
1182 | /* v4l buffers */ | 1201 | /* v4l buffers */ |
@@ -2107,7 +2126,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2107 | vpict->colour, vpict->contrast, vpict->depth, | 2126 | vpict->colour, vpict->contrast, vpict->depth, |
2108 | vpict->palette); | 2127 | vpict->palette); |
2109 | 2128 | ||
2110 | for (i = 0; i < zoran_num_formats; i++) { | 2129 | for (i = 0; i < NUM_FORMATS; i++) { |
2111 | const struct zoran_format *fmt = &zoran_formats[i]; | 2130 | const struct zoran_format *fmt = &zoran_formats[i]; |
2112 | 2131 | ||
2113 | if (fmt->palette != -1 && | 2132 | if (fmt->palette != -1 && |
@@ -2116,7 +2135,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2116 | fmt->depth == vpict->depth) | 2135 | fmt->depth == vpict->depth) |
2117 | break; | 2136 | break; |
2118 | } | 2137 | } |
2119 | if (i == zoran_num_formats) { | 2138 | if (i == NUM_FORMATS) { |
2120 | dprintk(1, | 2139 | dprintk(1, |
2121 | KERN_ERR | 2140 | KERN_ERR |
2122 | "%s: VIDIOCSPICT - Invalid palette %d\n", | 2141 | "%s: VIDIOCSPICT - Invalid palette %d\n", |
@@ -2220,10 +2239,10 @@ zoran_do_ioctl (struct inode *inode, | |||
2220 | ZR_DEVNAME(zr), vbuf->base, vbuf->width, | 2239 | ZR_DEVNAME(zr), vbuf->base, vbuf->width, |
2221 | vbuf->height, vbuf->depth, vbuf->bytesperline); | 2240 | vbuf->height, vbuf->depth, vbuf->bytesperline); |
2222 | 2241 | ||
2223 | for (i = 0; i < zoran_num_formats; i++) | 2242 | for (i = 0; i < NUM_FORMATS; i++) |
2224 | if (zoran_formats[i].depth == vbuf->depth) | 2243 | if (zoran_formats[i].depth == vbuf->depth) |
2225 | break; | 2244 | break; |
2226 | if (i == zoran_num_formats) { | 2245 | if (i == NUM_FORMATS) { |
2227 | dprintk(1, | 2246 | dprintk(1, |
2228 | KERN_ERR | 2247 | KERN_ERR |
2229 | "%s: VIDIOCSFBUF - invalid fbuf depth %d\n", | 2248 | "%s: VIDIOCSFBUF - invalid fbuf depth %d\n", |
@@ -2672,14 +2691,14 @@ zoran_do_ioctl (struct inode *inode, | |||
2672 | return -EINVAL; | 2691 | return -EINVAL; |
2673 | } | 2692 | } |
2674 | 2693 | ||
2675 | for (i = 0; i < zoran_num_formats; i++) { | 2694 | for (i = 0; i < NUM_FORMATS; i++) { |
2676 | if (zoran_formats[i].flags & flag) | 2695 | if (zoran_formats[i].flags & flag) |
2677 | num++; | 2696 | num++; |
2678 | if (num == fmt->index) | 2697 | if (num == fmt->index) |
2679 | break; | 2698 | break; |
2680 | } | 2699 | } |
2681 | if (fmt->index < 0 /* late, but not too late */ || | 2700 | if (fmt->index < 0 /* late, but not too late */ || |
2682 | i == zoran_num_formats) | 2701 | i == NUM_FORMATS) |
2683 | return -EINVAL; | 2702 | return -EINVAL; |
2684 | 2703 | ||
2685 | memset(fmt, 0, sizeof(*fmt)); | 2704 | memset(fmt, 0, sizeof(*fmt)); |
@@ -2737,7 +2756,8 @@ zoran_do_ioctl (struct inode *inode, | |||
2737 | fmt->fmt.pix.height = | 2756 | fmt->fmt.pix.height = |
2738 | fh->v4l_settings.height; | 2757 | fh->v4l_settings.height; |
2739 | fmt->fmt.pix.sizeimage = | 2758 | fmt->fmt.pix.sizeimage = |
2740 | fh->v4l_buffers.buffer_size; | 2759 | fh->v4l_settings.bytesperline * |
2760 | fh->v4l_settings.height; | ||
2741 | fmt->fmt.pix.pixelformat = | 2761 | fmt->fmt.pix.pixelformat = |
2742 | fh->v4l_settings.format->fourcc; | 2762 | fh->v4l_settings.format->fourcc; |
2743 | fmt->fmt.pix.colorspace = | 2763 | fmt->fmt.pix.colorspace = |
@@ -2941,11 +2961,11 @@ zoran_do_ioctl (struct inode *inode, | |||
2941 | sfmtjpg_unlock_and_return: | 2961 | sfmtjpg_unlock_and_return: |
2942 | mutex_unlock(&zr->resource_lock); | 2962 | mutex_unlock(&zr->resource_lock); |
2943 | } else { | 2963 | } else { |
2944 | for (i = 0; i < zoran_num_formats; i++) | 2964 | for (i = 0; i < NUM_FORMATS; i++) |
2945 | if (fmt->fmt.pix.pixelformat == | 2965 | if (fmt->fmt.pix.pixelformat == |
2946 | zoran_formats[i].fourcc) | 2966 | zoran_formats[i].fourcc) |
2947 | break; | 2967 | break; |
2948 | if (i == zoran_num_formats) { | 2968 | if (i == NUM_FORMATS) { |
2949 | dprintk(1, | 2969 | dprintk(1, |
2950 | KERN_ERR | 2970 | KERN_ERR |
2951 | "%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x (%4.4s)\n", | 2971 | "%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x (%4.4s)\n", |
@@ -2984,8 +3004,9 @@ zoran_do_ioctl (struct inode *inode, | |||
2984 | 3004 | ||
2985 | /* tell the user the | 3005 | /* tell the user the |
2986 | * results/missing stuff */ | 3006 | * results/missing stuff */ |
2987 | fmt->fmt.pix.sizeimage = fh->v4l_buffers.buffer_size /*zr->gbpl * zr->gheight */ | 3007 | fmt->fmt.pix.sizeimage = |
2988 | ; | 3008 | fh->v4l_settings.height * |
3009 | fh->v4l_settings.bytesperline; | ||
2989 | if (BUZ_MAX_HEIGHT < | 3010 | if (BUZ_MAX_HEIGHT < |
2990 | (fh->v4l_settings.height * 2)) | 3011 | (fh->v4l_settings.height * 2)) |
2991 | fmt->fmt.pix.field = | 3012 | fmt->fmt.pix.field = |
@@ -3053,10 +3074,10 @@ zoran_do_ioctl (struct inode *inode, | |||
3053 | fb->fmt.bytesperline, fb->fmt.pixelformat, | 3074 | fb->fmt.bytesperline, fb->fmt.pixelformat, |
3054 | (char *) &printformat); | 3075 | (char *) &printformat); |
3055 | 3076 | ||
3056 | for (i = 0; i < zoran_num_formats; i++) | 3077 | for (i = 0; i < NUM_FORMATS; i++) |
3057 | if (zoran_formats[i].fourcc == fb->fmt.pixelformat) | 3078 | if (zoran_formats[i].fourcc == fb->fmt.pixelformat) |
3058 | break; | 3079 | break; |
3059 | if (i == zoran_num_formats) { | 3080 | if (i == NUM_FORMATS) { |
3060 | dprintk(1, | 3081 | dprintk(1, |
3061 | KERN_ERR | 3082 | KERN_ERR |
3062 | "%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", | 3083 | "%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", |
@@ -3439,8 +3460,13 @@ zoran_do_ioctl (struct inode *inode, | |||
3439 | goto strmoff_unlock_and_return; | 3460 | goto strmoff_unlock_and_return; |
3440 | 3461 | ||
3441 | /* unload capture */ | 3462 | /* unload capture */ |
3442 | if (zr->v4l_memgrab_active) | 3463 | if (zr->v4l_memgrab_active) { |
3464 | long flags; | ||
3465 | |||
3466 | spin_lock_irqsave(&zr->spinlock, flags); | ||
3443 | zr36057_set_memgrab(zr, 0); | 3467 | zr36057_set_memgrab(zr, 0); |
3468 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
3469 | } | ||
3444 | 3470 | ||
3445 | for (i = 0; i < fh->v4l_buffers.num_buffers; i++) | 3471 | for (i = 0; i < fh->v4l_buffers.num_buffers; i++) |
3446 | zr->v4l_buffers.buffer[i].state = | 3472 | zr->v4l_buffers.buffer[i].state = |
@@ -3704,11 +3730,11 @@ zoran_do_ioctl (struct inode *inode, | |||
3704 | dprintk(3, KERN_DEBUG "%s: VIDIOC_S_STD - norm=0x%llx\n", | 3730 | dprintk(3, KERN_DEBUG "%s: VIDIOC_S_STD - norm=0x%llx\n", |
3705 | ZR_DEVNAME(zr), (unsigned long long)*std); | 3731 | ZR_DEVNAME(zr), (unsigned long long)*std); |
3706 | 3732 | ||
3707 | if (*std == V4L2_STD_PAL) | 3733 | if ((*std & V4L2_STD_PAL) && !(*std & ~V4L2_STD_PAL)) |
3708 | norm = VIDEO_MODE_PAL; | 3734 | norm = VIDEO_MODE_PAL; |
3709 | else if (*std == V4L2_STD_NTSC) | 3735 | else if ((*std & V4L2_STD_NTSC) && !(*std & ~V4L2_STD_NTSC)) |
3710 | norm = VIDEO_MODE_NTSC; | 3736 | norm = VIDEO_MODE_NTSC; |
3711 | else if (*std == V4L2_STD_SECAM) | 3737 | else if ((*std & V4L2_STD_SECAM) && !(*std & ~V4L2_STD_SECAM)) |
3712 | norm = VIDEO_MODE_SECAM; | 3738 | norm = VIDEO_MODE_SECAM; |
3713 | else if (*std == V4L2_STD_ALL) | 3739 | else if (*std == V4L2_STD_ALL) |
3714 | norm = VIDEO_MODE_AUTO; | 3740 | norm = VIDEO_MODE_AUTO; |
@@ -4149,11 +4175,11 @@ zoran_do_ioctl (struct inode *inode, | |||
4149 | V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 4175 | V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
4150 | int i; | 4176 | int i; |
4151 | 4177 | ||
4152 | for (i = 0; i < zoran_num_formats; i++) | 4178 | for (i = 0; i < NUM_FORMATS; i++) |
4153 | if (zoran_formats[i].fourcc == | 4179 | if (zoran_formats[i].fourcc == |
4154 | fmt->fmt.pix.pixelformat) | 4180 | fmt->fmt.pix.pixelformat) |
4155 | break; | 4181 | break; |
4156 | if (i == zoran_num_formats) { | 4182 | if (i == NUM_FORMATS) { |
4157 | res = -EINVAL; | 4183 | res = -EINVAL; |
4158 | goto tryfmt_unlock_and_return; | 4184 | goto tryfmt_unlock_and_return; |
4159 | } | 4185 | } |
@@ -4213,8 +4239,8 @@ zoran_poll (struct file *file, | |||
4213 | { | 4239 | { |
4214 | struct zoran_fh *fh = file->private_data; | 4240 | struct zoran_fh *fh = file->private_data; |
4215 | struct zoran *zr = fh->zr; | 4241 | struct zoran *zr = fh->zr; |
4216 | wait_queue_head_t *queue = NULL; | ||
4217 | int res = 0, frame; | 4242 | int res = 0, frame; |
4243 | unsigned long flags; | ||
4218 | 4244 | ||
4219 | /* we should check whether buffers are ready to be synced on | 4245 | /* we should check whether buffers are ready to be synced on |
4220 | * (w/o waits - O_NONBLOCK) here | 4246 | * (w/o waits - O_NONBLOCK) here |
@@ -4228,51 +4254,58 @@ zoran_poll (struct file *file, | |||
4228 | 4254 | ||
4229 | switch (fh->map_mode) { | 4255 | switch (fh->map_mode) { |
4230 | case ZORAN_MAP_MODE_RAW: | 4256 | case ZORAN_MAP_MODE_RAW: |
4231 | if (fh->v4l_buffers.active == ZORAN_FREE || | 4257 | poll_wait(file, &zr->v4l_capq, wait); |
4232 | zr->v4l_pend_head == zr->v4l_pend_tail) { | 4258 | frame = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME]; |
4233 | dprintk(1, | 4259 | |
4234 | "%s: zoran_poll() - no buffers queued\n", | 4260 | spin_lock_irqsave(&zr->spinlock, flags); |
4235 | ZR_DEVNAME(zr)); | 4261 | dprintk(3, |
4236 | res = POLLNVAL; | 4262 | KERN_DEBUG |
4237 | goto poll_unlock_and_return; | 4263 | "%s: %s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n", |
4238 | } | 4264 | ZR_DEVNAME(zr), __FUNCTION__, |
4239 | queue = &zr->v4l_capq; | 4265 | "FAL"[fh->v4l_buffers.active], zr->v4l_sync_tail, |
4240 | frame = zr->v4l_pend[zr->v4l_pend_tail & V4L_MASK_FRAME]; | 4266 | "UPMD"[zr->v4l_buffers.buffer[frame].state], |
4241 | poll_wait(file, queue, wait); | 4267 | zr->v4l_pend_tail, zr->v4l_pend_head); |
4242 | if (fh->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE) | 4268 | /* Process is the one capturing? */ |
4269 | if (fh->v4l_buffers.active != ZORAN_FREE && | ||
4270 | /* Buffer ready to DQBUF? */ | ||
4271 | zr->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE) | ||
4243 | res = POLLIN | POLLRDNORM; | 4272 | res = POLLIN | POLLRDNORM; |
4273 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
4274 | |||
4244 | break; | 4275 | break; |
4245 | 4276 | ||
4246 | case ZORAN_MAP_MODE_JPG_REC: | 4277 | case ZORAN_MAP_MODE_JPG_REC: |
4247 | case ZORAN_MAP_MODE_JPG_PLAY: | 4278 | case ZORAN_MAP_MODE_JPG_PLAY: |
4248 | if (fh->jpg_buffers.active == ZORAN_FREE || | 4279 | poll_wait(file, &zr->jpg_capq, wait); |
4249 | zr->jpg_que_head == zr->jpg_que_tail) { | ||
4250 | dprintk(1, | ||
4251 | "%s: zoran_poll() - no buffers queued\n", | ||
4252 | ZR_DEVNAME(zr)); | ||
4253 | res = POLLNVAL; | ||
4254 | goto poll_unlock_and_return; | ||
4255 | } | ||
4256 | queue = &zr->jpg_capq; | ||
4257 | frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; | 4280 | frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; |
4258 | poll_wait(file, queue, wait); | 4281 | |
4259 | if (fh->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) { | 4282 | spin_lock_irqsave(&zr->spinlock, flags); |
4283 | dprintk(3, | ||
4284 | KERN_DEBUG | ||
4285 | "%s: %s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n", | ||
4286 | ZR_DEVNAME(zr), __FUNCTION__, | ||
4287 | "FAL"[fh->jpg_buffers.active], zr->jpg_que_tail, | ||
4288 | "UPMD"[zr->jpg_buffers.buffer[frame].state], | ||
4289 | zr->jpg_que_head, zr->jpg_dma_tail, zr->jpg_dma_head); | ||
4290 | if (fh->jpg_buffers.active != ZORAN_FREE && | ||
4291 | zr->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) { | ||
4260 | if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) | 4292 | if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) |
4261 | res = POLLIN | POLLRDNORM; | 4293 | res = POLLIN | POLLRDNORM; |
4262 | else | 4294 | else |
4263 | res = POLLOUT | POLLWRNORM; | 4295 | res = POLLOUT | POLLWRNORM; |
4264 | } | 4296 | } |
4297 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
4298 | |||
4265 | break; | 4299 | break; |
4266 | 4300 | ||
4267 | default: | 4301 | default: |
4268 | dprintk(1, | 4302 | dprintk(1, |
4303 | KERN_ERR | ||
4269 | "%s: zoran_poll() - internal error, unknown map_mode=%d\n", | 4304 | "%s: zoran_poll() - internal error, unknown map_mode=%d\n", |
4270 | ZR_DEVNAME(zr), fh->map_mode); | 4305 | ZR_DEVNAME(zr), fh->map_mode); |
4271 | res = POLLNVAL; | 4306 | res = POLLNVAL; |
4272 | goto poll_unlock_and_return; | ||
4273 | } | 4307 | } |
4274 | 4308 | ||
4275 | poll_unlock_and_return: | ||
4276 | mutex_unlock(&zr->resource_lock); | 4309 | mutex_unlock(&zr->resource_lock); |
4277 | 4310 | ||
4278 | return res; | 4311 | return res; |
@@ -4368,11 +4401,15 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
4368 | mutex_lock(&zr->resource_lock); | 4401 | mutex_lock(&zr->resource_lock); |
4369 | 4402 | ||
4370 | if (fh->v4l_buffers.active != ZORAN_FREE) { | 4403 | if (fh->v4l_buffers.active != ZORAN_FREE) { |
4404 | long flags; | ||
4405 | |||
4406 | spin_lock_irqsave(&zr->spinlock, flags); | ||
4371 | zr36057_set_memgrab(zr, 0); | 4407 | zr36057_set_memgrab(zr, 0); |
4372 | zr->v4l_buffers.allocated = 0; | 4408 | zr->v4l_buffers.allocated = 0; |
4373 | zr->v4l_buffers.active = | 4409 | zr->v4l_buffers.active = |
4374 | fh->v4l_buffers.active = | 4410 | fh->v4l_buffers.active = |
4375 | ZORAN_FREE; | 4411 | ZORAN_FREE; |
4412 | spin_unlock_irqrestore(&zr->spinlock, flags); | ||
4376 | } | 4413 | } |
4377 | //v4l_fbuffer_free(file); | 4414 | //v4l_fbuffer_free(file); |
4378 | fh->v4l_buffers.allocated = 0; | 4415 | fh->v4l_buffers.allocated = 0; |
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index d0808fa3ec82..5b87183e62ce 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
@@ -255,10 +255,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, | |||
255 | int err; | 255 | int err; |
256 | 256 | ||
257 | index = mlx4_bitmap_alloc(&priv->mr_table.mpt_bitmap); | 257 | index = mlx4_bitmap_alloc(&priv->mr_table.mpt_bitmap); |
258 | if (index == -1) { | 258 | if (index == -1) |
259 | err = -ENOMEM; | 259 | return -ENOMEM; |
260 | goto err; | ||
261 | } | ||
262 | 260 | ||
263 | mr->iova = iova; | 261 | mr->iova = iova; |
264 | mr->size = size; | 262 | mr->size = size; |
@@ -269,15 +267,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, | |||
269 | 267 | ||
270 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); | 268 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); |
271 | if (err) | 269 | if (err) |
272 | goto err_index; | 270 | mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index); |
273 | |||
274 | return 0; | ||
275 | |||
276 | err_index: | ||
277 | mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index); | ||
278 | 271 | ||
279 | err: | ||
280 | kfree(mr); | ||
281 | return err; | 272 | return err; |
282 | } | 273 | } |
283 | EXPORT_SYMBOL_GPL(mlx4_mr_alloc); | 274 | EXPORT_SYMBOL_GPL(mlx4_mr_alloc); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index fba319d6fcc8..1ee9cd9c86e2 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1517,7 +1517,7 @@ EXPORT_SYMBOL(pcie_get_readrq); | |||
1517 | /** | 1517 | /** |
1518 | * pcie_set_readrq - set PCI Express maximum memory read request | 1518 | * pcie_set_readrq - set PCI Express maximum memory read request |
1519 | * @dev: PCI device to query | 1519 | * @dev: PCI device to query |
1520 | * @count: maximum memory read count in bytes | 1520 | * @rq: maximum memory read count in bytes |
1521 | * valid values are 128, 256, 512, 1024, 2048, 4096 | 1521 | * valid values are 128, 256, 512, 1024, 2048, 4096 |
1522 | * | 1522 | * |
1523 | * If possible sets maximum read byte count | 1523 | * If possible sets maximum read byte count |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index befff5f9d58c..ac49b15fa768 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA) += misc/ | |||
48 | obj-$(CONFIG_USB_TEST) += misc/ | 48 | obj-$(CONFIG_USB_TEST) += misc/ |
49 | obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/ | 49 | obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/ |
50 | obj-$(CONFIG_USB_USS720) += misc/ | 50 | obj-$(CONFIG_USB_USS720) += misc/ |
51 | obj-$(CONFIG_USB_IOWARRIOR) += misc/ | ||
51 | 52 | ||
52 | obj-$(CONFIG_USB_ATM) += atm/ | 53 | obj-$(CONFIG_USB_ATM) += atm/ |
53 | obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ | 54 | obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 25f63f1096b4..b6bd05e3d439 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -18,9 +18,17 @@ | |||
18 | #include "hcd.h" /* for usbcore internals */ | 18 | #include "hcd.h" /* for usbcore internals */ |
19 | #include "usb.h" | 19 | #include "usb.h" |
20 | 20 | ||
21 | struct api_context { | ||
22 | struct completion done; | ||
23 | int status; | ||
24 | }; | ||
25 | |||
21 | static void usb_api_blocking_completion(struct urb *urb) | 26 | static void usb_api_blocking_completion(struct urb *urb) |
22 | { | 27 | { |
23 | complete((struct completion *)urb->context); | 28 | struct api_context *ctx = urb->context; |
29 | |||
30 | ctx->status = urb->status; | ||
31 | complete(&ctx->done); | ||
24 | } | 32 | } |
25 | 33 | ||
26 | 34 | ||
@@ -32,20 +40,21 @@ static void usb_api_blocking_completion(struct urb *urb) | |||
32 | */ | 40 | */ |
33 | static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) | 41 | static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) |
34 | { | 42 | { |
35 | struct completion done; | 43 | struct api_context ctx; |
36 | unsigned long expire; | 44 | unsigned long expire; |
37 | int retval; | 45 | int retval; |
38 | int status = urb->status; | ||
39 | 46 | ||
40 | init_completion(&done); | 47 | init_completion(&ctx.done); |
41 | urb->context = &done; | 48 | urb->context = &ctx; |
42 | urb->actual_length = 0; | 49 | urb->actual_length = 0; |
43 | retval = usb_submit_urb(urb, GFP_NOIO); | 50 | retval = usb_submit_urb(urb, GFP_NOIO); |
44 | if (unlikely(retval)) | 51 | if (unlikely(retval)) |
45 | goto out; | 52 | goto out; |
46 | 53 | ||
47 | expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; | 54 | expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; |
48 | if (!wait_for_completion_timeout(&done, expire)) { | 55 | if (!wait_for_completion_timeout(&ctx.done, expire)) { |
56 | usb_kill_urb(urb); | ||
57 | retval = (ctx.status == -ENOENT ? -ETIMEDOUT : ctx.status); | ||
49 | 58 | ||
50 | dev_dbg(&urb->dev->dev, | 59 | dev_dbg(&urb->dev->dev, |
51 | "%s timed out on ep%d%s len=%d/%d\n", | 60 | "%s timed out on ep%d%s len=%d/%d\n", |
@@ -54,11 +63,8 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) | |||
54 | usb_pipein(urb->pipe) ? "in" : "out", | 63 | usb_pipein(urb->pipe) ? "in" : "out", |
55 | urb->actual_length, | 64 | urb->actual_length, |
56 | urb->transfer_buffer_length); | 65 | urb->transfer_buffer_length); |
57 | |||
58 | usb_kill_urb(urb); | ||
59 | retval = status == -ENOENT ? -ETIMEDOUT : status; | ||
60 | } else | 66 | } else |
61 | retval = status; | 67 | retval = ctx.status; |
62 | out: | 68 | out: |
63 | if (actual_length) | 69 | if (actual_length) |
64 | *actual_length = urb->actual_length; | 70 | *actual_length = urb->actual_length; |
@@ -411,15 +417,22 @@ int usb_sg_init ( | |||
411 | * Some systems need to revert to PIO when DMA is temporarily | 417 | * Some systems need to revert to PIO when DMA is temporarily |
412 | * unavailable. For their sakes, both transfer_buffer and | 418 | * unavailable. For their sakes, both transfer_buffer and |
413 | * transfer_dma are set when possible. However this can only | 419 | * transfer_dma are set when possible. However this can only |
414 | * work on systems without HIGHMEM, since DMA buffers located | 420 | * work on systems without: |
415 | * in high memory are not directly addressable by the CPU for | 421 | * |
416 | * PIO ... so when HIGHMEM is in use, transfer_buffer is NULL | 422 | * - HIGHMEM, since DMA buffers located in high memory are |
423 | * not directly addressable by the CPU for PIO; | ||
424 | * | ||
425 | * - IOMMU, since dma_map_sg() is allowed to use an IOMMU to | ||
426 | * make virtually discontiguous buffers be "dma-contiguous" | ||
427 | * so that PIO and DMA need diferent numbers of URBs. | ||
428 | * | ||
429 | * So when HIGHMEM or IOMMU are in use, transfer_buffer is NULL | ||
417 | * to prevent stale pointers and to help spot bugs. | 430 | * to prevent stale pointers and to help spot bugs. |
418 | */ | 431 | */ |
419 | if (dma) { | 432 | if (dma) { |
420 | io->urbs [i]->transfer_dma = sg_dma_address (sg + i); | 433 | io->urbs [i]->transfer_dma = sg_dma_address (sg + i); |
421 | len = sg_dma_len (sg + i); | 434 | len = sg_dma_len (sg + i); |
422 | #ifdef CONFIG_HIGHMEM | 435 | #if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU) |
423 | io->urbs[i]->transfer_buffer = NULL; | 436 | io->urbs[i]->transfer_buffer = NULL; |
424 | #else | 437 | #else |
425 | io->urbs[i]->transfer_buffer = | 438 | io->urbs[i]->transfer_buffer = |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index aa21b38a31ce..b7917c5a3c6f 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -30,18 +30,40 @@ | |||
30 | static const struct usb_device_id usb_quirk_list[] = { | 30 | static const struct usb_device_id usb_quirk_list[] = { |
31 | /* HP 5300/5370C scanner */ | 31 | /* HP 5300/5370C scanner */ |
32 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, | 32 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, |
33 | /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */ | ||
34 | { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
33 | /* Benq S2W 3300U */ | 35 | /* Benq S2W 3300U */ |
34 | { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 36 | { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
37 | /* Canon, Inc. CanoScan N1240U/LiDE30 */ | ||
38 | { USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
39 | /* Canon, Inc. CanoScan N650U/N656U */ | ||
40 | { USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
41 | /* Canon, Inc. CanoScan 1220U */ | ||
42 | { USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
43 | /* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */ | ||
44 | { USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
45 | /* old Cannon scanner */ | ||
46 | { USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
35 | /* Seiko Epson Corp. Perfection 1200 */ | 47 | /* Seiko Epson Corp. Perfection 1200 */ |
36 | { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 48 | { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
49 | /* Seiko Epson Corp. Perfection 660 */ | ||
50 | { USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
51 | /* Epson Perfection 1260 Photo */ | ||
52 | { USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
37 | /* Seiko Epson Corp - Perfection 1670 */ | 53 | /* Seiko Epson Corp - Perfection 1670 */ |
38 | { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 54 | { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
55 | /* EPSON Perfection 2480 */ | ||
56 | { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
57 | /* Seiko Epson Corp.*/ | ||
58 | { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
39 | /* Samsung ML-2510 Series printer */ | 59 | /* Samsung ML-2510 Series printer */ |
40 | { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 60 | { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
41 | /* Elsa MicroLink 56k (V.250) */ | 61 | /* Elsa MicroLink 56k (V.250) */ |
42 | { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 62 | { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
43 | /* Ultima Electronics Corp.*/ | 63 | /* Ultima Electronics Corp.*/ |
44 | { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 64 | { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
65 | /* Agfa Snapscan1212u */ | ||
66 | { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
45 | /* Umax [hex] Astra 3400U */ | 67 | /* Umax [hex] Astra 3400U */ |
46 | { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 68 | { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
47 | 69 | ||
diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index d18901b92cda..c6760aee1e5c 100644 --- a/drivers/usb/gadget/config.c +++ b/drivers/usb/gadget/config.c | |||
@@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen, | |||
50 | return -EINVAL; | 50 | return -EINVAL; |
51 | 51 | ||
52 | /* fill buffer from src[] until null descriptor ptr */ | 52 | /* fill buffer from src[] until null descriptor ptr */ |
53 | for (; 0 != *src; src++) { | 53 | for (; NULL != *src; src++) { |
54 | unsigned len = (*src)->bLength; | 54 | unsigned len = (*src)->bLength; |
55 | 55 | ||
56 | if (len > buflen) | 56 | if (len > buflen) |
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 6042364402b8..3aa46cfa66ba 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c | |||
@@ -71,7 +71,7 @@ ep_matches ( | |||
71 | u16 max; | 71 | u16 max; |
72 | 72 | ||
73 | /* endpoint already claimed? */ | 73 | /* endpoint already claimed? */ |
74 | if (0 != ep->driver_data) | 74 | if (NULL != ep->driver_data) |
75 | return 0; | 75 | return 0; |
76 | 76 | ||
77 | /* only support ep0 for portable CONTROL traffic */ | 77 | /* only support ep0 for portable CONTROL traffic */ |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a3376739a81b..593e23507b1a 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -1723,7 +1723,8 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) | |||
1723 | size += sizeof (struct rndis_packet_msg_type); | 1723 | size += sizeof (struct rndis_packet_msg_type); |
1724 | size -= size % dev->out_ep->maxpacket; | 1724 | size -= size % dev->out_ep->maxpacket; |
1725 | 1725 | ||
1726 | if ((skb = alloc_skb (size + NET_IP_ALIGN, gfp_flags)) == 0) { | 1726 | skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags); |
1727 | if (skb == NULL) { | ||
1727 | DEBUG (dev, "no rx skb\n"); | 1728 | DEBUG (dev, "no rx skb\n"); |
1728 | goto enomem; | 1729 | goto enomem; |
1729 | } | 1730 | } |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index e60745ffaf8e..173004f60fea 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len) | |||
964 | } | 964 | } |
965 | if (len > sizeof (dev->rbuf)) | 965 | if (len > sizeof (dev->rbuf)) |
966 | req->buf = kmalloc(len, GFP_ATOMIC); | 966 | req->buf = kmalloc(len, GFP_ATOMIC); |
967 | if (req->buf == 0) { | 967 | if (req->buf == NULL) { |
968 | req->buf = dev->rbuf; | 968 | req->buf = dev->rbuf; |
969 | return -ENOMEM; | 969 | return -ENOMEM; |
970 | } | 970 | } |
@@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1394 | dev->setup_abort = 0; | 1394 | dev->setup_abort = 0; |
1395 | if (dev->state == STATE_DEV_UNCONNECTED) { | 1395 | if (dev->state == STATE_DEV_UNCONNECTED) { |
1396 | #ifdef CONFIG_USB_GADGET_DUALSPEED | 1396 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1397 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { | 1397 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == NULL) { |
1398 | spin_unlock(&dev->lock); | 1398 | spin_unlock(&dev->lock); |
1399 | ERROR (dev, "no high speed config??\n"); | 1399 | ERROR (dev, "no high speed config??\n"); |
1400 | return -EINVAL; | 1400 | return -EINVAL; |
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 700dda8a9157..4b27d12f049d 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req, | |||
1299 | req->req.actual = 0; | 1299 | req->req.actual = 0; |
1300 | req->req.status = -EINPROGRESS; | 1300 | req->req.status = -EINPROGRESS; |
1301 | 1301 | ||
1302 | if (ep->desc == 0) /* control */ | 1302 | if (ep->desc == NULL) /* control */ |
1303 | start_ep0(ep, req); | 1303 | start_ep0(ep, req); |
1304 | else { | 1304 | else { |
1305 | if (request && !ep->busy) | 1305 | if (request && !ep->busy) |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 63b9521c1322..72b4ebbf132d 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -93,8 +93,6 @@ static const char driver_name [] = "pxa2xx_udc"; | |||
93 | static const char ep0name [] = "ep0"; | 93 | static const char ep0name [] = "ep0"; |
94 | 94 | ||
95 | 95 | ||
96 | // #define DISABLE_TEST_MODE | ||
97 | |||
98 | #ifdef CONFIG_ARCH_IXP4XX | 96 | #ifdef CONFIG_ARCH_IXP4XX |
99 | 97 | ||
100 | /* cpu-specific register addresses are compiled in to this code */ | 98 | /* cpu-specific register addresses are compiled in to this code */ |
@@ -113,17 +111,6 @@ static const char ep0name [] = "ep0"; | |||
113 | #define SIZE_STR "" | 111 | #define SIZE_STR "" |
114 | #endif | 112 | #endif |
115 | 113 | ||
116 | #ifdef DISABLE_TEST_MODE | ||
117 | /* (mode == 0) == no undocumented chip tweaks | ||
118 | * (mode & 1) == double buffer bulk IN | ||
119 | * (mode & 2) == double buffer bulk OUT | ||
120 | * ... so mode = 3 (or 7, 15, etc) does it for both | ||
121 | */ | ||
122 | static ushort fifo_mode = 0; | ||
123 | module_param(fifo_mode, ushort, 0); | ||
124 | MODULE_PARM_DESC (fifo_mode, "pxa2xx udc fifo mode"); | ||
125 | #endif | ||
126 | |||
127 | /* --------------------------------------------------------------------------- | 114 | /* --------------------------------------------------------------------------- |
128 | * endpoint related parts of the api to the usb controller hardware, | 115 | * endpoint related parts of the api to the usb controller hardware, |
129 | * used by gadget driver; and the inner talker-to-hardware core. | 116 | * used by gadget driver; and the inner talker-to-hardware core. |
@@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev) | |||
1252 | UDC_RES2 = 0x00; | 1239 | UDC_RES2 = 0x00; |
1253 | } | 1240 | } |
1254 | 1241 | ||
1255 | #ifdef DISABLE_TEST_MODE | ||
1256 | /* "test mode" seems to have become the default in later chip | ||
1257 | * revs, preventing double buffering (and invalidating docs). | ||
1258 | * this EXPERIMENT enables it for bulk endpoints by tweaking | ||
1259 | * undefined/reserved register bits (that other drivers clear). | ||
1260 | * Belcarra code comments noted this usage. | ||
1261 | */ | ||
1262 | if (fifo_mode & 1) { /* IN endpoints */ | ||
1263 | UDC_RES1 |= USIR0_IR1|USIR0_IR6; | ||
1264 | UDC_RES2 |= USIR1_IR11; | ||
1265 | } | ||
1266 | if (fifo_mode & 2) { /* OUT endpoints */ | ||
1267 | UDC_RES1 |= USIR0_IR2|USIR0_IR7; | ||
1268 | UDC_RES2 |= USIR1_IR12; | ||
1269 | } | ||
1270 | #endif | ||
1271 | |||
1272 | /* enable suspend/resume and reset irqs */ | 1242 | /* enable suspend/resume and reset irqs */ |
1273 | udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM); | 1243 | udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM); |
1274 | 1244 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index a2e6e3fc8c8d..fcfe869acb94 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) | |||
653 | result = usb_ep_enable (ep, d); | 653 | result = usb_ep_enable (ep, d); |
654 | if (result == 0) { | 654 | if (result == 0) { |
655 | ep->driver_data = dev; | 655 | ep->driver_data = dev; |
656 | if (source_sink_start_ep (ep, gfp_flags) != 0) { | 656 | if (source_sink_start_ep(ep, gfp_flags) |
657 | != NULL) { | ||
657 | dev->in_ep = ep; | 658 | dev->in_ep = ep; |
658 | continue; | 659 | continue; |
659 | } | 660 | } |
@@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) | |||
667 | result = usb_ep_enable (ep, d); | 668 | result = usb_ep_enable (ep, d); |
668 | if (result == 0) { | 669 | if (result == 0) { |
669 | ep->driver_data = dev; | 670 | ep->driver_data = dev; |
670 | if (source_sink_start_ep (ep, gfp_flags) != 0) { | 671 | if (source_sink_start_ep(ep, gfp_flags) |
672 | != NULL) { | ||
671 | dev->out_ep = ep; | 673 | dev->out_ep = ep; |
672 | continue; | 674 | continue; |
673 | } | 675 | } |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index e831cb7f64fd..33f6ee50b8d3 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) | |||
356 | 356 | ||
357 | dbg("%s - port %d", __FUNCTION__, port->number); | 357 | dbg("%s - port %d", __FUNCTION__, port->number); |
358 | 358 | ||
359 | if ((!port->tty) || (!port->tty->termios)) { | 359 | if (!port->tty || !port->tty->termios) { |
360 | dbg("%s - no tty structures", __FUNCTION__); | 360 | dbg("%s - no tty structures", __FUNCTION__); |
361 | return; | 361 | return; |
362 | } | 362 | } |
@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port, | |||
526 | return; | 526 | return; |
527 | } | 527 | } |
528 | cflag = port->tty->termios->c_cflag; | 528 | cflag = port->tty->termios->c_cflag; |
529 | 529 | old_cflag = old_termios->c_cflag; | |
530 | /* Check that they really want us to change something */ | 530 | baud = tty_get_baud_rate(port->tty); |
531 | if (old_termios) { | ||
532 | if ((cflag == old_termios->c_cflag) && | ||
533 | (RELEVANT_IFLAG(port->tty->termios->c_iflag) | ||
534 | == RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
535 | dbg("%s - nothing to change...", __FUNCTION__); | ||
536 | return; | ||
537 | } | ||
538 | |||
539 | old_cflag = old_termios->c_cflag; | ||
540 | } | ||
541 | 531 | ||
542 | /* If the baud rate is to be updated*/ | 532 | /* If the baud rate is to be updated*/ |
543 | if ((cflag & CBAUD) != (old_cflag & CBAUD)) { | 533 | if (baud != tty_termios_baud_rate(old_termios)) { |
544 | switch (cflag & CBAUD) { | 534 | switch (baud) { |
545 | /* | 535 | case 0: |
546 | * The baud rates which are commented out below | 536 | case 600: |
547 | * appear to be supported by the device | 537 | case 1200: |
548 | * but are non-standard | 538 | case 1800: |
549 | */ | 539 | case 2400: |
550 | case B0: baud = 0; break; | 540 | case 4800: |
551 | case B600: baud = 600; break; | 541 | case 7200: |
552 | case B1200: baud = 1200; break; | 542 | case 9600: |
553 | case B1800: baud = 1800; break; | 543 | case 14400: |
554 | case B2400: baud = 2400; break; | 544 | case 19200: |
555 | case B4800: baud = 4800; break; | 545 | case 28800: |
556 | /*case B7200: baud = 7200; break;*/ | 546 | case 38400: |
557 | case B9600: baud = 9600; break; | 547 | case 55854: |
558 | /*ase B14400: baud = 14400; break;*/ | 548 | case 57600: |
559 | case B19200: baud = 19200; break; | 549 | case 115200: |
560 | /*case B28800: baud = 28800; break;*/ | 550 | case 127117: |
561 | case B38400: baud = 38400; break; | 551 | case 230400: |
562 | /*case B55854: baud = 55054; break;*/ | 552 | case 460800: |
563 | case B57600: baud = 57600; break; | 553 | case 921600: |
564 | case B115200: baud = 115200; break; | 554 | case 3686400: |
565 | /*case B127117: baud = 127117; break;*/ | 555 | break; |
566 | case B230400: baud = 230400; break; | ||
567 | case B460800: baud = 460800; break; | ||
568 | case B921600: baud = 921600; break; | ||
569 | /*case B3686400: baud = 3686400; break;*/ | ||
570 | default: | 556 | default: |
571 | dev_err(&port->dev, "cp2101 driver does not " | 557 | baud = 9600; |
572 | "support the baudrate requested\n"); | ||
573 | break; | 558 | break; |
574 | } | 559 | } |
575 | 560 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 976f54ec26e6..dab2e66d111d 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -433,38 +433,38 @@ struct digi_port { | |||
433 | 433 | ||
434 | /* Local Function Declarations */ | 434 | /* Local Function Declarations */ |
435 | 435 | ||
436 | static void digi_wakeup_write( struct usb_serial_port *port ); | 436 | static void digi_wakeup_write(struct usb_serial_port *port); |
437 | static void digi_wakeup_write_lock(struct work_struct *work); | 437 | static void digi_wakeup_write_lock(struct work_struct *work); |
438 | static int digi_write_oob_command( struct usb_serial_port *port, | 438 | static int digi_write_oob_command(struct usb_serial_port *port, |
439 | unsigned char *buf, int count, int interruptible ); | 439 | unsigned char *buf, int count, int interruptible); |
440 | static int digi_write_inb_command( struct usb_serial_port *port, | 440 | static int digi_write_inb_command(struct usb_serial_port *port, |
441 | unsigned char *buf, int count, unsigned long timeout ); | 441 | unsigned char *buf, int count, unsigned long timeout); |
442 | static int digi_set_modem_signals( struct usb_serial_port *port, | 442 | static int digi_set_modem_signals(struct usb_serial_port *port, |
443 | unsigned int modem_signals, int interruptible ); | 443 | unsigned int modem_signals, int interruptible); |
444 | static int digi_transmit_idle( struct usb_serial_port *port, | 444 | static int digi_transmit_idle(struct usb_serial_port *port, |
445 | unsigned long timeout ); | 445 | unsigned long timeout); |
446 | static void digi_rx_throttle (struct usb_serial_port *port); | 446 | static void digi_rx_throttle (struct usb_serial_port *port); |
447 | static void digi_rx_unthrottle (struct usb_serial_port *port); | 447 | static void digi_rx_unthrottle (struct usb_serial_port *port); |
448 | static void digi_set_termios( struct usb_serial_port *port, | 448 | static void digi_set_termios(struct usb_serial_port *port, |
449 | struct ktermios *old_termios ); | 449 | struct ktermios *old_termios); |
450 | static void digi_break_ctl( struct usb_serial_port *port, int break_state ); | 450 | static void digi_break_ctl(struct usb_serial_port *port, int break_state); |
451 | static int digi_ioctl( struct usb_serial_port *port, struct file *file, | 451 | static int digi_ioctl(struct usb_serial_port *port, struct file *file, |
452 | unsigned int cmd, unsigned long arg ); | 452 | unsigned int cmd, unsigned long arg); |
453 | static int digi_tiocmget( struct usb_serial_port *port, struct file *file ); | 453 | static int digi_tiocmget(struct usb_serial_port *port, struct file *file); |
454 | static int digi_tiocmset( struct usb_serial_port *port, struct file *file, | 454 | static int digi_tiocmset(struct usb_serial_port *port, struct file *file, |
455 | unsigned int set, unsigned int clear ); | 455 | unsigned int set, unsigned int clear); |
456 | static int digi_write( struct usb_serial_port *port, const unsigned char *buf, int count ); | 456 | static int digi_write(struct usb_serial_port *port, const unsigned char *buf, int count); |
457 | static void digi_write_bulk_callback( struct urb *urb ); | 457 | static void digi_write_bulk_callback(struct urb *urb); |
458 | static int digi_write_room( struct usb_serial_port *port ); | 458 | static int digi_write_room(struct usb_serial_port *port); |
459 | static int digi_chars_in_buffer( struct usb_serial_port *port ); | 459 | static int digi_chars_in_buffer(struct usb_serial_port *port); |
460 | static int digi_open( struct usb_serial_port *port, struct file *filp ); | 460 | static int digi_open(struct usb_serial_port *port, struct file *filp); |
461 | static void digi_close( struct usb_serial_port *port, struct file *filp ); | 461 | static void digi_close(struct usb_serial_port *port, struct file *filp); |
462 | static int digi_startup_device( struct usb_serial *serial ); | 462 | static int digi_startup_device(struct usb_serial *serial); |
463 | static int digi_startup( struct usb_serial *serial ); | 463 | static int digi_startup(struct usb_serial *serial); |
464 | static void digi_shutdown( struct usb_serial *serial ); | 464 | static void digi_shutdown(struct usb_serial *serial); |
465 | static void digi_read_bulk_callback( struct urb *urb ); | 465 | static void digi_read_bulk_callback(struct urb *urb); |
466 | static int digi_read_inb_callback( struct urb *urb ); | 466 | static int digi_read_inb_callback(struct urb *urb); |
467 | static int digi_read_oob_callback( struct urb *urb ); | 467 | static int digi_read_oob_callback(struct urb *urb); |
468 | 468 | ||
469 | 469 | ||
470 | /* Statics */ | 470 | /* Statics */ |
@@ -576,9 +576,9 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
576 | * with the equivalent code. | 576 | * with the equivalent code. |
577 | */ | 577 | */ |
578 | 578 | ||
579 | static inline long cond_wait_interruptible_timeout_irqrestore( | 579 | static long cond_wait_interruptible_timeout_irqrestore( |
580 | wait_queue_head_t *q, long timeout, | 580 | wait_queue_head_t *q, long timeout, |
581 | spinlock_t *lock, unsigned long flags ) | 581 | spinlock_t *lock, unsigned long flags) |
582 | { | 582 | { |
583 | DEFINE_WAIT(wait); | 583 | DEFINE_WAIT(wait); |
584 | 584 | ||
@@ -600,18 +600,16 @@ static inline long cond_wait_interruptible_timeout_irqrestore( | |||
600 | 600 | ||
601 | static void digi_wakeup_write_lock(struct work_struct *work) | 601 | static void digi_wakeup_write_lock(struct work_struct *work) |
602 | { | 602 | { |
603 | struct digi_port *priv = | 603 | struct digi_port *priv = container_of(work, struct digi_port, dp_wakeup_work); |
604 | container_of(work, struct digi_port, dp_wakeup_work); | ||
605 | struct usb_serial_port *port = priv->dp_port; | 604 | struct usb_serial_port *port = priv->dp_port; |
606 | unsigned long flags; | 605 | unsigned long flags; |
607 | 606 | ||
608 | 607 | spin_lock_irqsave(&priv->dp_port_lock, flags); | |
609 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 608 | digi_wakeup_write(port); |
610 | digi_wakeup_write( port ); | 609 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
611 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | ||
612 | } | 610 | } |
613 | 611 | ||
614 | static void digi_wakeup_write( struct usb_serial_port *port ) | 612 | static void digi_wakeup_write(struct usb_serial_port *port) |
615 | { | 613 | { |
616 | tty_wakeup(port->tty); | 614 | tty_wakeup(port->tty); |
617 | } | 615 | } |
@@ -628,8 +626,8 @@ static void digi_wakeup_write( struct usb_serial_port *port ) | |||
628 | * returned by usb_submit_urb. | 626 | * returned by usb_submit_urb. |
629 | */ | 627 | */ |
630 | 628 | ||
631 | static int digi_write_oob_command( struct usb_serial_port *port, | 629 | static int digi_write_oob_command(struct usb_serial_port *port, |
632 | unsigned char *buf, int count, int interruptible ) | 630 | unsigned char *buf, int count, int interruptible) |
633 | { | 631 | { |
634 | 632 | ||
635 | int ret = 0; | 633 | int ret = 0; |
@@ -638,49 +636,37 @@ static int digi_write_oob_command( struct usb_serial_port *port, | |||
638 | struct digi_port *oob_priv = usb_get_serial_port_data(oob_port); | 636 | struct digi_port *oob_priv = usb_get_serial_port_data(oob_port); |
639 | unsigned long flags = 0; | 637 | unsigned long flags = 0; |
640 | 638 | ||
639 | dbg("digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count); | ||
641 | 640 | ||
642 | dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count ); | 641 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
643 | 642 | while(count > 0) { | |
644 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | 643 | while(oob_port->write_urb->status == -EINPROGRESS |
645 | 644 | || oob_priv->dp_write_urb_in_use) { | |
646 | while( count > 0 ) { | ||
647 | |||
648 | while( oob_port->write_urb->status == -EINPROGRESS | ||
649 | || oob_priv->dp_write_urb_in_use ) { | ||
650 | cond_wait_interruptible_timeout_irqrestore( | 645 | cond_wait_interruptible_timeout_irqrestore( |
651 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, | 646 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, |
652 | &oob_priv->dp_port_lock, flags ); | 647 | &oob_priv->dp_port_lock, flags); |
653 | if( interruptible && signal_pending(current) ) { | 648 | if (interruptible && signal_pending(current)) |
654 | return( -EINTR ); | 649 | return -EINTR; |
655 | } | 650 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
656 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | ||
657 | } | 651 | } |
658 | 652 | ||
659 | /* len must be a multiple of 4, so commands are not split */ | 653 | /* len must be a multiple of 4, so commands are not split */ |
660 | len = min(count, oob_port->bulk_out_size ); | 654 | len = min(count, oob_port->bulk_out_size); |
661 | if( len > 4 ) | 655 | if (len > 4) |
662 | len &= ~3; | 656 | len &= ~3; |
663 | 657 | memcpy(oob_port->write_urb->transfer_buffer, buf, len); | |
664 | memcpy( oob_port->write_urb->transfer_buffer, buf, len ); | ||
665 | oob_port->write_urb->transfer_buffer_length = len; | 658 | oob_port->write_urb->transfer_buffer_length = len; |
666 | oob_port->write_urb->dev = port->serial->dev; | 659 | oob_port->write_urb->dev = port->serial->dev; |
667 | 660 | if ((ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0) { | |
668 | if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) { | ||
669 | oob_priv->dp_write_urb_in_use = 1; | 661 | oob_priv->dp_write_urb_in_use = 1; |
670 | count -= len; | 662 | count -= len; |
671 | buf += len; | 663 | buf += len; |
672 | } | 664 | } |
673 | |||
674 | } | ||
675 | |||
676 | spin_unlock_irqrestore( &oob_priv->dp_port_lock, flags ); | ||
677 | |||
678 | if( ret ) { | ||
679 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, | ||
680 | ret ); | ||
681 | } | 665 | } |
682 | 666 | spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); | |
683 | return( ret ); | 667 | if (ret) |
668 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret); | ||
669 | return ret; | ||
684 | 670 | ||
685 | } | 671 | } |
686 | 672 | ||
@@ -697,63 +683,58 @@ dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, co | |||
697 | * error returned by digi_write. | 683 | * error returned by digi_write. |
698 | */ | 684 | */ |
699 | 685 | ||
700 | static int digi_write_inb_command( struct usb_serial_port *port, | 686 | static int digi_write_inb_command(struct usb_serial_port *port, |
701 | unsigned char *buf, int count, unsigned long timeout ) | 687 | unsigned char *buf, int count, unsigned long timeout) |
702 | { | 688 | { |
703 | |||
704 | int ret = 0; | 689 | int ret = 0; |
705 | int len; | 690 | int len; |
706 | struct digi_port *priv = usb_get_serial_port_data(port); | 691 | struct digi_port *priv = usb_get_serial_port_data(port); |
707 | unsigned char *data = port->write_urb->transfer_buffer; | 692 | unsigned char *data = port->write_urb->transfer_buffer; |
708 | unsigned long flags = 0; | 693 | unsigned long flags = 0; |
709 | 694 | ||
695 | dbg("digi_write_inb_command: TOP: port=%d, count=%d", | ||
696 | priv->dp_port_num, count); | ||
710 | 697 | ||
711 | dbg( "digi_write_inb_command: TOP: port=%d, count=%d", priv->dp_port_num, | 698 | if (timeout) |
712 | count ); | ||
713 | |||
714 | if( timeout ) | ||
715 | timeout += jiffies; | 699 | timeout += jiffies; |
716 | else | 700 | else |
717 | timeout = ULONG_MAX; | 701 | timeout = ULONG_MAX; |
718 | 702 | ||
719 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 703 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
720 | 704 | while(count > 0 && ret == 0) { | |
721 | while( count > 0 && ret == 0 ) { | 705 | while((port->write_urb->status == -EINPROGRESS |
722 | 706 | || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) { | |
723 | while( (port->write_urb->status == -EINPROGRESS | ||
724 | || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) { | ||
725 | cond_wait_interruptible_timeout_irqrestore( | 707 | cond_wait_interruptible_timeout_irqrestore( |
726 | &port->write_wait, DIGI_RETRY_TIMEOUT, | 708 | &port->write_wait, DIGI_RETRY_TIMEOUT, |
727 | &priv->dp_port_lock, flags ); | 709 | &priv->dp_port_lock, flags); |
728 | if( signal_pending(current) ) { | 710 | if (signal_pending(current)) |
729 | return( -EINTR ); | 711 | return -EINTR; |
730 | } | 712 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
731 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
732 | } | 713 | } |
733 | 714 | ||
734 | /* len must be a multiple of 4 and small enough to */ | 715 | /* len must be a multiple of 4 and small enough to */ |
735 | /* guarantee the write will send buffered data first, */ | 716 | /* guarantee the write will send buffered data first, */ |
736 | /* so commands are in order with data and not split */ | 717 | /* so commands are in order with data and not split */ |
737 | len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len ); | 718 | len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len); |
738 | if( len > 4 ) | 719 | if (len > 4) |
739 | len &= ~3; | 720 | len &= ~3; |
740 | 721 | ||
741 | /* write any buffered data first */ | 722 | /* write any buffered data first */ |
742 | if( priv->dp_out_buf_len > 0 ) { | 723 | if (priv->dp_out_buf_len > 0) { |
743 | data[0] = DIGI_CMD_SEND_DATA; | 724 | data[0] = DIGI_CMD_SEND_DATA; |
744 | data[1] = priv->dp_out_buf_len; | 725 | data[1] = priv->dp_out_buf_len; |
745 | memcpy( data+2, priv->dp_out_buf, | 726 | memcpy(data + 2, priv->dp_out_buf, |
746 | priv->dp_out_buf_len ); | 727 | priv->dp_out_buf_len); |
747 | memcpy( data+2+priv->dp_out_buf_len, buf, len ); | 728 | memcpy(data + 2 + priv->dp_out_buf_len, buf, len); |
748 | port->write_urb->transfer_buffer_length | 729 | port->write_urb->transfer_buffer_length |
749 | = priv->dp_out_buf_len+2+len; | 730 | = priv->dp_out_buf_len + 2 + len; |
750 | } else { | 731 | } else { |
751 | memcpy( data, buf, len ); | 732 | memcpy(data, buf, len); |
752 | port->write_urb->transfer_buffer_length = len; | 733 | port->write_urb->transfer_buffer_length = len; |
753 | } | 734 | } |
754 | port->write_urb->dev = port->serial->dev; | 735 | port->write_urb->dev = port->serial->dev; |
755 | 736 | ||
756 | if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) { | 737 | if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) { |
757 | priv->dp_write_urb_in_use = 1; | 738 | priv->dp_write_urb_in_use = 1; |
758 | priv->dp_out_buf_len = 0; | 739 | priv->dp_out_buf_len = 0; |
759 | count -= len; | 740 | count -= len; |
@@ -761,16 +742,12 @@ count ); | |||
761 | } | 742 | } |
762 | 743 | ||
763 | } | 744 | } |
745 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); | ||
764 | 746 | ||
765 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 747 | if (ret) |
766 | 748 | err("%s: usb_submit_urb failed, ret=%d, port=%d", | |
767 | if( ret ) { | 749 | __FUNCTION__, ret, priv->dp_port_num); |
768 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 750 | return ret; |
769 | ret, priv->dp_port_num ); | ||
770 | } | ||
771 | |||
772 | return( ret ); | ||
773 | |||
774 | } | 751 | } |
775 | 752 | ||
776 | 753 | ||
@@ -784,8 +761,8 @@ count ); | |||
784 | * returned by usb_submit_urb. | 761 | * returned by usb_submit_urb. |
785 | */ | 762 | */ |
786 | 763 | ||
787 | static int digi_set_modem_signals( struct usb_serial_port *port, | 764 | static int digi_set_modem_signals(struct usb_serial_port *port, |
788 | unsigned int modem_signals, int interruptible ) | 765 | unsigned int modem_signals, int interruptible) |
789 | { | 766 | { |
790 | 767 | ||
791 | int ret; | 768 | int ret; |
@@ -796,60 +773,47 @@ static int digi_set_modem_signals( struct usb_serial_port *port, | |||
796 | unsigned long flags = 0; | 773 | unsigned long flags = 0; |
797 | 774 | ||
798 | 775 | ||
799 | dbg( "digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x", | 776 | dbg("digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x", |
800 | port_priv->dp_port_num, modem_signals ); | 777 | port_priv->dp_port_num, modem_signals); |
801 | 778 | ||
802 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | 779 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
803 | spin_lock( &port_priv->dp_port_lock ); | 780 | spin_lock(&port_priv->dp_port_lock); |
804 | 781 | ||
805 | while( oob_port->write_urb->status == -EINPROGRESS | 782 | while(oob_port->write_urb->status == -EINPROGRESS || oob_priv->dp_write_urb_in_use) { |
806 | || oob_priv->dp_write_urb_in_use ) { | 783 | spin_unlock(&port_priv->dp_port_lock); |
807 | spin_unlock( &port_priv->dp_port_lock ); | ||
808 | cond_wait_interruptible_timeout_irqrestore( | 784 | cond_wait_interruptible_timeout_irqrestore( |
809 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, | 785 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, |
810 | &oob_priv->dp_port_lock, flags ); | 786 | &oob_priv->dp_port_lock, flags); |
811 | if( interruptible && signal_pending(current) ) { | 787 | if (interruptible && signal_pending(current)) |
812 | return( -EINTR ); | 788 | return -EINTR; |
813 | } | 789 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
814 | spin_lock_irqsave( &oob_priv->dp_port_lock, flags ); | 790 | spin_lock(&port_priv->dp_port_lock); |
815 | spin_lock( &port_priv->dp_port_lock ); | ||
816 | } | 791 | } |
817 | |||
818 | data[0] = DIGI_CMD_SET_DTR_SIGNAL; | 792 | data[0] = DIGI_CMD_SET_DTR_SIGNAL; |
819 | data[1] = port_priv->dp_port_num; | 793 | data[1] = port_priv->dp_port_num; |
820 | data[2] = (modem_signals&TIOCM_DTR) ? | 794 | data[2] = (modem_signals&TIOCM_DTR) ? DIGI_DTR_ACTIVE : DIGI_DTR_INACTIVE; |
821 | DIGI_DTR_ACTIVE : DIGI_DTR_INACTIVE; | ||
822 | data[3] = 0; | 795 | data[3] = 0; |
823 | |||
824 | data[4] = DIGI_CMD_SET_RTS_SIGNAL; | 796 | data[4] = DIGI_CMD_SET_RTS_SIGNAL; |
825 | data[5] = port_priv->dp_port_num; | 797 | data[5] = port_priv->dp_port_num; |
826 | data[6] = (modem_signals&TIOCM_RTS) ? | 798 | data[6] = (modem_signals&TIOCM_RTS) ? DIGI_RTS_ACTIVE : DIGI_RTS_INACTIVE; |
827 | DIGI_RTS_ACTIVE : DIGI_RTS_INACTIVE; | ||
828 | data[7] = 0; | 799 | data[7] = 0; |
829 | 800 | ||
830 | oob_port->write_urb->transfer_buffer_length = 8; | 801 | oob_port->write_urb->transfer_buffer_length = 8; |
831 | oob_port->write_urb->dev = port->serial->dev; | 802 | oob_port->write_urb->dev = port->serial->dev; |
832 | 803 | ||
833 | if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) { | 804 | if ((ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0) { |
834 | oob_priv->dp_write_urb_in_use = 1; | 805 | oob_priv->dp_write_urb_in_use = 1; |
835 | port_priv->dp_modem_signals = | 806 | port_priv->dp_modem_signals = |
836 | (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS)) | 807 | (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS)) |
837 | | (modem_signals&(TIOCM_DTR|TIOCM_RTS)); | 808 | | (modem_signals&(TIOCM_DTR|TIOCM_RTS)); |
838 | } | 809 | } |
839 | 810 | spin_unlock(&port_priv->dp_port_lock); | |
840 | spin_unlock( &port_priv->dp_port_lock ); | 811 | spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); |
841 | spin_unlock_irqrestore( &oob_priv->dp_port_lock, flags ); | 812 | if (ret) |
842 | 813 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret); | |
843 | if( ret ) { | 814 | return ret; |
844 | err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, | ||
845 | ret ); | ||
846 | } | ||
847 | |||
848 | return( ret ); | ||
849 | |||
850 | } | 815 | } |
851 | 816 | ||
852 | |||
853 | /* | 817 | /* |
854 | * Digi Transmit Idle | 818 | * Digi Transmit Idle |
855 | * | 819 | * |
@@ -862,203 +826,182 @@ port_priv->dp_port_num, modem_signals ); | |||
862 | * port at a time, so its ok. | 826 | * port at a time, so its ok. |
863 | */ | 827 | */ |
864 | 828 | ||
865 | static int digi_transmit_idle( struct usb_serial_port *port, | 829 | static int digi_transmit_idle(struct usb_serial_port *port, |
866 | unsigned long timeout ) | 830 | unsigned long timeout) |
867 | { | 831 | { |
868 | |||
869 | int ret; | 832 | int ret; |
870 | unsigned char buf[2]; | 833 | unsigned char buf[2]; |
871 | struct digi_port *priv = usb_get_serial_port_data(port); | 834 | struct digi_port *priv = usb_get_serial_port_data(port); |
872 | unsigned long flags = 0; | 835 | unsigned long flags = 0; |
873 | 836 | ||
874 | 837 | spin_lock_irqsave(&priv->dp_port_lock, flags); | |
875 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
876 | priv->dp_transmit_idle = 0; | 838 | priv->dp_transmit_idle = 0; |
877 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 839 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
878 | 840 | ||
879 | buf[0] = DIGI_CMD_TRANSMIT_IDLE; | 841 | buf[0] = DIGI_CMD_TRANSMIT_IDLE; |
880 | buf[1] = 0; | 842 | buf[1] = 0; |
881 | 843 | ||
882 | timeout += jiffies; | 844 | timeout += jiffies; |
883 | 845 | ||
884 | if( (ret=digi_write_inb_command( port, buf, 2, timeout-jiffies )) != 0 ) | 846 | if ((ret = digi_write_inb_command(port, buf, 2, timeout - jiffies)) != 0) |
885 | return( ret ); | 847 | return ret; |
886 | 848 | ||
887 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 849 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
888 | 850 | ||
889 | while( time_before(jiffies, timeout) && !priv->dp_transmit_idle ) { | 851 | while(time_before(jiffies, timeout) && !priv->dp_transmit_idle) { |
890 | cond_wait_interruptible_timeout_irqrestore( | 852 | cond_wait_interruptible_timeout_irqrestore( |
891 | &priv->dp_transmit_idle_wait, DIGI_RETRY_TIMEOUT, | 853 | &priv->dp_transmit_idle_wait, DIGI_RETRY_TIMEOUT, |
892 | &priv->dp_port_lock, flags ); | 854 | &priv->dp_port_lock, flags); |
893 | if( signal_pending(current) ) { | 855 | if (signal_pending(current)) |
894 | return( -EINTR ); | 856 | return -EINTR; |
895 | } | 857 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
896 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
897 | } | 858 | } |
898 | |||
899 | priv->dp_transmit_idle = 0; | 859 | priv->dp_transmit_idle = 0; |
900 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 860 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
901 | 861 | return 0; | |
902 | return( 0 ); | ||
903 | 862 | ||
904 | } | 863 | } |
905 | 864 | ||
906 | 865 | ||
907 | static void digi_rx_throttle( struct usb_serial_port *port ) | 866 | static void digi_rx_throttle(struct usb_serial_port *port) |
908 | { | 867 | { |
909 | |||
910 | unsigned long flags; | 868 | unsigned long flags; |
911 | struct digi_port *priv = usb_get_serial_port_data(port); | 869 | struct digi_port *priv = usb_get_serial_port_data(port); |
912 | 870 | ||
913 | 871 | ||
914 | dbg( "digi_rx_throttle: TOP: port=%d", priv->dp_port_num ); | 872 | dbg("digi_rx_throttle: TOP: port=%d", priv->dp_port_num); |
915 | 873 | ||
916 | /* stop receiving characters by not resubmitting the read urb */ | 874 | /* stop receiving characters by not resubmitting the read urb */ |
917 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 875 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
918 | priv->dp_throttled = 1; | 876 | priv->dp_throttled = 1; |
919 | priv->dp_throttle_restart = 0; | 877 | priv->dp_throttle_restart = 0; |
920 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 878 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
921 | |||
922 | } | 879 | } |
923 | 880 | ||
924 | 881 | ||
925 | static void digi_rx_unthrottle( struct usb_serial_port *port ) | 882 | static void digi_rx_unthrottle(struct usb_serial_port *port) |
926 | { | 883 | { |
927 | |||
928 | int ret = 0; | 884 | int ret = 0; |
929 | unsigned long flags; | 885 | unsigned long flags; |
930 | struct digi_port *priv = usb_get_serial_port_data(port); | 886 | struct digi_port *priv = usb_get_serial_port_data(port); |
931 | 887 | ||
932 | dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); | 888 | dbg("digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num); |
933 | 889 | ||
934 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 890 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
935 | 891 | ||
936 | /* turn throttle off */ | 892 | /* turn throttle off */ |
937 | priv->dp_throttled = 0; | 893 | priv->dp_throttled = 0; |
938 | priv->dp_throttle_restart = 0; | 894 | priv->dp_throttle_restart = 0; |
939 | 895 | ||
940 | /* restart read chain */ | 896 | /* restart read chain */ |
941 | if( priv->dp_throttle_restart ) { | 897 | if (priv->dp_throttle_restart) { |
942 | port->read_urb->dev = port->serial->dev; | 898 | port->read_urb->dev = port->serial->dev; |
943 | ret = usb_submit_urb( port->read_urb, GFP_ATOMIC ); | 899 | ret = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
944 | } | 900 | } |
945 | 901 | ||
946 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 902 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
947 | |||
948 | if( ret ) { | ||
949 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | ||
950 | ret, priv->dp_port_num ); | ||
951 | } | ||
952 | 903 | ||
904 | if (ret) | ||
905 | err("%s: usb_submit_urb failed, ret=%d, port=%d", | ||
906 | __FUNCTION__, ret, priv->dp_port_num); | ||
953 | } | 907 | } |
954 | 908 | ||
955 | 909 | ||
956 | static void digi_set_termios( struct usb_serial_port *port, | 910 | static void digi_set_termios(struct usb_serial_port *port, |
957 | struct ktermios *old_termios ) | 911 | struct ktermios *old_termios) |
958 | { | 912 | { |
959 | 913 | ||
960 | struct digi_port *priv = usb_get_serial_port_data(port); | 914 | struct digi_port *priv = usb_get_serial_port_data(port); |
961 | unsigned int iflag = port->tty->termios->c_iflag; | 915 | struct tty_struct *tty = port->tty; |
962 | unsigned int cflag = port->tty->termios->c_cflag; | 916 | unsigned int iflag = tty->termios->c_iflag; |
917 | unsigned int cflag = tty->termios->c_cflag; | ||
963 | unsigned int old_iflag = old_termios->c_iflag; | 918 | unsigned int old_iflag = old_termios->c_iflag; |
964 | unsigned int old_cflag = old_termios->c_cflag; | 919 | unsigned int old_cflag = old_termios->c_cflag; |
965 | unsigned char buf[32]; | 920 | unsigned char buf[32]; |
966 | unsigned int modem_signals; | 921 | unsigned int modem_signals; |
967 | int arg,ret; | 922 | int arg,ret; |
968 | int i = 0; | 923 | int i = 0; |
924 | speed_t baud; | ||
969 | 925 | ||
970 | 926 | dbg("digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag); | |
971 | dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag ); | ||
972 | 927 | ||
973 | /* set baud rate */ | 928 | /* set baud rate */ |
974 | if( (cflag&CBAUD) != (old_cflag&CBAUD) ) { | 929 | if ((baud = tty_get_baud_rate(tty)) != tty_termios_baud_rate(old_termios)) { |
975 | |||
976 | arg = -1; | 930 | arg = -1; |
977 | 931 | ||
978 | /* reassert DTR and (maybe) RTS on transition from B0 */ | 932 | /* reassert DTR and (maybe) RTS on transition from B0 */ |
979 | if( (old_cflag&CBAUD) == B0 ) { | 933 | if ((old_cflag&CBAUD) == B0) { |
980 | /* don't set RTS if using hardware flow control */ | 934 | /* don't set RTS if using hardware flow control */ |
981 | /* and throttling input */ | 935 | /* and throttling input */ |
982 | modem_signals = TIOCM_DTR; | 936 | modem_signals = TIOCM_DTR; |
983 | if( !(port->tty->termios->c_cflag & CRTSCTS) || | 937 | if (!(tty->termios->c_cflag & CRTSCTS) || |
984 | !test_bit(TTY_THROTTLED, &port->tty->flags) ) { | 938 | !test_bit(TTY_THROTTLED, &tty->flags)) |
985 | modem_signals |= TIOCM_RTS; | 939 | modem_signals |= TIOCM_RTS; |
986 | } | 940 | digi_set_modem_signals(port, modem_signals, 1); |
987 | digi_set_modem_signals( port, modem_signals, 1 ); | ||
988 | } | 941 | } |
989 | 942 | switch (baud) { | |
990 | switch( (cflag&CBAUD) ) { | ||
991 | /* drop DTR and RTS on transition to B0 */ | 943 | /* drop DTR and RTS on transition to B0 */ |
992 | case B0: digi_set_modem_signals( port, 0, 1 ); break; | 944 | case 0: digi_set_modem_signals(port, 0, 1); break; |
993 | case B50: arg = DIGI_BAUD_50; break; | 945 | case 50: arg = DIGI_BAUD_50; break; |
994 | case B75: arg = DIGI_BAUD_75; break; | 946 | case 75: arg = DIGI_BAUD_75; break; |
995 | case B110: arg = DIGI_BAUD_110; break; | 947 | case 110: arg = DIGI_BAUD_110; break; |
996 | case B150: arg = DIGI_BAUD_150; break; | 948 | case 150: arg = DIGI_BAUD_150; break; |
997 | case B200: arg = DIGI_BAUD_200; break; | 949 | case 200: arg = DIGI_BAUD_200; break; |
998 | case B300: arg = DIGI_BAUD_300; break; | 950 | case 300: arg = DIGI_BAUD_300; break; |
999 | case B600: arg = DIGI_BAUD_600; break; | 951 | case 600: arg = DIGI_BAUD_600; break; |
1000 | case B1200: arg = DIGI_BAUD_1200; break; | 952 | case 1200: arg = DIGI_BAUD_1200; break; |
1001 | case B1800: arg = DIGI_BAUD_1800; break; | 953 | case 1800: arg = DIGI_BAUD_1800; break; |
1002 | case B2400: arg = DIGI_BAUD_2400; break; | 954 | case 2400: arg = DIGI_BAUD_2400; break; |
1003 | case B4800: arg = DIGI_BAUD_4800; break; | 955 | case 4800: arg = DIGI_BAUD_4800; break; |
1004 | case B9600: arg = DIGI_BAUD_9600; break; | 956 | case 9600: arg = DIGI_BAUD_9600; break; |
1005 | case B19200: arg = DIGI_BAUD_19200; break; | 957 | case 19200: arg = DIGI_BAUD_19200; break; |
1006 | case B38400: arg = DIGI_BAUD_38400; break; | 958 | case 38400: arg = DIGI_BAUD_38400; break; |
1007 | case B57600: arg = DIGI_BAUD_57600; break; | 959 | case 57600: arg = DIGI_BAUD_57600; break; |
1008 | case B115200: arg = DIGI_BAUD_115200; break; | 960 | case 115200: arg = DIGI_BAUD_115200; break; |
1009 | case B230400: arg = DIGI_BAUD_230400; break; | 961 | case 230400: arg = DIGI_BAUD_230400; break; |
1010 | case B460800: arg = DIGI_BAUD_460800; break; | 962 | case 460800: arg = DIGI_BAUD_460800; break; |
1011 | default: | 963 | default: |
1012 | dbg( "digi_set_termios: can't handle baud rate 0x%x", | 964 | arg = DIGI_BAUD_9600; |
1013 | (cflag&CBAUD) ); | 965 | baud = 9600; |
1014 | break; | 966 | break; |
1015 | } | 967 | } |
1016 | 968 | if (arg != -1) { | |
1017 | if( arg != -1 ) { | ||
1018 | buf[i++] = DIGI_CMD_SET_BAUD_RATE; | 969 | buf[i++] = DIGI_CMD_SET_BAUD_RATE; |
1019 | buf[i++] = priv->dp_port_num; | 970 | buf[i++] = priv->dp_port_num; |
1020 | buf[i++] = arg; | 971 | buf[i++] = arg; |
1021 | buf[i++] = 0; | 972 | buf[i++] = 0; |
1022 | } | 973 | } |
1023 | |||
1024 | } | 974 | } |
1025 | |||
1026 | /* set parity */ | 975 | /* set parity */ |
1027 | if( (cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD)) ) { | 976 | if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { |
1028 | 977 | if (cflag&PARENB) { | |
1029 | if( (cflag&PARENB) ) { | 978 | if (cflag&PARODD) |
1030 | if( (cflag&PARODD) ) | ||
1031 | arg = DIGI_PARITY_ODD; | 979 | arg = DIGI_PARITY_ODD; |
1032 | else | 980 | else |
1033 | arg = DIGI_PARITY_EVEN; | 981 | arg = DIGI_PARITY_EVEN; |
1034 | } else { | 982 | } else { |
1035 | arg = DIGI_PARITY_NONE; | 983 | arg = DIGI_PARITY_NONE; |
1036 | } | 984 | } |
1037 | |||
1038 | buf[i++] = DIGI_CMD_SET_PARITY; | 985 | buf[i++] = DIGI_CMD_SET_PARITY; |
1039 | buf[i++] = priv->dp_port_num; | 986 | buf[i++] = priv->dp_port_num; |
1040 | buf[i++] = arg; | 987 | buf[i++] = arg; |
1041 | buf[i++] = 0; | 988 | buf[i++] = 0; |
1042 | |||
1043 | } | 989 | } |
1044 | |||
1045 | /* set word size */ | 990 | /* set word size */ |
1046 | if( (cflag&CSIZE) != (old_cflag&CSIZE) ) { | 991 | if ((cflag&CSIZE) != (old_cflag&CSIZE)) { |
1047 | |||
1048 | arg = -1; | 992 | arg = -1; |
1049 | 993 | switch (cflag&CSIZE) { | |
1050 | switch( (cflag&CSIZE) ) { | ||
1051 | case CS5: arg = DIGI_WORD_SIZE_5; break; | 994 | case CS5: arg = DIGI_WORD_SIZE_5; break; |
1052 | case CS6: arg = DIGI_WORD_SIZE_6; break; | 995 | case CS6: arg = DIGI_WORD_SIZE_6; break; |
1053 | case CS7: arg = DIGI_WORD_SIZE_7; break; | 996 | case CS7: arg = DIGI_WORD_SIZE_7; break; |
1054 | case CS8: arg = DIGI_WORD_SIZE_8; break; | 997 | case CS8: arg = DIGI_WORD_SIZE_8; break; |
1055 | default: | 998 | default: |
1056 | dbg( "digi_set_termios: can't handle word size %d", | 999 | dbg("digi_set_termios: can't handle word size %d", |
1057 | (cflag&CSIZE) ); | 1000 | (cflag&CSIZE)); |
1058 | break; | 1001 | break; |
1059 | } | 1002 | } |
1060 | 1003 | ||
1061 | if( arg != -1 ) { | 1004 | if (arg != -1) { |
1062 | buf[i++] = DIGI_CMD_SET_WORD_SIZE; | 1005 | buf[i++] = DIGI_CMD_SET_WORD_SIZE; |
1063 | buf[i++] = priv->dp_port_num; | 1006 | buf[i++] = priv->dp_port_num; |
1064 | buf[i++] = arg; | 1007 | buf[i++] = arg; |
@@ -1068,9 +1011,9 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
1068 | } | 1011 | } |
1069 | 1012 | ||
1070 | /* set stop bits */ | 1013 | /* set stop bits */ |
1071 | if( (cflag&CSTOPB) != (old_cflag&CSTOPB) ) { | 1014 | if ((cflag&CSTOPB) != (old_cflag&CSTOPB)) { |
1072 | 1015 | ||
1073 | if( (cflag&CSTOPB) ) | 1016 | if ((cflag&CSTOPB)) |
1074 | arg = DIGI_STOP_BITS_2; | 1017 | arg = DIGI_STOP_BITS_2; |
1075 | else | 1018 | else |
1076 | arg = DIGI_STOP_BITS_1; | 1019 | arg = DIGI_STOP_BITS_1; |
@@ -1083,18 +1026,15 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
1083 | } | 1026 | } |
1084 | 1027 | ||
1085 | /* set input flow control */ | 1028 | /* set input flow control */ |
1086 | if( (iflag&IXOFF) != (old_iflag&IXOFF) | 1029 | if ((iflag&IXOFF) != (old_iflag&IXOFF) |
1087 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) { | 1030 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { |
1088 | |||
1089 | arg = 0; | 1031 | arg = 0; |
1090 | 1032 | if (iflag&IXOFF) | |
1091 | if( (iflag&IXOFF) ) | ||
1092 | arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF; | 1033 | arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF; |
1093 | else | 1034 | else |
1094 | arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF; | 1035 | arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF; |
1095 | 1036 | ||
1096 | if( (cflag&CRTSCTS) ) { | 1037 | if (cflag&CRTSCTS) { |
1097 | |||
1098 | arg |= DIGI_INPUT_FLOW_CONTROL_RTS; | 1038 | arg |= DIGI_INPUT_FLOW_CONTROL_RTS; |
1099 | 1039 | ||
1100 | /* On USB-4 it is necessary to assert RTS prior */ | 1040 | /* On USB-4 it is necessary to assert RTS prior */ |
@@ -1107,43 +1047,37 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
1107 | } else { | 1047 | } else { |
1108 | arg &= ~DIGI_INPUT_FLOW_CONTROL_RTS; | 1048 | arg &= ~DIGI_INPUT_FLOW_CONTROL_RTS; |
1109 | } | 1049 | } |
1110 | |||
1111 | buf[i++] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; | 1050 | buf[i++] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; |
1112 | buf[i++] = priv->dp_port_num; | 1051 | buf[i++] = priv->dp_port_num; |
1113 | buf[i++] = arg; | 1052 | buf[i++] = arg; |
1114 | buf[i++] = 0; | 1053 | buf[i++] = 0; |
1115 | |||
1116 | } | 1054 | } |
1117 | 1055 | ||
1118 | /* set output flow control */ | 1056 | /* set output flow control */ |
1119 | if( (iflag&IXON) != (old_iflag&IXON) | 1057 | if ((iflag&IXON) != (old_iflag&IXON) |
1120 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) { | 1058 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { |
1121 | |||
1122 | arg = 0; | 1059 | arg = 0; |
1123 | 1060 | if (iflag&IXON) | |
1124 | if( (iflag&IXON) ) | ||
1125 | arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; | 1061 | arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; |
1126 | else | 1062 | else |
1127 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; | 1063 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; |
1128 | 1064 | ||
1129 | if( (cflag&CRTSCTS) ) { | 1065 | if (cflag&CRTSCTS) { |
1130 | arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; | 1066 | arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; |
1131 | } else { | 1067 | } else { |
1132 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; | 1068 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; |
1133 | port->tty->hw_stopped = 0; | 1069 | tty->hw_stopped = 0; |
1134 | } | 1070 | } |
1135 | 1071 | ||
1136 | buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL; | 1072 | buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL; |
1137 | buf[i++] = priv->dp_port_num; | 1073 | buf[i++] = priv->dp_port_num; |
1138 | buf[i++] = arg; | 1074 | buf[i++] = arg; |
1139 | buf[i++] = 0; | 1075 | buf[i++] = 0; |
1140 | |||
1141 | } | 1076 | } |
1142 | 1077 | ||
1143 | /* set receive enable/disable */ | 1078 | /* set receive enable/disable */ |
1144 | if( (cflag&CREAD) != (old_cflag&CREAD) ) { | 1079 | if ((cflag&CREAD) != (old_cflag&CREAD)) { |
1145 | 1080 | if (cflag&CREAD) | |
1146 | if( (cflag&CREAD) ) | ||
1147 | arg = DIGI_ENABLE; | 1081 | arg = DIGI_ENABLE; |
1148 | else | 1082 | else |
1149 | arg = DIGI_DISABLE; | 1083 | arg = DIGI_DISABLE; |
@@ -1152,32 +1086,26 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol | |||
1152 | buf[i++] = priv->dp_port_num; | 1086 | buf[i++] = priv->dp_port_num; |
1153 | buf[i++] = arg; | 1087 | buf[i++] = arg; |
1154 | buf[i++] = 0; | 1088 | buf[i++] = 0; |
1155 | |||
1156 | } | 1089 | } |
1157 | 1090 | if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0) | |
1158 | if( (ret=digi_write_oob_command( port, buf, i, 1 )) != 0 ) | 1091 | dbg("digi_set_termios: write oob failed, ret=%d", ret); |
1159 | dbg( "digi_set_termios: write oob failed, ret=%d", ret ); | ||
1160 | 1092 | ||
1161 | } | 1093 | } |
1162 | 1094 | ||
1163 | 1095 | ||
1164 | static void digi_break_ctl( struct usb_serial_port *port, int break_state ) | 1096 | static void digi_break_ctl(struct usb_serial_port *port, int break_state) |
1165 | { | 1097 | { |
1166 | |||
1167 | unsigned char buf[4]; | 1098 | unsigned char buf[4]; |
1168 | 1099 | ||
1169 | |||
1170 | buf[0] = DIGI_CMD_BREAK_CONTROL; | 1100 | buf[0] = DIGI_CMD_BREAK_CONTROL; |
1171 | buf[1] = 2; /* length */ | 1101 | buf[1] = 2; /* length */ |
1172 | buf[2] = break_state ? 1 : 0; | 1102 | buf[2] = break_state ? 1 : 0; |
1173 | buf[3] = 0; /* pad */ | 1103 | buf[3] = 0; /* pad */ |
1174 | 1104 | digi_write_inb_command(port, buf, 4, 0); | |
1175 | digi_write_inb_command( port, buf, 4, 0 ); | ||
1176 | |||
1177 | } | 1105 | } |
1178 | 1106 | ||
1179 | 1107 | ||
1180 | static int digi_tiocmget( struct usb_serial_port *port, struct file *file ) | 1108 | static int digi_tiocmget(struct usb_serial_port *port, struct file *file) |
1181 | { | 1109 | { |
1182 | struct digi_port *priv = usb_get_serial_port_data(port); | 1110 | struct digi_port *priv = usb_get_serial_port_data(port); |
1183 | unsigned int val; | 1111 | unsigned int val; |
@@ -1185,15 +1113,15 @@ static int digi_tiocmget( struct usb_serial_port *port, struct file *file ) | |||
1185 | 1113 | ||
1186 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); | 1114 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); |
1187 | 1115 | ||
1188 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1116 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1189 | val = priv->dp_modem_signals; | 1117 | val = priv->dp_modem_signals; |
1190 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1118 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1191 | return val; | 1119 | return val; |
1192 | } | 1120 | } |
1193 | 1121 | ||
1194 | 1122 | ||
1195 | static int digi_tiocmset( struct usb_serial_port *port, struct file *file, | 1123 | static int digi_tiocmset(struct usb_serial_port *port, struct file *file, |
1196 | unsigned int set, unsigned int clear ) | 1124 | unsigned int set, unsigned int clear) |
1197 | { | 1125 | { |
1198 | struct digi_port *priv = usb_get_serial_port_data(port); | 1126 | struct digi_port *priv = usb_get_serial_port_data(port); |
1199 | unsigned int val; | 1127 | unsigned int val; |
@@ -1201,41 +1129,34 @@ static int digi_tiocmset( struct usb_serial_port *port, struct file *file, | |||
1201 | 1129 | ||
1202 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); | 1130 | dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num); |
1203 | 1131 | ||
1204 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1132 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1205 | val = (priv->dp_modem_signals & ~clear) | set; | 1133 | val = (priv->dp_modem_signals & ~clear) | set; |
1206 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1134 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1207 | return digi_set_modem_signals( port, val, 1 ); | 1135 | return digi_set_modem_signals(port, val, 1); |
1208 | } | 1136 | } |
1209 | 1137 | ||
1210 | 1138 | ||
1211 | static int digi_ioctl( struct usb_serial_port *port, struct file *file, | 1139 | static int digi_ioctl(struct usb_serial_port *port, struct file *file, |
1212 | unsigned int cmd, unsigned long arg ) | 1140 | unsigned int cmd, unsigned long arg) |
1213 | { | 1141 | { |
1214 | |||
1215 | struct digi_port *priv = usb_get_serial_port_data(port); | 1142 | struct digi_port *priv = usb_get_serial_port_data(port); |
1216 | 1143 | dbg("digi_ioctl: TOP: port=%d, cmd=0x%x", priv->dp_port_num, cmd); | |
1217 | dbg( "digi_ioctl: TOP: port=%d, cmd=0x%x", priv->dp_port_num, cmd ); | ||
1218 | 1144 | ||
1219 | switch (cmd) { | 1145 | switch (cmd) { |
1220 | |||
1221 | case TIOCMIWAIT: | 1146 | case TIOCMIWAIT: |
1222 | /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/ | 1147 | /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/ |
1223 | /* TODO */ | 1148 | /* TODO */ |
1224 | return( 0 ); | 1149 | return 0; |
1225 | |||
1226 | case TIOCGICOUNT: | 1150 | case TIOCGICOUNT: |
1227 | /* return count of modemline transitions */ | 1151 | /* return count of modemline transitions */ |
1228 | /* TODO */ | 1152 | /* TODO */ |
1229 | return 0; | 1153 | return 0; |
1230 | |||
1231 | } | 1154 | } |
1232 | 1155 | return -ENOIOCTLCMD; | |
1233 | return( -ENOIOCTLCMD ); | ||
1234 | 1156 | ||
1235 | } | 1157 | } |
1236 | 1158 | ||
1237 | 1159 | static int digi_write(struct usb_serial_port *port, const unsigned char *buf, int count) | |
1238 | static int digi_write( struct usb_serial_port *port, const unsigned char *buf, int count ) | ||
1239 | { | 1160 | { |
1240 | 1161 | ||
1241 | int ret,data_len,new_len; | 1162 | int ret,data_len,new_len; |
@@ -1243,35 +1164,29 @@ static int digi_write( struct usb_serial_port *port, const unsigned char *buf, i | |||
1243 | unsigned char *data = port->write_urb->transfer_buffer; | 1164 | unsigned char *data = port->write_urb->transfer_buffer; |
1244 | unsigned long flags = 0; | 1165 | unsigned long flags = 0; |
1245 | 1166 | ||
1246 | 1167 | dbg("digi_write: TOP: port=%d, count=%d, in_interrupt=%ld", | |
1247 | dbg( "digi_write: TOP: port=%d, count=%d, in_interrupt=%ld", | 1168 | priv->dp_port_num, count, in_interrupt()); |
1248 | priv->dp_port_num, count, in_interrupt() ); | ||
1249 | 1169 | ||
1250 | /* copy user data (which can sleep) before getting spin lock */ | 1170 | /* copy user data (which can sleep) before getting spin lock */ |
1251 | count = min( count, port->bulk_out_size-2 ); | 1171 | count = min(count, port->bulk_out_size-2); |
1252 | count = min( 64, count); | 1172 | count = min(64, count); |
1253 | 1173 | ||
1254 | /* be sure only one write proceeds at a time */ | 1174 | /* be sure only one write proceeds at a time */ |
1255 | /* there are races on the port private buffer */ | 1175 | /* there are races on the port private buffer */ |
1256 | /* and races to check write_urb->status */ | 1176 | /* and races to check write_urb->status */ |
1257 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1177 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1258 | 1178 | ||
1259 | /* wait for urb status clear to submit another urb */ | 1179 | /* wait for urb status clear to submit another urb */ |
1260 | if( port->write_urb->status == -EINPROGRESS | 1180 | if (port->write_urb->status == -EINPROGRESS || priv->dp_write_urb_in_use) { |
1261 | || priv->dp_write_urb_in_use ) { | ||
1262 | |||
1263 | /* buffer data if count is 1 (probably put_char) if possible */ | 1181 | /* buffer data if count is 1 (probably put_char) if possible */ |
1264 | if( count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE ) { | 1182 | if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) { |
1265 | priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; | 1183 | priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; |
1266 | new_len = 1; | 1184 | new_len = 1; |
1267 | } else { | 1185 | } else { |
1268 | new_len = 0; | 1186 | new_len = 0; |
1269 | } | 1187 | } |
1270 | 1188 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); | |
1271 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1189 | return new_len; |
1272 | |||
1273 | return( new_len ); | ||
1274 | |||
1275 | } | 1190 | } |
1276 | 1191 | ||
1277 | /* allow space for any buffered data and for new data, up to */ | 1192 | /* allow space for any buffered data and for new data, up to */ |
@@ -1279,9 +1194,9 @@ priv->dp_port_num, count, in_interrupt() ); | |||
1279 | new_len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len); | 1194 | new_len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len); |
1280 | data_len = new_len + priv->dp_out_buf_len; | 1195 | data_len = new_len + priv->dp_out_buf_len; |
1281 | 1196 | ||
1282 | if( data_len == 0 ) { | 1197 | if (data_len == 0) { |
1283 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1198 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1284 | return( 0 ); | 1199 | return 0; |
1285 | } | 1200 | } |
1286 | 1201 | ||
1287 | port->write_urb->transfer_buffer_length = data_len+2; | 1202 | port->write_urb->transfer_buffer_length = data_len+2; |
@@ -1291,32 +1206,29 @@ priv->dp_port_num, count, in_interrupt() ); | |||
1291 | *data++ = data_len; | 1206 | *data++ = data_len; |
1292 | 1207 | ||
1293 | /* copy in buffered data first */ | 1208 | /* copy in buffered data first */ |
1294 | memcpy( data, priv->dp_out_buf, priv->dp_out_buf_len ); | 1209 | memcpy(data, priv->dp_out_buf, priv->dp_out_buf_len); |
1295 | data += priv->dp_out_buf_len; | 1210 | data += priv->dp_out_buf_len; |
1296 | 1211 | ||
1297 | /* copy in new data */ | 1212 | /* copy in new data */ |
1298 | memcpy( data, buf, new_len ); | 1213 | memcpy(data, buf, new_len); |
1299 | 1214 | ||
1300 | if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) { | 1215 | if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) { |
1301 | priv->dp_write_urb_in_use = 1; | 1216 | priv->dp_write_urb_in_use = 1; |
1302 | ret = new_len; | 1217 | ret = new_len; |
1303 | priv->dp_out_buf_len = 0; | 1218 | priv->dp_out_buf_len = 0; |
1304 | } | 1219 | } |
1305 | 1220 | ||
1306 | /* return length of new data written, or error */ | 1221 | /* return length of new data written, or error */ |
1307 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1222 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1308 | if( ret < 0 ) { | 1223 | if (ret < 0) |
1309 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 1224 | err("%s: usb_submit_urb failed, ret=%d, port=%d", |
1310 | ret, priv->dp_port_num ); | 1225 | __FUNCTION__, ret, priv->dp_port_num); |
1311 | } | 1226 | dbg("digi_write: returning %d", ret); |
1312 | 1227 | return ret; | |
1313 | dbg( "digi_write: returning %d", ret ); | ||
1314 | return( ret ); | ||
1315 | 1228 | ||
1316 | } | 1229 | } |
1317 | 1230 | ||
1318 | 1231 | static void digi_write_bulk_callback(struct urb *urb) | |
1319 | static void digi_write_bulk_callback( struct urb *urb ) | ||
1320 | { | 1232 | { |
1321 | 1233 | ||
1322 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1234 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
@@ -1326,153 +1238,136 @@ static void digi_write_bulk_callback( struct urb *urb ) | |||
1326 | int ret = 0; | 1238 | int ret = 0; |
1327 | int status = urb->status; | 1239 | int status = urb->status; |
1328 | 1240 | ||
1329 | 1241 | dbg("digi_write_bulk_callback: TOP, urb->status=%d", status); | |
1330 | dbg("digi_write_bulk_callback: TOP, urb status=%d", status); | ||
1331 | 1242 | ||
1332 | /* port and serial sanity check */ | 1243 | /* port and serial sanity check */ |
1333 | if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) { | 1244 | if (port == NULL || (priv=usb_get_serial_port_data(port)) == NULL) { |
1334 | err("%s: port or port->private is NULL, status=%d", | 1245 | err("%s: port or port->private is NULL, status=%d", |
1335 | __FUNCTION__, status); | 1246 | __FUNCTION__, status); |
1336 | return; | 1247 | return; |
1337 | } | 1248 | } |
1338 | serial = port->serial; | 1249 | serial = port->serial; |
1339 | if( serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL ) { | 1250 | if (serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL) { |
1340 | err("%s: serial or serial->private is NULL, status=%d", | 1251 | err("%s: serial or serial->private is NULL, status=%d", |
1341 | __FUNCTION__, status); | 1252 | __FUNCTION__, status); |
1342 | return; | 1253 | return; |
1343 | } | 1254 | } |
1344 | 1255 | ||
1345 | /* handle oob callback */ | 1256 | /* handle oob callback */ |
1346 | if( priv->dp_port_num == serial_priv->ds_oob_port_num ) { | 1257 | if (priv->dp_port_num == serial_priv->ds_oob_port_num) { |
1347 | dbg( "digi_write_bulk_callback: oob callback" ); | 1258 | dbg("digi_write_bulk_callback: oob callback"); |
1348 | spin_lock( &priv->dp_port_lock ); | 1259 | spin_lock(&priv->dp_port_lock); |
1349 | priv->dp_write_urb_in_use = 0; | 1260 | priv->dp_write_urb_in_use = 0; |
1350 | wake_up_interruptible( &port->write_wait ); | 1261 | wake_up_interruptible(&port->write_wait); |
1351 | spin_unlock( &priv->dp_port_lock ); | 1262 | spin_unlock(&priv->dp_port_lock); |
1352 | return; | 1263 | return; |
1353 | } | 1264 | } |
1354 | 1265 | ||
1355 | /* try to send any buffered data on this port, if it is open */ | 1266 | /* try to send any buffered data on this port, if it is open */ |
1356 | spin_lock( &priv->dp_port_lock ); | 1267 | spin_lock(&priv->dp_port_lock); |
1357 | priv->dp_write_urb_in_use = 0; | 1268 | priv->dp_write_urb_in_use = 0; |
1358 | if( port->open_count && port->write_urb->status != -EINPROGRESS | 1269 | if (port->open_count && port->write_urb->status != -EINPROGRESS |
1359 | && priv->dp_out_buf_len > 0 ) { | 1270 | && priv->dp_out_buf_len > 0) { |
1360 | |||
1361 | *((unsigned char *)(port->write_urb->transfer_buffer)) | 1271 | *((unsigned char *)(port->write_urb->transfer_buffer)) |
1362 | = (unsigned char)DIGI_CMD_SEND_DATA; | 1272 | = (unsigned char)DIGI_CMD_SEND_DATA; |
1363 | *((unsigned char *)(port->write_urb->transfer_buffer)+1) | 1273 | *((unsigned char *)(port->write_urb->transfer_buffer)+1) |
1364 | = (unsigned char)priv->dp_out_buf_len; | 1274 | = (unsigned char)priv->dp_out_buf_len; |
1365 | 1275 | port->write_urb->transfer_buffer_length = priv->dp_out_buf_len+2; | |
1366 | port->write_urb->transfer_buffer_length | ||
1367 | = priv->dp_out_buf_len+2; | ||
1368 | port->write_urb->dev = serial->dev; | 1276 | port->write_urb->dev = serial->dev; |
1369 | 1277 | memcpy(port->write_urb->transfer_buffer+2, priv->dp_out_buf, | |
1370 | memcpy( port->write_urb->transfer_buffer+2, priv->dp_out_buf, | 1278 | priv->dp_out_buf_len); |
1371 | priv->dp_out_buf_len ); | 1279 | if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) { |
1372 | |||
1373 | if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) { | ||
1374 | priv->dp_write_urb_in_use = 1; | 1280 | priv->dp_write_urb_in_use = 1; |
1375 | priv->dp_out_buf_len = 0; | 1281 | priv->dp_out_buf_len = 0; |
1376 | } | 1282 | } |
1377 | |||
1378 | } | 1283 | } |
1379 | |||
1380 | /* wake up processes sleeping on writes immediately */ | 1284 | /* wake up processes sleeping on writes immediately */ |
1381 | digi_wakeup_write( port ); | 1285 | digi_wakeup_write(port); |
1382 | |||
1383 | /* also queue up a wakeup at scheduler time, in case we */ | 1286 | /* also queue up a wakeup at scheduler time, in case we */ |
1384 | /* lost the race in write_chan(). */ | 1287 | /* lost the race in write_chan(). */ |
1385 | schedule_work(&priv->dp_wakeup_work); | 1288 | schedule_work(&priv->dp_wakeup_work); |
1386 | 1289 | ||
1387 | spin_unlock( &priv->dp_port_lock ); | 1290 | spin_unlock(&priv->dp_port_lock); |
1388 | 1291 | if (ret) | |
1389 | if( ret ) { | 1292 | err("%s: usb_submit_urb failed, ret=%d, port=%d", |
1390 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 1293 | __FUNCTION__, ret, priv->dp_port_num); |
1391 | ret, priv->dp_port_num ); | ||
1392 | } | ||
1393 | |||
1394 | } | 1294 | } |
1395 | 1295 | ||
1396 | 1296 | static int digi_write_room(struct usb_serial_port *port) | |
1397 | static int digi_write_room( struct usb_serial_port *port ) | ||
1398 | { | 1297 | { |
1399 | 1298 | ||
1400 | int room; | 1299 | int room; |
1401 | struct digi_port *priv = usb_get_serial_port_data(port); | 1300 | struct digi_port *priv = usb_get_serial_port_data(port); |
1402 | unsigned long flags = 0; | 1301 | unsigned long flags = 0; |
1403 | 1302 | ||
1303 | spin_lock_irqsave(&priv->dp_port_lock, flags); | ||
1404 | 1304 | ||
1405 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1305 | if (port->write_urb->status == -EINPROGRESS || priv->dp_write_urb_in_use) |
1406 | |||
1407 | if( port->write_urb->status == -EINPROGRESS | ||
1408 | || priv->dp_write_urb_in_use ) | ||
1409 | room = 0; | 1306 | room = 0; |
1410 | else | 1307 | else |
1411 | room = port->bulk_out_size - 2 - priv->dp_out_buf_len; | 1308 | room = port->bulk_out_size - 2 - priv->dp_out_buf_len; |
1412 | 1309 | ||
1413 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1310 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1414 | 1311 | dbg("digi_write_room: port=%d, room=%d", priv->dp_port_num, room); | |
1415 | dbg( "digi_write_room: port=%d, room=%d", priv->dp_port_num, room ); | 1312 | return room; |
1416 | return( room ); | ||
1417 | 1313 | ||
1418 | } | 1314 | } |
1419 | 1315 | ||
1420 | 1316 | static int digi_chars_in_buffer(struct usb_serial_port *port) | |
1421 | static int digi_chars_in_buffer( struct usb_serial_port *port ) | ||
1422 | { | 1317 | { |
1423 | 1318 | ||
1424 | struct digi_port *priv = usb_get_serial_port_data(port); | 1319 | struct digi_port *priv = usb_get_serial_port_data(port); |
1425 | 1320 | ||
1426 | 1321 | ||
1427 | if( port->write_urb->status == -EINPROGRESS | 1322 | if (port->write_urb->status == -EINPROGRESS |
1428 | || priv->dp_write_urb_in_use ) { | 1323 | || priv->dp_write_urb_in_use) { |
1429 | dbg( "digi_chars_in_buffer: port=%d, chars=%d", priv->dp_port_num, port->bulk_out_size - 2 ); | 1324 | dbg("digi_chars_in_buffer: port=%d, chars=%d", |
1430 | /* return( port->bulk_out_size - 2 ); */ | 1325 | priv->dp_port_num, port->bulk_out_size - 2); |
1431 | return( 256 ); | 1326 | /* return(port->bulk_out_size - 2); */ |
1327 | return 256; | ||
1432 | } else { | 1328 | } else { |
1433 | dbg( "digi_chars_in_buffer: port=%d, chars=%d", priv->dp_port_num, priv->dp_out_buf_len ); | 1329 | dbg("digi_chars_in_buffer: port=%d, chars=%d", |
1434 | return( priv->dp_out_buf_len ); | 1330 | priv->dp_port_num, priv->dp_out_buf_len); |
1331 | return priv->dp_out_buf_len; | ||
1435 | } | 1332 | } |
1436 | 1333 | ||
1437 | } | 1334 | } |
1438 | 1335 | ||
1439 | 1336 | ||
1440 | static int digi_open( struct usb_serial_port *port, struct file *filp ) | 1337 | static int digi_open(struct usb_serial_port *port, struct file *filp) |
1441 | { | 1338 | { |
1442 | |||
1443 | int ret; | 1339 | int ret; |
1444 | unsigned char buf[32]; | 1340 | unsigned char buf[32]; |
1445 | struct digi_port *priv = usb_get_serial_port_data(port); | 1341 | struct digi_port *priv = usb_get_serial_port_data(port); |
1446 | struct ktermios not_termios; | 1342 | struct ktermios not_termios; |
1447 | unsigned long flags = 0; | 1343 | unsigned long flags = 0; |
1448 | 1344 | ||
1449 | 1345 | dbg("digi_open: TOP: port=%d, open_count=%d", | |
1450 | dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count ); | 1346 | priv->dp_port_num, port->open_count); |
1451 | 1347 | ||
1452 | /* be sure the device is started up */ | 1348 | /* be sure the device is started up */ |
1453 | if( digi_startup_device( port->serial ) != 0 ) | 1349 | if (digi_startup_device(port->serial) != 0) |
1454 | return( -ENXIO ); | 1350 | return -ENXIO; |
1455 | 1351 | ||
1456 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1352 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1457 | 1353 | ||
1458 | /* don't wait on a close in progress for non-blocking opens */ | 1354 | /* don't wait on a close in progress for non-blocking opens */ |
1459 | if( priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { | 1355 | if (priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) { |
1460 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1356 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1461 | return( -EAGAIN ); | 1357 | return -EAGAIN; |
1462 | } | 1358 | } |
1463 | 1359 | ||
1464 | /* wait for a close in progress to finish */ | 1360 | /* wait for a close in progress to finish */ |
1465 | while( priv->dp_in_close ) { | 1361 | while(priv->dp_in_close) { |
1466 | cond_wait_interruptible_timeout_irqrestore( | 1362 | cond_wait_interruptible_timeout_irqrestore( |
1467 | &priv->dp_close_wait, DIGI_RETRY_TIMEOUT, | 1363 | &priv->dp_close_wait, DIGI_RETRY_TIMEOUT, |
1468 | &priv->dp_port_lock, flags ); | 1364 | &priv->dp_port_lock, flags); |
1469 | if( signal_pending(current) ) { | 1365 | if (signal_pending(current)) |
1470 | return( -EINTR ); | 1366 | return -EINTR; |
1471 | } | 1367 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1472 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | ||
1473 | } | 1368 | } |
1474 | 1369 | ||
1475 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1370 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1476 | 1371 | ||
1477 | /* read modem signals automatically whenever they change */ | 1372 | /* read modem signals automatically whenever they change */ |
1478 | buf[0] = DIGI_CMD_READ_INPUT_SIGNALS; | 1373 | buf[0] = DIGI_CMD_READ_INPUT_SIGNALS; |
@@ -1486,23 +1381,22 @@ dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_cou | |||
1486 | buf[6] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; | 1381 | buf[6] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; |
1487 | buf[7] = 0; | 1382 | buf[7] = 0; |
1488 | 1383 | ||
1489 | if( (ret=digi_write_oob_command( port, buf, 8, 1 )) != 0 ) | 1384 | if ((ret = digi_write_oob_command(port, buf, 8, 1)) != 0) |
1490 | dbg( "digi_open: write oob failed, ret=%d", ret ); | 1385 | dbg("digi_open: write oob failed, ret=%d", ret); |
1491 | 1386 | ||
1492 | /* set termios settings */ | 1387 | /* set termios settings */ |
1493 | not_termios.c_cflag = ~port->tty->termios->c_cflag; | 1388 | not_termios.c_cflag = ~port->tty->termios->c_cflag; |
1494 | not_termios.c_iflag = ~port->tty->termios->c_iflag; | 1389 | not_termios.c_iflag = ~port->tty->termios->c_iflag; |
1495 | digi_set_termios( port, ¬_termios ); | 1390 | digi_set_termios(port, ¬_termios); |
1496 | 1391 | ||
1497 | /* set DTR and RTS */ | 1392 | /* set DTR and RTS */ |
1498 | digi_set_modem_signals( port, TIOCM_DTR|TIOCM_RTS, 1 ); | 1393 | digi_set_modem_signals(port, TIOCM_DTR|TIOCM_RTS, 1); |
1499 | |||
1500 | return( 0 ); | ||
1501 | 1394 | ||
1395 | return 0; | ||
1502 | } | 1396 | } |
1503 | 1397 | ||
1504 | 1398 | ||
1505 | static void digi_close( struct usb_serial_port *port, struct file *filp ) | 1399 | static void digi_close(struct usb_serial_port *port, struct file *filp) |
1506 | { | 1400 | { |
1507 | DEFINE_WAIT(wait); | 1401 | DEFINE_WAIT(wait); |
1508 | int ret; | 1402 | int ret; |
@@ -1511,40 +1405,37 @@ static void digi_close( struct usb_serial_port *port, struct file *filp ) | |||
1511 | struct digi_port *priv = usb_get_serial_port_data(port); | 1405 | struct digi_port *priv = usb_get_serial_port_data(port); |
1512 | unsigned long flags = 0; | 1406 | unsigned long flags = 0; |
1513 | 1407 | ||
1514 | 1408 | dbg("digi_close: TOP: port=%d, open_count=%d", | |
1515 | dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count ); | 1409 | priv->dp_port_num, port->open_count); |
1516 | |||
1517 | 1410 | ||
1518 | /* if disconnected, just clear flags */ | 1411 | /* if disconnected, just clear flags */ |
1519 | if (!usb_get_intfdata(port->serial->interface)) | 1412 | if (!usb_get_intfdata(port->serial->interface)) |
1520 | goto exit; | 1413 | goto exit; |
1521 | 1414 | ||
1522 | /* do cleanup only after final close on this port */ | 1415 | /* do cleanup only after final close on this port */ |
1523 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1416 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1524 | priv->dp_in_close = 1; | 1417 | priv->dp_in_close = 1; |
1525 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1418 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1526 | 1419 | ||
1527 | /* tell line discipline to process only XON/XOFF */ | 1420 | /* tell line discipline to process only XON/XOFF */ |
1528 | tty->closing = 1; | 1421 | tty->closing = 1; |
1529 | 1422 | ||
1530 | /* wait for output to drain */ | 1423 | /* wait for output to drain */ |
1531 | if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { | 1424 | if ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) |
1532 | tty_wait_until_sent( tty, DIGI_CLOSE_TIMEOUT ); | 1425 | tty_wait_until_sent(tty, DIGI_CLOSE_TIMEOUT); |
1533 | } | ||
1534 | 1426 | ||
1535 | /* flush driver and line discipline buffers */ | 1427 | /* flush driver and line discipline buffers */ |
1536 | if( tty->driver->flush_buffer ) | 1428 | if (tty->driver->flush_buffer) |
1537 | tty->driver->flush_buffer( tty ); | 1429 | tty->driver->flush_buffer(tty); |
1538 | tty_ldisc_flush(tty); | 1430 | tty_ldisc_flush(tty); |
1539 | 1431 | ||
1540 | if (port->serial->dev) { | 1432 | if (port->serial->dev) { |
1541 | /* wait for transmit idle */ | 1433 | /* wait for transmit idle */ |
1542 | if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) { | 1434 | if ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) { |
1543 | digi_transmit_idle( port, DIGI_CLOSE_TIMEOUT ); | 1435 | digi_transmit_idle(port, DIGI_CLOSE_TIMEOUT); |
1544 | } | 1436 | } |
1545 | |||
1546 | /* drop DTR and RTS */ | 1437 | /* drop DTR and RTS */ |
1547 | digi_set_modem_signals( port, 0, 0 ); | 1438 | digi_set_modem_signals(port, 0, 0); |
1548 | 1439 | ||
1549 | /* disable input flow control */ | 1440 | /* disable input flow control */ |
1550 | buf[0] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; | 1441 | buf[0] = DIGI_CMD_SET_INPUT_FLOW_CONTROL; |
@@ -1576,8 +1467,8 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co | |||
1576 | buf[18] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; | 1467 | buf[18] = DIGI_FLUSH_TX | DIGI_FLUSH_RX; |
1577 | buf[19] = 0; | 1468 | buf[19] = 0; |
1578 | 1469 | ||
1579 | if( (ret=digi_write_oob_command( port, buf, 20, 0 )) != 0 ) | 1470 | if ((ret = digi_write_oob_command(port, buf, 20, 0)) != 0) |
1580 | dbg( "digi_close: write oob failed, ret=%d", ret ); | 1471 | dbg("digi_close: write oob failed, ret=%d", ret); |
1581 | 1472 | ||
1582 | /* wait for final commands on oob port to complete */ | 1473 | /* wait for final commands on oob port to complete */ |
1583 | prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE); | 1474 | prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE); |
@@ -1587,17 +1478,14 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co | |||
1587 | /* shutdown any outstanding bulk writes */ | 1478 | /* shutdown any outstanding bulk writes */ |
1588 | usb_kill_urb(port->write_urb); | 1479 | usb_kill_urb(port->write_urb); |
1589 | } | 1480 | } |
1590 | |||
1591 | tty->closing = 0; | 1481 | tty->closing = 0; |
1592 | |||
1593 | exit: | 1482 | exit: |
1594 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 1483 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1595 | priv->dp_write_urb_in_use = 0; | 1484 | priv->dp_write_urb_in_use = 0; |
1596 | priv->dp_in_close = 0; | 1485 | priv->dp_in_close = 0; |
1597 | wake_up_interruptible( &priv->dp_close_wait ); | 1486 | wake_up_interruptible(&priv->dp_close_wait); |
1598 | spin_unlock_irqrestore( &priv->dp_port_lock, flags ); | 1487 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
1599 | 1488 | dbg("digi_close: done"); | |
1600 | dbg( "digi_close: done" ); | ||
1601 | } | 1489 | } |
1602 | 1490 | ||
1603 | 1491 | ||
@@ -1608,155 +1496,136 @@ dbg( "digi_close: done" ); | |||
1608 | * urbs initialized. Returns 0 if successful, non-zero error otherwise. | 1496 | * urbs initialized. Returns 0 if successful, non-zero error otherwise. |
1609 | */ | 1497 | */ |
1610 | 1498 | ||
1611 | static int digi_startup_device( struct usb_serial *serial ) | 1499 | static int digi_startup_device(struct usb_serial *serial) |
1612 | { | 1500 | { |
1613 | |||
1614 | int i,ret = 0; | 1501 | int i,ret = 0; |
1615 | struct digi_serial *serial_priv = usb_get_serial_data(serial); | 1502 | struct digi_serial *serial_priv = usb_get_serial_data(serial); |
1616 | struct usb_serial_port *port; | 1503 | struct usb_serial_port *port; |
1617 | 1504 | ||
1618 | |||
1619 | /* be sure this happens exactly once */ | 1505 | /* be sure this happens exactly once */ |
1620 | spin_lock( &serial_priv->ds_serial_lock ); | 1506 | spin_lock(&serial_priv->ds_serial_lock); |
1621 | if( serial_priv->ds_device_started ) { | 1507 | if (serial_priv->ds_device_started) { |
1622 | spin_unlock( &serial_priv->ds_serial_lock ); | 1508 | spin_unlock(&serial_priv->ds_serial_lock); |
1623 | return( 0 ); | 1509 | return 0; |
1624 | } | 1510 | } |
1625 | serial_priv->ds_device_started = 1; | 1511 | serial_priv->ds_device_started = 1; |
1626 | spin_unlock( &serial_priv->ds_serial_lock ); | 1512 | spin_unlock(&serial_priv->ds_serial_lock); |
1627 | 1513 | ||
1628 | /* start reading from each bulk in endpoint for the device */ | 1514 | /* start reading from each bulk in endpoint for the device */ |
1629 | /* set USB_DISABLE_SPD flag for write bulk urbs */ | 1515 | /* set USB_DISABLE_SPD flag for write bulk urbs */ |
1630 | for( i=0; i<serial->type->num_ports+1; i++ ) { | 1516 | for (i = 0; i < serial->type->num_ports + 1; i++) { |
1631 | |||
1632 | port = serial->port[i]; | 1517 | port = serial->port[i]; |
1633 | |||
1634 | port->write_urb->dev = port->serial->dev; | 1518 | port->write_urb->dev = port->serial->dev; |
1635 | 1519 | if ((ret = usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0) { | |
1636 | if( (ret=usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0 ) { | 1520 | err("%s: usb_submit_urb failed, ret=%d, port=%d", |
1637 | err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__, | 1521 | __FUNCTION__, ret, i); |
1638 | ret, i ); | ||
1639 | break; | 1522 | break; |
1640 | } | 1523 | } |
1641 | |||
1642 | } | 1524 | } |
1643 | 1525 | return ret; | |
1644 | return( ret ); | ||
1645 | |||
1646 | } | 1526 | } |
1647 | 1527 | ||
1648 | 1528 | ||
1649 | static int digi_startup( struct usb_serial *serial ) | 1529 | static int digi_startup(struct usb_serial *serial) |
1650 | { | 1530 | { |
1651 | 1531 | ||
1652 | int i; | 1532 | int i; |
1653 | struct digi_port *priv; | 1533 | struct digi_port *priv; |
1654 | struct digi_serial *serial_priv; | 1534 | struct digi_serial *serial_priv; |
1655 | 1535 | ||
1656 | 1536 | dbg("digi_startup: TOP"); | |
1657 | dbg( "digi_startup: TOP" ); | ||
1658 | 1537 | ||
1659 | /* allocate the private data structures for all ports */ | 1538 | /* allocate the private data structures for all ports */ |
1660 | /* number of regular ports + 1 for the out-of-band port */ | 1539 | /* number of regular ports + 1 for the out-of-band port */ |
1661 | for( i=0; i<serial->type->num_ports+1; i++ ) { | 1540 | for(i = 0; i < serial->type->num_ports + 1; i++) { |
1662 | |||
1663 | /* allocate port private structure */ | 1541 | /* allocate port private structure */ |
1664 | priv = kmalloc( sizeof(struct digi_port), | 1542 | priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL); |
1665 | GFP_KERNEL ); | 1543 | if (priv == NULL) { |
1666 | if( priv == (struct digi_port *)0 ) { | 1544 | while (--i >= 0) |
1667 | while( --i >= 0 ) | 1545 | kfree(usb_get_serial_port_data(serial->port[i])); |
1668 | kfree( usb_get_serial_port_data(serial->port[i]) ); | 1546 | return 1; /* error */ |
1669 | return( 1 ); /* error */ | ||
1670 | } | 1547 | } |
1671 | 1548 | ||
1672 | /* initialize port private structure */ | 1549 | /* initialize port private structure */ |
1673 | spin_lock_init( &priv->dp_port_lock ); | 1550 | spin_lock_init(&priv->dp_port_lock); |
1674 | priv->dp_port_num = i; | 1551 | priv->dp_port_num = i; |
1675 | priv->dp_out_buf_len = 0; | 1552 | priv->dp_out_buf_len = 0; |
1676 | priv->dp_write_urb_in_use = 0; | 1553 | priv->dp_write_urb_in_use = 0; |
1677 | priv->dp_modem_signals = 0; | 1554 | priv->dp_modem_signals = 0; |
1678 | init_waitqueue_head( &priv->dp_modem_change_wait ); | 1555 | init_waitqueue_head(&priv->dp_modem_change_wait); |
1679 | priv->dp_transmit_idle = 0; | 1556 | priv->dp_transmit_idle = 0; |
1680 | init_waitqueue_head( &priv->dp_transmit_idle_wait ); | 1557 | init_waitqueue_head(&priv->dp_transmit_idle_wait); |
1681 | priv->dp_throttled = 0; | 1558 | priv->dp_throttled = 0; |
1682 | priv->dp_throttle_restart = 0; | 1559 | priv->dp_throttle_restart = 0; |
1683 | init_waitqueue_head( &priv->dp_flush_wait ); | 1560 | init_waitqueue_head(&priv->dp_flush_wait); |
1684 | priv->dp_in_close = 0; | 1561 | priv->dp_in_close = 0; |
1685 | init_waitqueue_head( &priv->dp_close_wait ); | 1562 | init_waitqueue_head(&priv->dp_close_wait); |
1686 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); | 1563 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
1687 | priv->dp_port = serial->port[i]; | 1564 | priv->dp_port = serial->port[i]; |
1688 | |||
1689 | /* initialize write wait queue for this port */ | 1565 | /* initialize write wait queue for this port */ |
1690 | init_waitqueue_head( &serial->port[i]->write_wait ); | 1566 | init_waitqueue_head(&serial->port[i]->write_wait); |
1691 | 1567 | ||
1692 | usb_set_serial_port_data(serial->port[i], priv); | 1568 | usb_set_serial_port_data(serial->port[i], priv); |
1693 | } | 1569 | } |
1694 | 1570 | ||
1695 | /* allocate serial private structure */ | 1571 | /* allocate serial private structure */ |
1696 | serial_priv = kmalloc( sizeof(struct digi_serial), | 1572 | serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL); |
1697 | GFP_KERNEL ); | 1573 | if (serial_priv == NULL) { |
1698 | if( serial_priv == (struct digi_serial *)0 ) { | 1574 | for (i = 0; i < serial->type->num_ports + 1; i++) |
1699 | for( i=0; i<serial->type->num_ports+1; i++ ) | 1575 | kfree(usb_get_serial_port_data(serial->port[i])); |
1700 | kfree( usb_get_serial_port_data(serial->port[i]) ); | 1576 | return 1; /* error */ |
1701 | return( 1 ); /* error */ | ||
1702 | } | 1577 | } |
1703 | 1578 | ||
1704 | /* initialize serial private structure */ | 1579 | /* initialize serial private structure */ |
1705 | spin_lock_init( &serial_priv->ds_serial_lock ); | 1580 | spin_lock_init(&serial_priv->ds_serial_lock); |
1706 | serial_priv->ds_oob_port_num = serial->type->num_ports; | 1581 | serial_priv->ds_oob_port_num = serial->type->num_ports; |
1707 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; | 1582 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; |
1708 | serial_priv->ds_device_started = 0; | 1583 | serial_priv->ds_device_started = 0; |
1709 | usb_set_serial_data(serial, serial_priv); | 1584 | usb_set_serial_data(serial, serial_priv); |
1710 | 1585 | ||
1711 | return( 0 ); | 1586 | return 0; |
1712 | |||
1713 | } | 1587 | } |
1714 | 1588 | ||
1715 | 1589 | ||
1716 | static void digi_shutdown( struct usb_serial *serial ) | 1590 | static void digi_shutdown(struct usb_serial *serial) |
1717 | { | 1591 | { |
1718 | |||
1719 | int i; | 1592 | int i; |
1720 | 1593 | dbg("digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt()); | |
1721 | |||
1722 | dbg( "digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt() ); | ||
1723 | 1594 | ||
1724 | /* stop reads and writes on all ports */ | 1595 | /* stop reads and writes on all ports */ |
1725 | for( i=0; i<serial->type->num_ports+1; i++ ) { | 1596 | for (i = 0; i < serial->type->num_ports + 1; i++) { |
1726 | usb_kill_urb(serial->port[i]->read_urb); | 1597 | usb_kill_urb(serial->port[i]->read_urb); |
1727 | usb_kill_urb(serial->port[i]->write_urb); | 1598 | usb_kill_urb(serial->port[i]->write_urb); |
1728 | } | 1599 | } |
1729 | 1600 | ||
1730 | /* free the private data structures for all ports */ | 1601 | /* free the private data structures for all ports */ |
1731 | /* number of regular ports + 1 for the out-of-band port */ | 1602 | /* number of regular ports + 1 for the out-of-band port */ |
1732 | for( i=0; i<serial->type->num_ports+1; i++ ) | 1603 | for(i = 0; i < serial->type->num_ports + 1; i++) |
1733 | kfree( usb_get_serial_port_data(serial->port[i]) ); | 1604 | kfree(usb_get_serial_port_data(serial->port[i])); |
1734 | kfree( usb_get_serial_data(serial) ); | 1605 | kfree(usb_get_serial_data(serial)); |
1735 | } | 1606 | } |
1736 | 1607 | ||
1737 | 1608 | ||
1738 | static void digi_read_bulk_callback( struct urb *urb ) | 1609 | static void digi_read_bulk_callback(struct urb *urb) |
1739 | { | 1610 | { |
1740 | |||
1741 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1611 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
1742 | struct digi_port *priv; | 1612 | struct digi_port *priv; |
1743 | struct digi_serial *serial_priv; | 1613 | struct digi_serial *serial_priv; |
1744 | int ret; | 1614 | int ret; |
1745 | int status = urb->status; | 1615 | int status = urb->status; |
1746 | 1616 | ||
1747 | 1617 | dbg("digi_read_bulk_callback: TOP"); | |
1748 | dbg( "digi_read_bulk_callback: TOP" ); | ||
1749 | 1618 | ||
1750 | /* port sanity check, do not resubmit if port is not valid */ | 1619 | /* port sanity check, do not resubmit if port is not valid */ |
1751 | if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) { | 1620 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
1752 | err("%s: port or port->private is NULL, status=%d", | 1621 | err("%s: port or port->private is NULL, status=%d", |
1753 | __FUNCTION__, status); | 1622 | __FUNCTION__, status); |
1754 | return; | 1623 | return; |
1755 | } | 1624 | } |
1756 | if( port->serial == NULL | 1625 | if (port->serial == NULL || |
1757 | || (serial_priv=usb_get_serial_data(port->serial)) == NULL ) { | 1626 | (serial_priv=usb_get_serial_data(port->serial)) == NULL) { |
1758 | err("%s: serial is bad or serial->private is NULL, status=%d", | 1627 | err("%s: serial is bad or serial->private is NULL, status=%d", |
1759 | __FUNCTION__, status); | 1628 | __FUNCTION__, status); |
1760 | return; | 1629 | return; |
1761 | } | 1630 | } |
1762 | 1631 | ||
@@ -1768,24 +1637,23 @@ dbg( "digi_read_bulk_callback: TOP" ); | |||
1768 | } | 1637 | } |
1769 | 1638 | ||
1770 | /* handle oob or inb callback, do not resubmit if error */ | 1639 | /* handle oob or inb callback, do not resubmit if error */ |
1771 | if( priv->dp_port_num == serial_priv->ds_oob_port_num ) { | 1640 | if (priv->dp_port_num == serial_priv->ds_oob_port_num) { |
1772 | if( digi_read_oob_callback( urb ) != 0 ) | 1641 | if (digi_read_oob_callback(urb) != 0) |
1773 | return; | 1642 | return; |
1774 | } else { | 1643 | } else { |
1775 | if( digi_read_inb_callback( urb ) != 0 ) | 1644 | if (digi_read_inb_callback(urb) != 0) |
1776 | return; | 1645 | return; |
1777 | } | 1646 | } |
1778 | 1647 | ||
1779 | /* continue read */ | 1648 | /* continue read */ |
1780 | urb->dev = port->serial->dev; | 1649 | urb->dev = port->serial->dev; |
1781 | if( (ret=usb_submit_urb(urb, GFP_ATOMIC)) != 0 ) { | 1650 | if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) != 0) { |
1782 | err("%s: failed resubmitting urb, ret=%d, port=%d", __FUNCTION__, | 1651 | err("%s: failed resubmitting urb, ret=%d, port=%d", |
1783 | ret, priv->dp_port_num ); | 1652 | __FUNCTION__, ret, priv->dp_port_num); |
1784 | } | 1653 | } |
1785 | 1654 | ||
1786 | } | 1655 | } |
1787 | 1656 | ||
1788 | |||
1789 | /* | 1657 | /* |
1790 | * Digi Read INB Callback | 1658 | * Digi Read INB Callback |
1791 | * | 1659 | * |
@@ -1796,7 +1664,7 @@ dbg( "digi_read_bulk_callback: TOP" ); | |||
1796 | * throttled, and -1 if the sanity checks failed. | 1664 | * throttled, and -1 if the sanity checks failed. |
1797 | */ | 1665 | */ |
1798 | 1666 | ||
1799 | static int digi_read_inb_callback( struct urb *urb ) | 1667 | static int digi_read_inb_callback(struct urb *urb) |
1800 | { | 1668 | { |
1801 | 1669 | ||
1802 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1670 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
@@ -1812,72 +1680,67 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
1812 | 1680 | ||
1813 | /* do not process callbacks on closed ports */ | 1681 | /* do not process callbacks on closed ports */ |
1814 | /* but do continue the read chain */ | 1682 | /* but do continue the read chain */ |
1815 | if( port->open_count == 0 ) | 1683 | if (port->open_count == 0) |
1816 | return( 0 ); | 1684 | return 0; |
1817 | 1685 | ||
1818 | /* short/multiple packet check */ | 1686 | /* short/multiple packet check */ |
1819 | if( urb->actual_length != len + 2 ) { | 1687 | if (urb->actual_length != len + 2) { |
1820 | err("%s: INCOMPLETE OR MULTIPLE PACKET, urb status=%d, " | 1688 | err("%s: INCOMPLETE OR MULTIPLE PACKET, urb->status=%d, " |
1821 | "port=%d, opcode=%d, len=%d, actual_length=%d, " | 1689 | "port=%d, opcode=%d, len=%d, actual_length=%d, " |
1822 | "port_status=%d", __FUNCTION__, status, priv->dp_port_num, | 1690 | "status=%d", __FUNCTION__, status, priv->dp_port_num, |
1823 | opcode, len, urb->actual_length, port_status); | 1691 | opcode, len, urb->actual_length, port_status); |
1824 | return( -1 ); | 1692 | return -1; |
1825 | } | 1693 | } |
1826 | 1694 | ||
1827 | spin_lock( &priv->dp_port_lock ); | 1695 | spin_lock(&priv->dp_port_lock); |
1828 | 1696 | ||
1829 | /* check for throttle; if set, do not resubmit read urb */ | 1697 | /* check for throttle; if set, do not resubmit read urb */ |
1830 | /* indicate the read chain needs to be restarted on unthrottle */ | 1698 | /* indicate the read chain needs to be restarted on unthrottle */ |
1831 | throttled = priv->dp_throttled; | 1699 | throttled = priv->dp_throttled; |
1832 | if( throttled ) | 1700 | if (throttled) |
1833 | priv->dp_throttle_restart = 1; | 1701 | priv->dp_throttle_restart = 1; |
1834 | 1702 | ||
1835 | /* receive data */ | 1703 | /* receive data */ |
1836 | if( opcode == DIGI_CMD_RECEIVE_DATA ) { | 1704 | if (opcode == DIGI_CMD_RECEIVE_DATA) { |
1837 | |||
1838 | /* get flag from port_status */ | 1705 | /* get flag from port_status */ |
1839 | flag = 0; | 1706 | flag = 0; |
1840 | 1707 | ||
1841 | /* overrun is special, not associated with a char */ | 1708 | /* overrun is special, not associated with a char */ |
1842 | if (port_status & DIGI_OVERRUN_ERROR) { | 1709 | if (port_status & DIGI_OVERRUN_ERROR) |
1843 | tty_insert_flip_char( tty, 0, TTY_OVERRUN ); | 1710 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
1844 | } | ||
1845 | 1711 | ||
1846 | /* break takes precedence over parity, */ | 1712 | /* break takes precedence over parity, */ |
1847 | /* which takes precedence over framing errors */ | 1713 | /* which takes precedence over framing errors */ |
1848 | if (port_status & DIGI_BREAK_ERROR) { | 1714 | if (port_status & DIGI_BREAK_ERROR) |
1849 | flag = TTY_BREAK; | 1715 | flag = TTY_BREAK; |
1850 | } else if (port_status & DIGI_PARITY_ERROR) { | 1716 | else if (port_status & DIGI_PARITY_ERROR) |
1851 | flag = TTY_PARITY; | 1717 | flag = TTY_PARITY; |
1852 | } else if (port_status & DIGI_FRAMING_ERROR) { | 1718 | else if (port_status & DIGI_FRAMING_ERROR) |
1853 | flag = TTY_FRAME; | 1719 | flag = TTY_FRAME; |
1854 | } | ||
1855 | 1720 | ||
1856 | /* data length is len-1 (one byte of len is port_status) */ | 1721 | /* data length is len-1 (one byte of len is port_status) */ |
1857 | --len; | 1722 | --len; |
1858 | 1723 | ||
1859 | len = tty_buffer_request_room(tty, len); | 1724 | len = tty_buffer_request_room(tty, len); |
1860 | if( len > 0 ) { | 1725 | if (len > 0) { |
1861 | /* Hot path */ | 1726 | /* Hot path */ |
1862 | if(flag == TTY_NORMAL) | 1727 | if (flag == TTY_NORMAL) |
1863 | tty_insert_flip_string(tty, data, len); | 1728 | tty_insert_flip_string(tty, data, len); |
1864 | else { | 1729 | else { |
1865 | for(i = 0; i < len; i++) | 1730 | for(i = 0; i < len; i++) |
1866 | tty_insert_flip_char(tty, data[i], flag); | 1731 | tty_insert_flip_char(tty, data[i], flag); |
1867 | } | 1732 | } |
1868 | tty_flip_buffer_push( tty ); | 1733 | tty_flip_buffer_push(tty); |
1869 | } | 1734 | } |
1870 | } | 1735 | } |
1736 | spin_unlock(&priv->dp_port_lock); | ||
1871 | 1737 | ||
1872 | spin_unlock( &priv->dp_port_lock ); | 1738 | if (opcode == DIGI_CMD_RECEIVE_DISABLE) |
1873 | 1739 | dbg("%s: got RECEIVE_DISABLE", __FUNCTION__); | |
1874 | if( opcode == DIGI_CMD_RECEIVE_DISABLE ) { | 1740 | else if (opcode != DIGI_CMD_RECEIVE_DATA) |
1875 | dbg("%s: got RECEIVE_DISABLE", __FUNCTION__ ); | 1741 | dbg("%s: unknown opcode: %d", __FUNCTION__, opcode); |
1876 | } else if( opcode != DIGI_CMD_RECEIVE_DATA ) { | ||
1877 | dbg("%s: unknown opcode: %d", __FUNCTION__, opcode ); | ||
1878 | } | ||
1879 | 1742 | ||
1880 | return( throttled ? 1 : 0 ); | 1743 | return(throttled ? 1 : 0); |
1881 | 1744 | ||
1882 | } | 1745 | } |
1883 | 1746 | ||
@@ -1891,7 +1754,7 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
1891 | * -1 if the sanity checks failed. | 1754 | * -1 if the sanity checks failed. |
1892 | */ | 1755 | */ |
1893 | 1756 | ||
1894 | static int digi_read_oob_callback( struct urb *urb ) | 1757 | static int digi_read_oob_callback(struct urb *urb) |
1895 | { | 1758 | { |
1896 | 1759 | ||
1897 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1760 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
@@ -1900,87 +1763,75 @@ static int digi_read_oob_callback( struct urb *urb ) | |||
1900 | int opcode, line, status, val; | 1763 | int opcode, line, status, val; |
1901 | int i; | 1764 | int i; |
1902 | 1765 | ||
1903 | 1766 | dbg("digi_read_oob_callback: port=%d, len=%d", | |
1904 | dbg( "digi_read_oob_callback: port=%d, len=%d", priv->dp_port_num, | 1767 | priv->dp_port_num, urb->actual_length); |
1905 | urb->actual_length ); | ||
1906 | 1768 | ||
1907 | /* handle each oob command */ | 1769 | /* handle each oob command */ |
1908 | for( i=0; i<urb->actual_length-3; ) { | 1770 | for(i = 0; i < urb->actual_length - 3;) { |
1909 | |||
1910 | opcode = ((unsigned char *)urb->transfer_buffer)[i++]; | 1771 | opcode = ((unsigned char *)urb->transfer_buffer)[i++]; |
1911 | line = ((unsigned char *)urb->transfer_buffer)[i++]; | 1772 | line = ((unsigned char *)urb->transfer_buffer)[i++]; |
1912 | status = ((unsigned char *)urb->transfer_buffer)[i++]; | 1773 | status = ((unsigned char *)urb->transfer_buffer)[i++]; |
1913 | val = ((unsigned char *)urb->transfer_buffer)[i++]; | 1774 | val = ((unsigned char *)urb->transfer_buffer)[i++]; |
1914 | 1775 | ||
1915 | dbg( "digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d", | 1776 | dbg("digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d", |
1916 | opcode, line, status, val ); | 1777 | opcode, line, status, val); |
1917 | 1778 | ||
1918 | if( status != 0 || line >= serial->type->num_ports ) | 1779 | if (status != 0 || line >= serial->type->num_ports) |
1919 | continue; | 1780 | continue; |
1920 | 1781 | ||
1921 | port = serial->port[line]; | 1782 | port = serial->port[line]; |
1922 | 1783 | ||
1923 | if ((priv=usb_get_serial_port_data(port)) == NULL ) | 1784 | if ((priv=usb_get_serial_port_data(port)) == NULL) |
1924 | return -1; | 1785 | return -1; |
1925 | 1786 | ||
1926 | if( opcode == DIGI_CMD_READ_INPUT_SIGNALS ) { | 1787 | if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
1927 | 1788 | spin_lock(&priv->dp_port_lock); | |
1928 | spin_lock( &priv->dp_port_lock ); | ||
1929 | |||
1930 | /* convert from digi flags to termiox flags */ | 1789 | /* convert from digi flags to termiox flags */ |
1931 | if( val & DIGI_READ_INPUT_SIGNALS_CTS ) { | 1790 | if (val & DIGI_READ_INPUT_SIGNALS_CTS) { |
1932 | priv->dp_modem_signals |= TIOCM_CTS; | 1791 | priv->dp_modem_signals |= TIOCM_CTS; |
1933 | /* port must be open to use tty struct */ | 1792 | /* port must be open to use tty struct */ |
1934 | if( port->open_count | 1793 | if (port->open_count |
1935 | && port->tty->termios->c_cflag & CRTSCTS ) { | 1794 | && port->tty->termios->c_cflag & CRTSCTS) { |
1936 | port->tty->hw_stopped = 0; | 1795 | port->tty->hw_stopped = 0; |
1937 | digi_wakeup_write( port ); | 1796 | digi_wakeup_write(port); |
1938 | } | 1797 | } |
1939 | } else { | 1798 | } else { |
1940 | priv->dp_modem_signals &= ~TIOCM_CTS; | 1799 | priv->dp_modem_signals &= ~TIOCM_CTS; |
1941 | /* port must be open to use tty struct */ | 1800 | /* port must be open to use tty struct */ |
1942 | if( port->open_count | 1801 | if (port->open_count |
1943 | && port->tty->termios->c_cflag & CRTSCTS ) { | 1802 | && port->tty->termios->c_cflag & CRTSCTS) { |
1944 | port->tty->hw_stopped = 1; | 1803 | port->tty->hw_stopped = 1; |
1945 | } | 1804 | } |
1946 | } | 1805 | } |
1947 | if( val & DIGI_READ_INPUT_SIGNALS_DSR ) | 1806 | if (val & DIGI_READ_INPUT_SIGNALS_DSR) |
1948 | priv->dp_modem_signals |= TIOCM_DSR; | 1807 | priv->dp_modem_signals |= TIOCM_DSR; |
1949 | else | 1808 | else |
1950 | priv->dp_modem_signals &= ~TIOCM_DSR; | 1809 | priv->dp_modem_signals &= ~TIOCM_DSR; |
1951 | if( val & DIGI_READ_INPUT_SIGNALS_RI ) | 1810 | if (val & DIGI_READ_INPUT_SIGNALS_RI) |
1952 | priv->dp_modem_signals |= TIOCM_RI; | 1811 | priv->dp_modem_signals |= TIOCM_RI; |
1953 | else | 1812 | else |
1954 | priv->dp_modem_signals &= ~TIOCM_RI; | 1813 | priv->dp_modem_signals &= ~TIOCM_RI; |
1955 | if( val & DIGI_READ_INPUT_SIGNALS_DCD ) | 1814 | if (val & DIGI_READ_INPUT_SIGNALS_DCD) |
1956 | priv->dp_modem_signals |= TIOCM_CD; | 1815 | priv->dp_modem_signals |= TIOCM_CD; |
1957 | else | 1816 | else |
1958 | priv->dp_modem_signals &= ~TIOCM_CD; | 1817 | priv->dp_modem_signals &= ~TIOCM_CD; |
1959 | 1818 | ||
1960 | wake_up_interruptible( &priv->dp_modem_change_wait ); | 1819 | wake_up_interruptible(&priv->dp_modem_change_wait); |
1961 | spin_unlock( &priv->dp_port_lock ); | 1820 | spin_unlock(&priv->dp_port_lock); |
1962 | 1821 | } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) { | |
1963 | } else if( opcode == DIGI_CMD_TRANSMIT_IDLE ) { | 1822 | spin_lock(&priv->dp_port_lock); |
1964 | |||
1965 | spin_lock( &priv->dp_port_lock ); | ||
1966 | priv->dp_transmit_idle = 1; | 1823 | priv->dp_transmit_idle = 1; |
1967 | wake_up_interruptible( &priv->dp_transmit_idle_wait ); | 1824 | wake_up_interruptible(&priv->dp_transmit_idle_wait); |
1968 | spin_unlock( &priv->dp_port_lock ); | 1825 | spin_unlock(&priv->dp_port_lock); |
1969 | 1826 | } else if (opcode == DIGI_CMD_IFLUSH_FIFO) { | |
1970 | } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) { | 1827 | wake_up_interruptible(&priv->dp_flush_wait); |
1971 | |||
1972 | wake_up_interruptible( &priv->dp_flush_wait ); | ||
1973 | |||
1974 | } | 1828 | } |
1975 | |||
1976 | } | 1829 | } |
1977 | 1830 | return 0; | |
1978 | return( 0 ); | ||
1979 | 1831 | ||
1980 | } | 1832 | } |
1981 | 1833 | ||
1982 | 1834 | static int __init digi_init(void) | |
1983 | static int __init digi_init (void) | ||
1984 | { | 1835 | { |
1985 | int retval; | 1836 | int retval; |
1986 | retval = usb_serial_register(&digi_acceleport_2_device); | 1837 | retval = usb_serial_register(&digi_acceleport_2_device); |
@@ -2002,12 +1853,11 @@ failed_acceleport_2_device: | |||
2002 | return retval; | 1853 | return retval; |
2003 | } | 1854 | } |
2004 | 1855 | ||
2005 | |||
2006 | static void __exit digi_exit (void) | 1856 | static void __exit digi_exit (void) |
2007 | { | 1857 | { |
2008 | usb_deregister (&digi_driver); | 1858 | usb_deregister(&digi_driver); |
2009 | usb_serial_deregister (&digi_acceleport_2_device); | 1859 | usb_serial_deregister(&digi_acceleport_2_device); |
2010 | usb_serial_deregister (&digi_acceleport_4_device); | 1860 | usb_serial_deregister(&digi_acceleport_4_device); |
2011 | } | 1861 | } |
2012 | 1862 | ||
2013 | 1863 | ||
@@ -2015,8 +1865,8 @@ module_init(digi_init); | |||
2015 | module_exit(digi_exit); | 1865 | module_exit(digi_exit); |
2016 | 1866 | ||
2017 | 1867 | ||
2018 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 1868 | MODULE_AUTHOR(DRIVER_AUTHOR); |
2019 | MODULE_DESCRIPTION( DRIVER_DESC ); | 1869 | MODULE_DESCRIPTION(DRIVER_DESC); |
2020 | MODULE_LICENSE("GPL"); | 1870 | MODULE_LICENSE("GPL"); |
2021 | 1871 | ||
2022 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 1872 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index dd42f57089ff..2ecb1d2a034d 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2366,9 +2366,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa | |||
2366 | int status; | 2366 | int status; |
2367 | unsigned char number = edge_port->port->number - edge_port->port->serial->minor; | 2367 | unsigned char number = edge_port->port->number - edge_port->port->serial->minor; |
2368 | 2368 | ||
2369 | if ((!edge_serial->is_epic) || | 2369 | if (edge_serial->is_epic && |
2370 | ((edge_serial->is_epic) && | 2370 | !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) { |
2371 | (!edge_serial->epic_descriptor.Supports.IOSPSetBaudRate))) { | ||
2372 | dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d", | 2371 | dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d", |
2373 | edge_port->port->number, baudRate); | 2372 | edge_port->port->number, baudRate); |
2374 | return 0; | 2373 | return 0; |
@@ -2461,18 +2460,16 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r | |||
2461 | 2460 | ||
2462 | dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); | 2461 | dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); |
2463 | 2462 | ||
2464 | if ((!edge_serial->is_epic) || | 2463 | if (edge_serial->is_epic && |
2465 | ((edge_serial->is_epic) && | 2464 | !edge_serial->epic_descriptor.Supports.IOSPWriteMCR && |
2466 | (!edge_serial->epic_descriptor.Supports.IOSPWriteMCR) && | 2465 | regNum == MCR) { |
2467 | (regNum == MCR))) { | ||
2468 | dbg("SendCmdWriteUartReg - Not writing to MCR Register"); | 2466 | dbg("SendCmdWriteUartReg - Not writing to MCR Register"); |
2469 | return 0; | 2467 | return 0; |
2470 | } | 2468 | } |
2471 | 2469 | ||
2472 | if ((!edge_serial->is_epic) || | 2470 | if (edge_serial->is_epic && |
2473 | ((edge_serial->is_epic) && | 2471 | !edge_serial->epic_descriptor.Supports.IOSPWriteLCR && |
2474 | (!edge_serial->epic_descriptor.Supports.IOSPWriteLCR) && | 2472 | regNum == LCR) { |
2475 | (regNum == LCR))) { | ||
2476 | dbg ("SendCmdWriteUartReg - Not writing to LCR Register"); | 2473 | dbg ("SendCmdWriteUartReg - Not writing to LCR Register"); |
2477 | return 0; | 2474 | return 0; |
2478 | } | 2475 | } |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 2a3fabcf5186..e08c9bb403d8 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -184,21 +184,21 @@ struct mct_u232_private { | |||
184 | * we do not know how to support. We ignore them for the moment. | 184 | * we do not know how to support. We ignore them for the moment. |
185 | * XXX Rate-limit the error message, it's user triggerable. | 185 | * XXX Rate-limit the error message, it's user triggerable. |
186 | */ | 186 | */ |
187 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value) | 187 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value) |
188 | { | 188 | { |
189 | if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID | 189 | if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID |
190 | || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) { | 190 | || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) { |
191 | switch (value) { | 191 | switch (value) { |
192 | case B300: return 0x01; | 192 | case 300: return 0x01; |
193 | case B600: return 0x02; /* this one not tested */ | 193 | case 600: return 0x02; /* this one not tested */ |
194 | case B1200: return 0x03; | 194 | case 1200: return 0x03; |
195 | case B2400: return 0x04; | 195 | case 2400: return 0x04; |
196 | case B4800: return 0x06; | 196 | case 4800: return 0x06; |
197 | case B9600: return 0x08; | 197 | case 9600: return 0x08; |
198 | case B19200: return 0x09; | 198 | case 19200: return 0x09; |
199 | case B38400: return 0x0a; | 199 | case 38400: return 0x0a; |
200 | case B57600: return 0x0b; | 200 | case 57600: return 0x0b; |
201 | case B115200: return 0x0c; | 201 | case 115200: return 0x0c; |
202 | default: | 202 | default: |
203 | err("MCT USB-RS232: unsupported baudrate request 0x%x," | 203 | err("MCT USB-RS232: unsupported baudrate request 0x%x," |
204 | " using default of B9600", value); | 204 | " using default of B9600", value); |
@@ -206,27 +206,27 @@ static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value) | |||
206 | } | 206 | } |
207 | } else { | 207 | } else { |
208 | switch (value) { | 208 | switch (value) { |
209 | case B300: value = 300; break; | 209 | case 300: break; |
210 | case B600: value = 600; break; | 210 | case 600: break; |
211 | case B1200: value = 1200; break; | 211 | case 1200: break; |
212 | case B2400: value = 2400; break; | 212 | case 2400: break; |
213 | case B4800: value = 4800; break; | 213 | case 4800: break; |
214 | case B9600: value = 9600; break; | 214 | case 9600: break; |
215 | case B19200: value = 19200; break; | 215 | case 19200: break; |
216 | case B38400: value = 38400; break; | 216 | case 38400: break; |
217 | case B57600: value = 57600; break; | 217 | case 57600: break; |
218 | case B115200: value = 115200; break; | 218 | case 115200: break; |
219 | default: | 219 | default: |
220 | err("MCT USB-RS232: unsupported baudrate request 0x%x," | 220 | err("MCT USB-RS232: unsupported baudrate request 0x%x," |
221 | " using default of B9600", value); | 221 | " using default of B9600", value); |
222 | value = 9600; | 222 | value = 9600; |
223 | } | 223 | } |
224 | return 115200/value; | 224 | return 115200/value; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port, | 228 | static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port, |
229 | int value) | 229 | speed_t value) |
230 | { | 230 | { |
231 | __le32 divisor; | 231 | __le32 divisor; |
232 | int rc; | 232 | int rc; |
@@ -634,7 +634,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port, | |||
634 | mct_u232_set_modem_ctrl(serial, control_state); | 634 | mct_u232_set_modem_ctrl(serial, control_state); |
635 | } | 635 | } |
636 | 636 | ||
637 | mct_u232_set_baud_rate(serial, port, cflag & CBAUD); | 637 | mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port->tty)); |
638 | 638 | ||
639 | if ((cflag & CBAUD) == B0 ) { | 639 | if ((cflag & CBAUD) == B0 ) { |
640 | dbg("%s: baud is B0", __FUNCTION__); | 640 | dbg("%s: baud is B0", __FUNCTION__); |
diff --git a/drivers/usb/serial/mct_u232.h b/drivers/usb/serial/mct_u232.h index a61bac8f224a..aae10c8174d6 100644 --- a/drivers/usb/serial/mct_u232.h +++ b/drivers/usb/serial/mct_u232.h | |||
@@ -79,7 +79,7 @@ | |||
79 | * and "Intel solution". They are the regular MCT and "Sitecom" for us. | 79 | * and "Intel solution". They are the regular MCT and "Sitecom" for us. |
80 | * This is pointless to document in the header, see the code for the bits. | 80 | * This is pointless to document in the header, see the code for the bits. |
81 | */ | 81 | */ |
82 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value); | 82 | static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value); |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Line Control Register (LCR) | 85 | * Line Control Register (LCR) |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 0794ccdebfd4..0bb8de4cc524 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -45,7 +45,7 @@ enum devicetype { | |||
45 | DEVICE_INSTALLER = 2, | 45 | DEVICE_INSTALLER = 2, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | int sierra_set_power_state(struct usb_device *udev, __u16 swiState) | 48 | static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) |
49 | { | 49 | { |
50 | int result; | 50 | int result; |
51 | dev_dbg(&udev->dev, "%s", "SET POWER STATE"); | 51 | dev_dbg(&udev->dev, "%s", "SET POWER STATE"); |
@@ -60,7 +60,7 @@ int sierra_set_power_state(struct usb_device *udev, __u16 swiState) | |||
60 | return result; | 60 | return result; |
61 | } | 61 | } |
62 | 62 | ||
63 | int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) | 63 | static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) |
64 | { | 64 | { |
65 | int result; | 65 | int result; |
66 | dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); | 66 | dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); |
@@ -75,7 +75,8 @@ int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) | |||
75 | return result; | 75 | return result; |
76 | } | 76 | } |
77 | 77 | ||
78 | int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id) | 78 | static int sierra_probe(struct usb_interface *iface, |
79 | const struct usb_device_id *id) | ||
79 | { | 80 | { |
80 | int result; | 81 | int result; |
81 | struct usb_device *udev; | 82 | struct usb_device *udev; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a3665659d13b..9bf01a5efc84 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = { | |||
60 | 60 | ||
61 | static int debug; | 61 | static int debug; |
62 | static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ | 62 | static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ |
63 | static spinlock_t table_lock; | 63 | static DEFINE_MUTEX(table_lock); |
64 | static LIST_HEAD(usb_serial_driver_list); | 64 | static LIST_HEAD(usb_serial_driver_list); |
65 | 65 | ||
66 | struct usb_serial *usb_serial_get_by_index(unsigned index) | 66 | struct usb_serial *usb_serial_get_by_index(unsigned index) |
67 | { | 67 | { |
68 | struct usb_serial *serial; | 68 | struct usb_serial *serial; |
69 | 69 | ||
70 | spin_lock(&table_lock); | 70 | mutex_lock(&table_lock); |
71 | serial = serial_table[index]; | 71 | serial = serial_table[index]; |
72 | 72 | ||
73 | if (serial) | 73 | if (serial) |
74 | kref_get(&serial->kref); | 74 | kref_get(&serial->kref); |
75 | spin_unlock(&table_lock); | 75 | mutex_unlock(&table_lock); |
76 | return serial; | 76 | return serial; |
77 | } | 77 | } |
78 | 78 | ||
@@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
84 | dbg("%s %d", __FUNCTION__, num_ports); | 84 | dbg("%s %d", __FUNCTION__, num_ports); |
85 | 85 | ||
86 | *minor = 0; | 86 | *minor = 0; |
87 | spin_lock(&table_lock); | 87 | mutex_lock(&table_lock); |
88 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { | 88 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { |
89 | if (serial_table[i]) | 89 | if (serial_table[i]) |
90 | continue; | 90 | continue; |
@@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
106 | serial_table[i] = serial; | 106 | serial_table[i] = serial; |
107 | serial->port[j++]->number = i; | 107 | serial->port[j++]->number = i; |
108 | } | 108 | } |
109 | spin_unlock(&table_lock); | 109 | mutex_unlock(&table_lock); |
110 | return serial; | 110 | return serial; |
111 | } | 111 | } |
112 | spin_unlock(&table_lock); | 112 | mutex_unlock(&table_lock); |
113 | return NULL; | 113 | return NULL; |
114 | } | 114 | } |
115 | 115 | ||
@@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref) | |||
172 | 172 | ||
173 | void usb_serial_put(struct usb_serial *serial) | 173 | void usb_serial_put(struct usb_serial *serial) |
174 | { | 174 | { |
175 | spin_lock(&table_lock); | 175 | mutex_lock(&table_lock); |
176 | kref_put(&serial->kref, destroy_serial); | 176 | kref_put(&serial->kref, destroy_serial); |
177 | spin_unlock(&table_lock); | 177 | mutex_unlock(&table_lock); |
178 | } | 178 | } |
179 | 179 | ||
180 | /***************************************************************************** | 180 | /***************************************************************************** |
@@ -1077,16 +1077,17 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) | |||
1077 | struct usb_serial_port *port; | 1077 | struct usb_serial_port *port; |
1078 | int i, r = 0; | 1078 | int i, r = 0; |
1079 | 1079 | ||
1080 | if (serial) { | 1080 | if (!serial) /* device has been disconnected */ |
1081 | for (i = 0; i < serial->num_ports; ++i) { | 1081 | return 0; |
1082 | port = serial->port[i]; | 1082 | |
1083 | if (port) | 1083 | for (i = 0; i < serial->num_ports; ++i) { |
1084 | kill_traffic(port); | 1084 | port = serial->port[i]; |
1085 | } | 1085 | if (port) |
1086 | kill_traffic(port); | ||
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | if (serial->type->suspend) | 1089 | if (serial->type->suspend) |
1089 | serial->type->suspend(serial, message); | 1090 | r = serial->type->suspend(serial, message); |
1090 | 1091 | ||
1091 | return r; | 1092 | return r; |
1092 | } | 1093 | } |
@@ -1128,7 +1129,6 @@ static int __init usb_serial_init(void) | |||
1128 | return -ENOMEM; | 1129 | return -ENOMEM; |
1129 | 1130 | ||
1130 | /* Initialize our global data */ | 1131 | /* Initialize our global data */ |
1131 | spin_lock_init(&table_lock); | ||
1132 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { | 1132 | for (i = 0; i < SERIAL_TTY_MINORS; ++i) { |
1133 | serial_table[i] = NULL; | 1133 | serial_table[i] = NULL; |
1134 | } | 1134 | } |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index a624e72f81dc..d8d008d42946 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -320,6 +320,13 @@ UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200, | |||
320 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 320 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
321 | US_FL_FIX_CAPACITY), | 321 | US_FL_FIX_CAPACITY), |
322 | 322 | ||
323 | /* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */ | ||
324 | UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100, | ||
325 | "NIKON", | ||
326 | "NIKON DSC D50", | ||
327 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
328 | US_FL_FIX_CAPACITY), | ||
329 | |||
323 | /* Reported by Andreas Bockhold <andreas@bockionline.de> */ | 330 | /* Reported by Andreas Bockhold <andreas@bockionline.de> */ |
324 | UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100, | 331 | UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100, |
325 | "NIKON", | 332 | "NIKON", |
@@ -1357,6 +1364,20 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, | |||
1357 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1364 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1358 | US_FL_IGNORE_RESIDUE ), | 1365 | US_FL_IGNORE_RESIDUE ), |
1359 | 1366 | ||
1367 | /* Jeremy Katz <katzj@redhat.com>: | ||
1368 | * The Blackberry Pearl can run in two modes; a usb-storage only mode | ||
1369 | * and a mode that allows access via mass storage and to its database. | ||
1370 | * The berry_charge module will set the device to dual mode and thus we | ||
1371 | * should ignore its native mode if that module is built | ||
1372 | */ | ||
1373 | #ifdef CONFIG_USB_BERRY_CHARGE | ||
1374 | UNUSUAL_DEV( 0x0fca, 0x0006, 0x0001, 0x0001, | ||
1375 | "RIM", | ||
1376 | "Blackberry Pearl", | ||
1377 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1378 | US_FL_IGNORE_DEVICE ), | ||
1379 | #endif | ||
1380 | |||
1360 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1381 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
1361 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1382 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
1362 | "Sony Ericsson", | 1383 | "Sony Ericsson", |
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h index 93e4c3a6d190..50839fe9e39e 100644 --- a/include/linux/dvb/video.h +++ b/include/linux/dvb/video.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #else | 31 | #else |
32 | #include <asm/types.h> | ||
32 | #include <stdint.h> | 33 | #include <stdint.h> |
33 | #include <time.h> | 34 | #include <time.h> |
34 | #endif | 35 | #endif |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index aa2fe22b1baa..949706c33622 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -56,6 +56,9 @@ enum kobject_action { | |||
56 | KOBJ_MAX | 56 | KOBJ_MAX |
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* The list of strings defining the valid kobject actions as specified above */ | ||
60 | extern const char *kobject_actions[]; | ||
61 | |||
59 | struct kobject { | 62 | struct kobject { |
60 | const char * k_name; | 63 | const char * k_name; |
61 | char name[KOBJ_NAME_LEN]; | 64 | char name[KOBJ_NAME_LEN]; |
@@ -108,9 +111,15 @@ struct kobj_type { | |||
108 | struct attribute ** default_attrs; | 111 | struct attribute ** default_attrs; |
109 | }; | 112 | }; |
110 | 113 | ||
114 | struct kset_uevent_ops { | ||
115 | int (*filter)(struct kset *kset, struct kobject *kobj); | ||
116 | const char *(*name)(struct kset *kset, struct kobject *kobj); | ||
117 | int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, | ||
118 | int num_envp, char *buffer, int buffer_size); | ||
119 | }; | ||
111 | 120 | ||
112 | /** | 121 | /* |
113 | * kset - a set of kobjects of a specific type, belonging | 122 | * struct kset - a set of kobjects of a specific type, belonging |
114 | * to a specific subsystem. | 123 | * to a specific subsystem. |
115 | * | 124 | * |
116 | * All kobjects of a kset should be embedded in an identical | 125 | * All kobjects of a kset should be embedded in an identical |
@@ -126,13 +135,6 @@ struct kobj_type { | |||
126 | * supress the event generation or add subsystem specific | 135 | * supress the event generation or add subsystem specific |
127 | * variables carried with the event. | 136 | * variables carried with the event. |
128 | */ | 137 | */ |
129 | struct kset_uevent_ops { | ||
130 | int (*filter)(struct kset *kset, struct kobject *kobj); | ||
131 | const char *(*name)(struct kset *kset, struct kobject *kobj); | ||
132 | int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, | ||
133 | int num_envp, char *buffer, int buffer_size); | ||
134 | }; | ||
135 | |||
136 | struct kset { | 138 | struct kset { |
137 | struct kobj_type * ktype; | 139 | struct kobj_type * ktype; |
138 | struct list_head list; | 140 | struct list_head list; |
@@ -173,7 +175,7 @@ static inline struct kobj_type * get_ktype(struct kobject * k) | |||
173 | extern struct kobject * kset_find_obj(struct kset *, const char *); | 175 | extern struct kobject * kset_find_obj(struct kset *, const char *); |
174 | 176 | ||
175 | 177 | ||
176 | /** | 178 | /* |
177 | * Use this when initializing an embedded kset with no other | 179 | * Use this when initializing an embedded kset with no other |
178 | * fields to initialize. | 180 | * fields to initialize. |
179 | */ | 181 | */ |
@@ -198,7 +200,7 @@ extern struct kset kernel_subsys; | |||
198 | /* The global /sys/hypervisor/ subsystem */ | 200 | /* The global /sys/hypervisor/ subsystem */ |
199 | extern struct kset hypervisor_subsys; | 201 | extern struct kset hypervisor_subsys; |
200 | 202 | ||
201 | /** | 203 | /* |
202 | * Helpers for setting the kset of registered objects. | 204 | * Helpers for setting the kset of registered objects. |
203 | * Often, a registered object belongs to a kset embedded in a | 205 | * Often, a registered object belongs to a kset embedded in a |
204 | * subsystem. These do no magic, just make the resulting code | 206 | * subsystem. These do no magic, just make the resulting code |
@@ -233,7 +235,7 @@ extern struct kset hypervisor_subsys; | |||
233 | /** | 235 | /** |
234 | * subsys_set_kset(obj,subsys) - set kset for subsystem | 236 | * subsys_set_kset(obj,subsys) - set kset for subsystem |
235 | * @obj: ptr to some object type. | 237 | * @obj: ptr to some object type. |
236 | * @subsys: a subsystem object (not a ptr). | 238 | * @_subsys: a subsystem object (not a ptr). |
237 | * | 239 | * |
238 | * Can be used for any object type with an embedded ->subsys. | 240 | * Can be used for any object type with an embedded ->subsys. |
239 | * Sets the kset of @obj's kobject to @subsys.kset. This makes | 241 | * Sets the kset of @obj's kobject to @subsys.kset. This makes |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 7a60946df3b6..4f33a58fa9d1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -94,6 +94,7 @@ enum usb_interface_condition { | |||
94 | * endpoint configurations. They will be in no particular order. | 94 | * endpoint configurations. They will be in no particular order. |
95 | * @num_altsetting: number of altsettings defined. | 95 | * @num_altsetting: number of altsettings defined. |
96 | * @cur_altsetting: the current altsetting. | 96 | * @cur_altsetting: the current altsetting. |
97 | * @intf_assoc: interface association descriptor | ||
97 | * @driver: the USB driver that is bound to this interface. | 98 | * @driver: the USB driver that is bound to this interface. |
98 | * @minor: the minor number assigned to this interface, if this | 99 | * @minor: the minor number assigned to this interface, if this |
99 | * interface is bound to a driver that uses the USB major number. | 100 | * interface is bound to a driver that uses the USB major number. |
@@ -213,6 +214,7 @@ struct usb_interface_cache { | |||
213 | * @desc: the device's configuration descriptor. | 214 | * @desc: the device's configuration descriptor. |
214 | * @string: pointer to the cached version of the iConfiguration string, if | 215 | * @string: pointer to the cached version of the iConfiguration string, if |
215 | * present for this configuration. | 216 | * present for this configuration. |
217 | * @intf_assoc: list of any interface association descriptors in this config | ||
216 | * @interface: array of pointers to usb_interface structures, one for each | 218 | * @interface: array of pointers to usb_interface structures, one for each |
217 | * interface in the configuration. The number of interfaces is stored | 219 | * interface in the configuration. The number of interfaces is stored |
218 | * in desc.bNumInterfaces. These pointers are valid only while the | 220 | * in desc.bNumInterfaces. These pointers are valid only while the |
diff --git a/kernel/params.c b/kernel/params.c index effbaaedd7f3..4e57732fcfb4 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -567,7 +567,12 @@ static void __init kernel_param_sysfs_setup(const char *name, | |||
567 | kobject_set_name(&mk->kobj, name); | 567 | kobject_set_name(&mk->kobj, name); |
568 | kobject_init(&mk->kobj); | 568 | kobject_init(&mk->kobj); |
569 | ret = kobject_add(&mk->kobj); | 569 | ret = kobject_add(&mk->kobj); |
570 | BUG_ON(ret < 0); | 570 | if (ret) { |
571 | printk(KERN_ERR "Module '%s' failed to be added to sysfs, " | ||
572 | "error number %d\n", name, ret); | ||
573 | printk(KERN_ERR "The system will be unstable now.\n"); | ||
574 | return; | ||
575 | } | ||
571 | param_sysfs_setup(mk, kparam, num_params, name_skip); | 576 | param_sysfs_setup(mk, kparam, num_params, name_skip); |
572 | kobject_uevent(&mk->kobj, KOBJ_ADD); | 577 | kobject_uevent(&mk->kobj, KOBJ_ADD); |
573 | } | 578 | } |
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 6a80c784a8fb..df02814699d7 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -25,14 +25,6 @@ | |||
25 | #define BUFFER_SIZE 2048 /* buffer for the variables */ | 25 | #define BUFFER_SIZE 2048 /* buffer for the variables */ |
26 | #define NUM_ENVP 32 /* number of env pointers */ | 26 | #define NUM_ENVP 32 /* number of env pointers */ |
27 | 27 | ||
28 | #if defined(CONFIG_HOTPLUG) | ||
29 | u64 uevent_seqnum; | ||
30 | char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug"; | ||
31 | static DEFINE_SPINLOCK(sequence_lock); | ||
32 | #if defined(CONFIG_NET) | ||
33 | static struct sock *uevent_sock; | ||
34 | #endif | ||
35 | |||
36 | /* the strings here must match the enum in include/linux/kobject.h */ | 28 | /* the strings here must match the enum in include/linux/kobject.h */ |
37 | const char *kobject_actions[] = { | 29 | const char *kobject_actions[] = { |
38 | "add", | 30 | "add", |
@@ -43,6 +35,14 @@ const char *kobject_actions[] = { | |||
43 | "offline", | 35 | "offline", |
44 | }; | 36 | }; |
45 | 37 | ||
38 | #if defined(CONFIG_HOTPLUG) | ||
39 | u64 uevent_seqnum; | ||
40 | char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug"; | ||
41 | static DEFINE_SPINLOCK(sequence_lock); | ||
42 | #if defined(CONFIG_NET) | ||
43 | static struct sock *uevent_sock; | ||
44 | #endif | ||
45 | |||
46 | /** | 46 | /** |
47 | * kobject_uevent_env - send an uevent with environmental data | 47 | * kobject_uevent_env - send an uevent with environmental data |
48 | * | 48 | * |
@@ -1131,6 +1131,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page) | |||
1131 | slab_pad_check(s, page); | 1131 | slab_pad_check(s, page); |
1132 | for_each_object(p, s, page_address(page)) | 1132 | for_each_object(p, s, page_address(page)) |
1133 | check_object(s, page, p, 0); | 1133 | check_object(s, page, p, 0); |
1134 | ClearSlabDebug(page); | ||
1134 | } | 1135 | } |
1135 | 1136 | ||
1136 | mod_zone_page_state(page_zone(page), | 1137 | mod_zone_page_state(page_zone(page), |
@@ -1169,7 +1170,6 @@ static void discard_slab(struct kmem_cache *s, struct page *page) | |||
1169 | 1170 | ||
1170 | atomic_long_dec(&n->nr_slabs); | 1171 | atomic_long_dec(&n->nr_slabs); |
1171 | reset_page_mapcount(page); | 1172 | reset_page_mapcount(page); |
1172 | ClearSlabDebug(page); | ||
1173 | __ClearPageSlab(page); | 1173 | __ClearPageSlab(page); |
1174 | free_slab(s, page); | 1174 | free_slab(s, page); |
1175 | } | 1175 | } |
@@ -1656,6 +1656,7 @@ static void __always_inline slab_free(struct kmem_cache *s, | |||
1656 | unsigned long flags; | 1656 | unsigned long flags; |
1657 | 1657 | ||
1658 | local_irq_save(flags); | 1658 | local_irq_save(flags); |
1659 | debug_check_no_locks_freed(object, s->objsize); | ||
1659 | if (likely(page == s->cpu_slab[smp_processor_id()] && | 1660 | if (likely(page == s->cpu_slab[smp_processor_id()] && |
1660 | !SlabDebug(page))) { | 1661 | !SlabDebug(page))) { |
1661 | object[page->offset] = page->lockless_freelist; | 1662 | object[page->offset] = page->lockless_freelist; |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 6523ba07db96..188c7cf21b82 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -781,6 +781,8 @@ static struct pci_device_id snd_bt87x_ids[] = { | |||
781 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, 0x0070, 0x13eb, 32000), | 781 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, 0x0070, 0x13eb, 32000), |
782 | /* Viewcast Osprey 200 */ | 782 | /* Viewcast Osprey 200 */ |
783 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff01, 44100), | 783 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff01, 44100), |
784 | /* Viewcast Osprey 440 (rate is configurable via gpio) */ | ||
785 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff07, 32000), | ||
784 | /* ATI TV-Wonder */ | 786 | /* ATI TV-Wonder */ |
785 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, 32000), | 787 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, 32000), |
786 | /* Leadtek Winfast tv 2000xp delux */ | 788 | /* Leadtek Winfast tv 2000xp delux */ |