driver core merge for .40
Subsystems (12)
PATCH 1/1 driver core merge for .40
Here's the "big" driver core merge for the .40 tree.
Not much for the driver core itself, but there is some firmware driver work, documentation updates and a new translation added. Nothing major.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/ driver-core-next
All of these patches have been in the linux-next and mm trees for a while now.
The patches will be sent as a follow-on to this message to lkml for people to see.
thanks,
greg k-h
------------
Documentation/ABI/testing/sysfs-firmware-dmi | 18 +- Documentation/ABI/testing/sysfs-firmware-gsmi | 58 ++ Documentation/ABI/testing/sysfs-firmware-log | 7 + Documentation/ABI/testing/sysfs-kernel-fscaps | 8 + Documentation/DocBook/device-drivers.tmpl | 6 +- Documentation/driver-model/bus.txt | 19 +- Documentation/driver-model/class.txt | 17 +- Documentation/driver-model/device.txt | 91 +--- Documentation/driver-model/driver.txt | 18 +- Documentation/ja_JP/HOWTO | 129 ++--- Documentation/zh_CN/email-clients.txt | 210 ++++++ arch/arm/kernel/traps.c | 1 - arch/powerpc/kernel/traps.c | 1 - arch/sh/kernel/traps_32.c | 1 - arch/unicore32/kernel/traps.c | 1 - arch/x86/include/asm/bios_ebda.h | 28 +- arch/x86/kernel/dumpstack.c | 1 - drivers/base/core.c | 7 +- drivers/base/dd.c | 12 +- drivers/base/memory.c | 29 +- drivers/base/platform.c | 38 +- drivers/char/Kconfig | 2 +- drivers/char/mem.c | 42 +- drivers/char/raw.c | 34 +- drivers/firmware/Kconfig | 2 + drivers/firmware/Makefile | 2 + drivers/firmware/efivars.c | 21 +- drivers/firmware/google/Kconfig | 31 + drivers/firmware/google/Makefile | 3 + drivers/firmware/google/gsmi.c | 940 +++++++++++++++++++++++++ drivers/firmware/google/memconsole.c | 166 +++++ drivers/misc/ti-st/Kconfig | 2 +- drivers/misc/ti-st/st_core.c | 23 +- drivers/misc/ti-st/st_kim.c | 1 + drivers/uio/uio.c | 16 +- drivers/uio/uio_netx.c | 19 + drivers/uio/uio_pdrv_genirq.c | 4 + fs/debugfs/file.c | 19 +- fs/sysfs/file.c | 12 - fs/sysfs/group.c | 6 +- include/linux/device.h | 164 +++++- include/linux/string.h | 1 + include/linux/sysfs.h | 5 - include/linux/ti_wilink_st.h | 3 +- kernel/ksysfs.c | 10 + kernel/params.c | 14 +- kernel/sys.c | 2 + lib/string.c | 29 + 48 files changed, 1885 insertions(+), 388 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-gsmi create mode 100644 Documentation/ABI/testing/sysfs-firmware-log create mode 100644 Documentation/ABI/testing/sysfs-kernel-fscaps create mode 100644 Documentation/zh_CN/email-clients.txt create mode 100644 drivers/firmware/google/Kconfig create mode 100644 drivers/firmware/google/Makefile create mode 100644 drivers/firmware/google/gsmi.c create mode 100644 drivers/firmware/google/memconsole.c
---------------
Andrew Morton (2):
kmsg: properly support writev to avoid interleaved printk lines fix
drivers/base/memory.c: fix warning due to "memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION"
Anton Blanchard (1):
memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION
Dan Carpenter (2):
efivars: memory leak on error in create_efivars_bin_attributes()
efivars: handle errors from register_efivars()
Daniel Trautmann (1):
uio_netx: Add support for netPLC cards
Felipe Balbi (1):
device: add dev_WARN_ONCE
Greg Kroah-Hartman (1):
sysfs: remove "last sysfs file:" line from the oops messages
Harry Wei (1):
Translated Documentation/email-clients.txt
Hillf Danton (2):
uio: fix finding mm index for vma
uio: fix allocating minor id for uio device
Jan Kara (1):
Allow setting of number of raw devices as a module parameter
Jie Zhou (1):
uio: clean uioinfo when uninstall uio driver
Jonathan Cameron (3):
Add a strtobool function matching semantics of existing in kernel equivalents
debugfs: move to new strtobool
params.c: Use new strtobool function to process boolean inputs
Karthigan Srinivasan (1):
drivers/base/core.c: Fixed brace coding style issue.
Kay Sievers (2):
printk: /dev/kmsg - properly support writev() to avoid interleaved printk() lines
reboot: disable usermodehelper to prevent fs access
Ludwig Nussel (1):
kernel/ksysfs.c: expose file_caps_enabled in sysfs
Mike Waychison (6):
firmware: Fix grammar in sysfs-firmware-dmi doc
x86: get_bios_ebda_length()
x86: Better comments for get_bios_ebda()
driver: Google EFI SMI
driver: Google Memory Console
Introduce CONFIG_GOOGLE_FIRMWARE
Pavan Savoy (2):
drivers:misc:ti-st: handle delayed tty receive drivers:misc:ti-st: remove rfkill dependency
Randy Dunlap (2):
misc: fix ti-st build issues
efivars: prevent oops on unload when efi is not enabled
Robert P. J. Day (2):
RAW driver: Remove call to kobject_put().
SYSFS: Fix erroneous comments for sysfs_update_group().
Sebastian Ott (1):
driver-core: fix race between device_register and driver_register
Stephen Boyd (1):
debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
Stephen Hemminger (1):
drivers: make device_type const
Tsugikazu Shibata (1):
HOWTO: sync up Documentaion/ja_JP/HOWTO
Uwe Kleine-König (5):
driver core/platform_device_add_data: set platform_data to NULL if !data driver core/platform_device_add_data: free platform data before overwriting driver core/platform_device_add_resources: set resource to NULL if !res driver core/platform_device_add_resources: free resource before overwriting driver core: let dev_set_drvdata return int instead of void as it can fail
Wanlong Gao (3):
drivers:base:fix the coding format of memory.c
driver core: Add the device driver-model structures to kerneldoc driver core: remove the driver-model structures from the documentation
PATCH 1/44 device: add dev_WARN_ONCE
From: Felipe Balbi <[email protected]>
it's quite useful to print the device name on the stack dump caused by WARN(), but there are other cases where we might want to use WARN_ONCE.
Introduce a helper similar to dev_WARN() for that case too.
--- include/linux/device.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
include/linux/device.h +5 -1
@@ -742,13 +742,17 @@ do { \#endif /* -* dev_WARN() acts like dev_printk(), but with the key difference +* dev_WARN*() acts like dev_printk(), but with the key difference * of using a WARN/WARN_ON to get the message out, including the * file/line information and a backtrace. */ #define dev_WARN(dev, format, arg...) \ WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); +#define dev_WARN_ONCE(dev, condition, format, arg...) \ + WARN_ONCE(condition, "Device %s\n" format, \ + dev_driver_string(dev), ## arg) +/* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV (major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
1.7.4.2
PATCH 2/44 efivars: memory leak on error in create_efivars_bin_attributes()
From: Dan Carpenter <[email protected]>
This is a cut and paste bug. We intended to free ->del_var and ->new_var but we only free ->new_var.
--- drivers/firmware/efivars.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efivars.c +2 -2
@@ -677,8 +677,8 @@ create_efivars_bin_attributes(struct efivars *efivars)return 0 ; out_free: -kfree (efivars->new_var); - efivars->new_var =NULL ; +kfree (efivars->del_var); + efivars->del_var =NULL ;kfree (efivars->new_var); efivars->new_var =NULL ;return error;
Signature · 1 line
1.7.4.2
PATCH 3/44 efivars: handle errors from register_efivars()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
We should unwind and return an error if register_efivars() fails.
--- drivers/firmware/efivars.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/firmware/efivars.c +9 -2
@@ -803,6 +803,8 @@ efivars_init(void) ops.set_variable = efi.set_variable; ops.get_next_variable = efi.get_next_variable; error =register_efivars (&__efivars, &ops, efi_kobj); +if (error) + goto err_put;/* Don't forget the systab entry */ error =sysfs_create_group (efi_kobj, &efi_subsys_attr_group);
@@ -810,10 +812,15 @@ efivars_init(void)printk (KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n" , error); -unregister_efivars (&__efivars); -kobject_put (efi_kobj); + goto err_unregister; } +return 0 ; + +err_unregister: +unregister_efivars (&__efivars); +err_put: +kobject_put (efi_kobj);return error; }
Signature · 1 line
1.7.4.2
PATCH 4/44 firmware: Fix grammar in sysfs-firmware-dmi doc
In reply to Greg Kroah-HartmanFrom: Mike Waychison <[email protected]>
Fix the grammar in describing the position attribute of DMI entries in the dmi-sysfs module. While here, make a couple other small clarifying fixups to the docs.
--- Documentation/ABI/testing/sysfs-firmware-dmi | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
Documentation/ABI/testing/sysfs-firmware-dmi +9 -9
@@ -14,14 +14,15 @@ Description: DMI is structured as a large table of entries, where each entry has a common header indicating the type and - length of the entry, as well as 'handle' that is - supposed to be unique amongst all entries. + length of the entry, as well as a firmware-provided + 'handle' that is supposed to be unique amongst all + entries. Some entries are required by the specification, but many others are optional. In general though, users should never expect to find a specific entry type on their system unless they know for certain what their firmware - is doing. Machine to machine will vary. + is doing. Machine to machine experiences will vary. Multiple entries of the same type are allowed. In order to handle these duplicate entry types, each entry is
@@ -67,25 +68,24 @@ Description: and the two terminating nul characters. type : The type of the entry. This value is the same as found in the directory name. It indicates - how the rest of the entry should be - interpreted. + how the rest of the entry should be interpreted. instance: The instance ordinal of the entry for the given type. This value is the same as found in the parent directory name. - position: The position of the entry within the entirety - of the entirety. + position: The ordinal position (zero-based) of the entry + within the entirety of the DMI entry table. === Entry Specialization === Some entry types may have other information available in - sysfs. + sysfs. Not all types are specialized. --- Type 15 - System Event Log --- This entry allows the firmware to export a log of events the system has taken. This information is typically backed by nvram, but the implementation - details are abstracted by this table. This entries data + details are abstracted by this table. This entry's data is exported in the directory: /sys/firmware/dmi/entries/15-0/system_event_log
Signature · 1 line
1.7.4.2
PATCH 5/44 drivers: make device_type const
In reply to Greg Kroah-HartmanFrom: Stephen Hemminger <[email protected]>
The device_type structure does not contain data that changes during usage and should be const. This allows devices to declare the struct const.
I have patches to change all the subsystems, but need the infra structure change first.
--- drivers/base/core.c | 4 ++-- include/linux/device.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/core.c +2 -2
@@ -400,7 +400,7 @@ static void device_remove_groups(struct device *dev,static int device_add_attrs (struct device *dev) {struct class *class = dev->class; -struct device_type *type = dev->type; +const struct device_type *type = dev->type;int error;if (class) {
@@ -440,7 +440,7 @@ static int device_add_attrs(struct device *dev)static void device_remove_attrs (struct device *dev) {struct class *class = dev->class; -struct device_type *type = dev->type; +const struct device_type *type = dev->type;device_remove_groups (dev, dev->groups);
include/linux/device.h +1 -1
@@ -408,7 +408,7 @@ struct device {struct kobject kobj;const char *init_name;/* initial name of the device */ -struct device_type *type; +const struct device_type *type;struct mutex mutex;/* mutex to synchronize calls to * its driver.
Signature · 1 line
1.7.4.2
PATCH 6/44 kernel/ksysfs.c: expose file_caps_enabled in sysfs
In reply to Greg Kroah-HartmanFrom: Ludwig Nussel <[email protected]>
A kernel booted with no_file_caps allows to install fscaps on a binary but doesn't actually honor the fscaps when running the binary. Userspace currently has no sane way to determine whether installing fscaps actually has any effect. Since parsing /proc/cmdline is fragile this patch exposes the current setting (1 or 0) via /sys/kernel/fscaps
--- Documentation/ABI/testing/sysfs-kernel-fscaps | 8 ++++++++ kernel/ksysfs.c | 10 ++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-kernel-fscaps
Documentation/ABI/testing/sysfs-kernel-fscaps new file +8 -0
@@ -0,0 +1,8 @@ +What: /sys/kernel/fscaps +Date: February 2011 +KernelVersion: 2.6.38 +Contact: Ludwig Nussel <[email protected]> +Description + Shows whether file system capabilities are honored + when executing a binary +
kernel/ksysfs.c +10 -0
@@ -16,6 +16,7 @@#include <linux/kexec.h> #include <linux/profile.h> #include <linux/sched.h> +#include <linux/capability.h> #define KERNEL_ATTR_RO (_name) \ static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
@@ -131,6 +132,14 @@ KERNEL_ATTR_RO(vmcoreinfo);#endif /* CONFIG_KEXEC */ +/* whether file capabilities are enabled */ +static ssize_t fscaps_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) +{ +return sprintf (buf,"%d\n" , file_caps_enabled); +} +KERNEL_ATTR_RO (fscaps); +/* * Make /sys/kernel/notes give the raw contents of our kernel .notes section. */
@@ -158,6 +167,7 @@ struct kobject *kernel_kobj;EXPORT_SYMBOL_GPL (kernel_kobj);static struct attribute * kernel_attrs[] = { + &fscaps_attr.attr, #if defined(CONFIG_HOTPLUG) &uevent_seqnum_attr.attr, &uevent_helper_attr.attr,
Signature · 1 line
1.7.4.2
PATCH 7/44 HOWTO: sync up Documentaion/ja_JP/HOWTO
In reply to Greg Kroah-HartmanFrom: Tsugikazu Shibata <[email protected]>
--- Documentation/ja_JP/HOWTO | 129 +++++++++++++++------------------------------ 1 files changed, 43 insertions(+), 86 deletions(-)
Documentation/ja_JP/HOWTO +43 -86
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a fork. So if you have any comments or updates for this file, please try to update the original English file first. -Last Updated: 2008/10/24 +Last Updated: 2011/03/31 ================================== これは、 -linux-2.6.28/Documentation/HOWTO +linux-2.6.38/Documentation/HOWTO の和訳です。 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > -翻訳日: 2008/10/24 +翻訳日: 2011/3/28 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 校正者: 松倉さん <nbh--mats at nifty dot com> 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
@@ -256,8 +256,8 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン - メインの 2.6.x カーネルツリー - 2.6.x.y -stable カーネルツリー - 2.6.x -git カーネルパッチ - - 2.6.x -mm カーネルパッチ - サブシステム毎のカーネルツリーとパッチ + - 統合テストのための 2.6.x -next カーネルツリー 2.6.x カーネルツリー -----------------
@@ -268,9 +268,9 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン - 新しいカーネルがリリースされた直後に、2週間の特別期間が設けられ、 この期間中に、メンテナ達は Linus に大きな差分を送ることができます。 - このような差分は通常 -mm カーネルに数週間含まれてきたパッチです。 + このような差分は通常 -next カーネルに数週間含まれてきたパッチです。 大きな変更は git(カーネルのソース管理ツール、詳細は - http://git.or.cz/ 参照) を使って送るのが好ましいやり方ですが、パッ + http://git-scm.com/ 参照) を使って送るのが好ましいやり方ですが、パッ チファイルの形式のまま送るのでも十分です。 - 2週間後、-rc1 カーネルがリリースされ、この後にはカーネル全体の安定
@@ -333,86 +333,44 @@ git リポジトリで管理されているLinus のカーネルツリーの毎 れは -rc カーネルと比べて、パッチが大丈夫かどうかも確認しないで自動的 に生成されるので、より実験的です。 -2.6.x -mm カーネルパッチ ------------------------- - -Andrew Morton によってリリースされる実験的なカーネルパッチ群です。 -Andrew は個別のサブシステムカーネルツリーとパッチを全て集めてきて -linux-kernel メーリングリストで収集された多数のパッチと同時に一つにま -とめます。 -このツリーは新機能とパッチが検証される場となります。ある期間の間パッチ -が -mm に入って価値を証明されたら、Andrew やサブシステムメンテナが、 -メインラインへ入れるように Linus にプッシュします。 - -メインカーネルツリーに含めるために Linus に送る前に、すべての新しいパッ -チが -mm ツリーでテストされることが強く推奨されています。マージウィン -ドウが開く前に -mm ツリーに現れなかったパッチはメインラインにマージさ -れることは困難になります。 - -これらのカーネルは安定して動作すべきシステムとして使うのには適切ではあ -りませんし、カーネルブランチの中でももっとも動作にリスクが高いものです。 - -もしあなたが、カーネル開発プロセスの支援をしたいと思っているのであれば、 -どうぞこれらのカーネルリリースをテストに使ってみて、そしてもし問題があ -れば、またもし全てが正しく動作したとしても、linux-kernel メーリングリ -ストにフィードバックを提供してください。 - -すべての他の実験的パッチに加えて、これらのカーネルは通常リリース時点で -メインラインの -git カーネルに含まれる全ての変更も含んでいます。 - --mm カーネルは決まったスケジュールではリリースされません、しかし通常幾 -つかの -mm カーネル (1 から 3 が普通)が各-rc カーネルの間にリリースさ -れます。 - サブシステム毎のカーネルツリーとパッチ ------------------------------------------- -カーネルの様々な領域で何が起きているかを見られるようにするため、多くの -カーネルサブシステム開発者は彼らの開発ツリーを公開しています。これらの -ツリーは説明したように -mm カーネルリリースに入れ込まれます。 - -以下はさまざまなカーネルツリーの中のいくつかのリスト- - - git ツリー- - - Kbuild の開発ツリー、Sam Ravnborg <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git - - - ACPI の開発ツリー、 Len Brown <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git - - - Block の開発ツリー、Jens Axboe <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git - - - DRM の開発ツリー、Dave Airlie <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git - - - ia64 の開発ツリー、Tony Luck <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git - - - infiniband, Roland Dreier <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git - - - libata, Jeff Garzik <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git - - - ネットワークドライバ, Jeff Garzik <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git - - - pcmcia, Dominik Brodowski <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git - - - SCSI, James Bottomley <[email protected]> - git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git - - - x86, Ingo Molnar <[email protected]> - git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git - - quilt ツリー- - - USB, ドライバコアと I2C, Greg Kroah-Hartman <[email protected]> - kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ +それぞれのカーネルサブシステムのメンテナ達は --- そして多くのカーネル +サブシステムの開発者達も --- 各自の最新の開発状況をソースリポジトリに +公開しています。そのため、自分とは異なる領域のカーネルで何が起きている +かを他の人が見られるようになっています。開発が早く進んでいる領域では、 +開発者は自身の投稿がどのサブシステムカーネルツリーを元にしているか質問 +されるので、その投稿とすでに進行中の他の作業との衝突が避けられます。 + +大部分のこれらのリポジトリは git ツリーです。しかしその他の SCM や +quilt シリーズとして公開されているパッチキューも使われています。これら +のサブシステムリポジトリのアドレスは MAINTAINERS ファイルにリストされ +ています。これらの多くは http://git.kernel.org/ で参照することができま +す。 - その他のカーネルツリーは http://git.kernel.org/ と MAINTAINERS ファ - イルに一覧表があります。 +提案されたパッチがこのようなサブシステムツリーにコミットされる前に、メー +リングリストで事前にレビューにかけられます(以下の対応するセクションを +参照)。いくつかのカーネルサブシステムでは、このレビューは patchwork +というツールによって追跡されます。Patchwork は web インターフェイスに +よってパッチ投稿の表示、パッチへのコメント付けや改訂などができ、そして +メンテナはパッチに対して、レビュー中、受付済み、拒否というようなマーク +をつけることができます。大部分のこれらの patchwork のサイトは +http://patchwork.kernel.org/ でリストされています。 + +統合テストのための 2.6.x -next カーネルツリー +--------------------------------------------- + +サブシステムツリーの更新内容がメインラインの 2.6.x ツリーにマージされ +る前に、それらは統合テストされる必要があります。この目的のため、実質的 +に全サブシステムツリーからほぼ毎日プルされてできる特別なテスト用のリ +ポジトリが存在します- + http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git + http://linux.f-seidel.de/linux-next/pmwiki/ + +このやり方によって、-next カーネルは次のマージ機会でどんなものがメイン +ラインカーネルにマージされるか、おおまかなの展望を提供します。-next +カーネルの実行テストを行う冒険好きなテスターは大いに歓迎されます バグレポート -------------
@@ -673,10 +631,9 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を じところからスタートしたのですから。 Paolo Ciarrocchi に感謝、彼は彼の書いた "Development Process" -(http://linux.tar.bz/articles/2.6-development_process)セクショ -ンをこのテキストの原型にすることを許可してくれました。 -Rundy Dunlap と Gerrit Huizenga はメーリングリストでやるべきこととやっ -てはいけないことのリストを提供してくれました。 +(http://lwn.net/Articles/94386/) セクションをこのテキストの原型にする +ことを許可してくれました。Rundy Dunlap と Gerrit Huizenga はメーリング +リストでやるべきこととやってはいけないことのリストを提供してくれました。 以下の人々のレビュー、コメント、貢献に感謝。 Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers, Vojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi
Signature · 1 line
1.7.4.2
PATCH 8/44 uio_netx: Add support for netPLC cards
In reply to Greg Kroah-HartmanFrom: Daniel Trautmann <[email protected]>
This patch adds support for Hilscher / IBHsoftec netPLC cards to uio_netx userspace IO driver.
Changes from v1 -> v2:
Fixed whitespace errors reported by scripts/checkpatch.pl which were caused by email client.
--- drivers/uio/uio_netx.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/uio/uio_netx.c +19 -0
@@ -18,6 +18,9 @@#define PCI_VENDOR_ID_HILSCHER 0x15CF#define PCI_DEVICE_ID_HILSCHER_NETX 0x0000 +#define PCI_DEVICE_ID_HILSCHER_NETPLC 0x0010 +#define PCI_SUBDEVICE_ID_NETPLC_RAM 0x0000 +#define PCI_SUBDEVICE_ID_NETPLC_FLASH 0x0001#define PCI_SUBDEVICE_ID_NXSB_PCA 0x3235#define PCI_SUBDEVICE_ID_NXPCA 0x3335
@@ -66,6 +69,10 @@ static int __devinit netx_pci_probe(struct pci_dev *dev, bar =0 ; info->name ="netx" ;break ; +case PCI_DEVICE_ID_HILSCHER_NETPLC : + bar =0 ; + info->name ="netplc" ; +break ;default : bar =2 ; info->name ="netx_plx" ;
@@ -134,6 +141,18 @@ static struct pci_device_id netx_pci_ids[] = { .subdevice = 0, }, { + .vendor = PCI_VENDOR_ID_HILSCHER, + .device = PCI_DEVICE_ID_HILSCHER_NETPLC, + .subvendor = PCI_VENDOR_ID_HILSCHER, + .subdevice = PCI_SUBDEVICE_ID_NETPLC_RAM, + }, + { + .vendor = PCI_VENDOR_ID_HILSCHER, + .device = PCI_DEVICE_ID_HILSCHER_NETPLC, + .subvendor = PCI_VENDOR_ID_HILSCHER, + .subdevice = PCI_SUBDEVICE_ID_NETPLC_FLASH, + }, + { .vendor = PCI_VENDOR_ID_PLX, .device = PCI_DEVICE_ID_PLX_9030, .subvendor = PCI_VENDOR_ID_PLX,
Signature · 1 line
1.7.4.2
PATCH 9/44 uio: fix finding mm index for vma
In reply to Greg Kroah-HartmanFrom: Hillf Danton <[email protected]>
When finding mm index for vma it looks more flexible that the mm could be sparse, and both the size of mm and the pgoff of vma could give correct selection.
--- drivers/uio/uio.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/uio/uio.c +3 -5
@@ -587,14 +587,12 @@ static ssize_t uio_write(struct file *filep, const char __user *buf,static int uio_find_mem_index (struct vm_area_struct *vma) { -int mi;struct uio_device *idev = vma->vm_private_data; -for (mi =0 ; mi <MAX_UIO_MAPS ; mi++) { -if (idev->info->mem[mi].size ==0 ) +if (vma->vm_pgoff <MAX_UIO_MAPS ) { +if (idev->info->mem[vma->vm_pgoff].size ==0 )return -1 ; -if (vma->vm_pgoff == mi) -return mi; +return (int )vma->vm_pgoff; }return -1 ; }
Signature · 1 line
1.7.4.2
PATCH 10/44 uio: fix allocating minor id for uio device
In reply to Greg Kroah-HartmanFrom: Hillf Danton <[email protected]>
The number of uio devices that could be used should be less than UIO_MAX_DEVICES by design, and this work guards any cases in which id more than UIO_MAX_DEVICES is utilized.
--- drivers/uio/uio.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/uio/uio.c +7 -1
@@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_device *idev) retval = -ENOMEM ; goto exit; } - idev->minor = id &MAX_ID_MASK ; +if (id <UIO_MAX_DEVICES ) { + idev->minor = id; + }else { +dev_err (idev->dev,"too many uio devices\n" ); + retval = -EINVAL ; +idr_remove (&uio_idr, id); + } exit:mutex_unlock (&minor_lock);return retval;
Signature · 1 line
1.7.4.2
PATCH 11/44 uio: clean uioinfo when uninstall uio driver
In reply to Greg Kroah-HartmanFrom: Jie Zhou <[email protected]>
The uioinfo should be cleaned up when uninstall, otherwise re-install failure of uio_pdrv_genirq.ko will happen.
--- drivers/uio/uio_pdrv_genirq.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/uio/uio_pdrv_genirq.c +4 -0
@@ -189,6 +189,10 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev)uio_unregister_device (priv->uioinfo);pm_runtime_disable (&pdev->dev); + + priv->uioinfo->handler =NULL ; + priv->uioinfo->irqcontrol =NULL ; +kfree (priv);return 0 ; }
Signature · 1 line
1.7.4.2
PATCH 12/44 printk: /dev/kmsg - properly support writev() to avoid interleaved printk() lines
In reply to Greg Kroah-HartmanFrom: Kay Sievers <[email protected]>
printk: /dev/kmsg - properly support writev() to avoid interleaved printk lines
We should avoid calling printk() in a loop, when we pass a single string to /dev/kmsg with writev().
--- drivers/char/mem.c | 41 ++++++++++++++++++++++++++--------------- 1 files changed, 26 insertions(+), 15 deletions(-)
drivers/char/mem.c +26 -15
@@ -806,29 +806,40 @@ static const struct file_operations oldmem_fops = { };#endif -static ssize_t kmsg_write (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) +static ssize_t kmsg_writev (struct kiocb *iocb,const struct iovec *iv, +unsigned long count,loff_t pos) { -char *tmp; -ssize_t ret; +char *line, *p; +int len, i; +ssize_t ret = -EFAULT ; - tmp =kmalloc (count +1 ,GFP_KERNEL ); -if (tmp ==NULL ) + len =iov_length (iv, count); + line = p =kmalloc (len +1 ,GFP_KERNEL ); +if (line ==NULL )return -ENOMEM ; - ret = -EFAULT ; -if (!copy_from_user (tmp, buf, count)) { - tmp[count] =0 ; - ret =printk ("%s" , tmp); -if (ret > count) -/* printk can add a prefix */ - ret = count; + +/* +* copy all vectors into a single string, to ensure we do +* not interleave our log line with other printk calls +*/ +for (i =0 ; i < count; i++) { +if (copy_from_user (p, iv[i].iov_base, iv[i].iov_len)) + goto out; + p += iv[i].iov_len; } -kfree (tmp); + p[0 ] ='\0' ; + + ret =printk ("%s" , line); +/* printk can add a prefix */ +if (ret > len) + ret = len; +out: +kfree (line);return ret; }static const struct file_operations kmsg_fops = { - .write = kmsg_write, + .aio_write = kmsg_writev, .llseek = noop_llseek, };
Signature · 1 line
1.7.4.2
PATCH 13/44 kmsg: properly support writev to avoid interleaved printk lines fix
In reply to Greg Kroah-HartmanFrom: Andrew Morton <[email protected]>
make `len' size_t, avoid multiple-assignments.
--- drivers/char/mem.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/char/mem.c +4 -3
@@ -810,11 +810,11 @@ static ssize_t kmsg_writev(struct kiocb *iocb, const struct iovec *iv, unsigned long count, loff_t pos) { char *line, *p; -int len, i; +int i;ssize_t ret = -EFAULT ; +size_t len =iov_length (iv, count); - len =iov_length (iv, count); - line = p =kmalloc (len +1 ,GFP_KERNEL ); + line =kmalloc (len +1 ,GFP_KERNEL );if (line ==NULL )return -ENOMEM ;
@@ -822,6 +822,7 @@ static ssize_t kmsg_writev(struct kiocb *iocb, const struct iovec *iv,* copy all vectors into a single string, to ensure we do * not interleave our log line with other printk calls */ + p = line;for (i =0 ; i < count; i++) {if (copy_from_user (p, iv[i].iov_base, iv[i].iov_len)) goto out;
Signature · 1 line
1.7.4.2
PATCH 14/44 drivers:misc:ti-st: handle delayed tty receive
In reply to Greg Kroah-HartmanFrom: Pavan Savoy <[email protected]>
When certain technologies shutdown their interface without waiting for the acknowledgement from the chip. The receive_buf from the TTY would be invoked a while after the relevant technology is unregistered.
This patch introduces a new flag "is_registered" which maintains the state of protocols BT, FM or GPS and thereby removes the need to clear the protocol data from ST when protocols gets unregistered.
This fixes corner cases when HCI RESET is sent down from bluetooth stack and the receive_buf is called from tty after 250ms before which bluetooth would have unregistered from the system.
OR - when FM application decides to close down the device without sending a power-off FM command resulting in some RDS data or interrupt data coming in after the driver is unregistered.
--- drivers/misc/ti-st/st_core.c | 23 +++++++++++++---------- include/linux/ti_wilink_st.h | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-)
drivers/misc/ti-st/st_core.c +13 -10
@@ -43,13 +43,15 @@ static void add_channel_to_table(struct st_data_s *st_gdata,pr_info ("%s: id %d\n" , __func__, new_proto->chnl_id);/* list now has the channel id as index itself */ st_gdata->list[new_proto->chnl_id] = new_proto; + st_gdata->is_registered[new_proto->chnl_id] = true; }static void remove_channel_from_table (struct st_data_s *st_gdata,struct st_proto_s *proto) {pr_info ("%s: id %d\n" , __func__, proto->chnl_id); - st_gdata->list[proto->chnl_id] =NULL ; +/* st_gdata->list[proto->chnl_id] = NULL; */ + st_gdata->is_registered[proto->chnl_id] = false; }/*
@@ -104,7 +106,7 @@ void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata)if (unlikely (st_gdata ==NULL || st_gdata->rx_skb ==NULL - || st_gdata->list[chnl_id] ==NULL )) { + || st_gdata->is_registered[chnl_id] == false)) {pr_err ("chnl_id %d not registered, no data to send?" , chnl_id);kfree_skb (st_gdata->rx_skb);
@@ -141,14 +143,15 @@ void st_reg_complete(struct st_data_s *st_gdata, char err)unsigned char i =0 ;pr_info (" %s " , __func__);for (i =0 ; i <ST_MAX_CHANNELS ; i++) { -if (likely (st_gdata !=NULL && st_gdata->list[i] !=NULL && - st_gdata->list[i]->reg_complete_cb !=NULL )) { +if (likely (st_gdata !=NULL && + st_gdata->is_registered[i] == true && + st_gdata->list[i]->reg_complete_cb !=NULL )) { st_gdata->list[i]->reg_complete_cb (st_gdata->list[i]->priv_data, err);pr_info ("protocol %d's cb sent %d\n" , i, err);if (err) {/* cleanup registered protocol */ st_gdata->protos_registered--; - st_gdata->list[i] =NULL ; + st_gdata->is_registered[i] = false; } } }
@@ -475,9 +478,9 @@ void kim_st_list_protocols(struct st_data_s *st_gdata, void *buf) {seq_printf (buf,"[%d]\nBT=%c\nFM=%c\nGPS=%c\n" , st_gdata->protos_registered, - st_gdata->list[0x04 ] !=NULL ?'R' :'U' , - st_gdata->list[0x08 ] !=NULL ?'R' :'U' , - st_gdata->list[0x09 ] !=NULL ?'R' :'U' ); + st_gdata->is_registered[0x04 ] == true ?'R' :'U' , + st_gdata->is_registered[0x08 ] == true ?'R' :'U' , + st_gdata->is_registered[0x09 ] == true ?'R' :'U' ); }/********************************************************************/
@@ -504,7 +507,7 @@ long st_register(struct st_proto_s *new_proto)return -EPROTONOSUPPORT ; } -if (st_gdata->list[new_proto->chnl_id] !=NULL ) { +if (st_gdata->is_registered[new_proto->chnl_id] == true) {pr_err ("chnl_id %d already registered" , new_proto->chnl_id);return -EALREADY ; }
@@ -563,7 +566,7 @@ long st_register(struct st_proto_s *new_proto)/* check for already registered once more, * since the above check is old */ -if (st_gdata->list[new_proto->chnl_id] !=NULL ) { +if (st_gdata->is_registered[new_proto->chnl_id] == true) {pr_err (" proto %d already registered " , new_proto->chnl_id);return -EALREADY ;
include/linux/ti_wilink_st.h +2 -1
@@ -140,12 +140,12 @@ extern long st_unregister(struct st_proto_s *);*/ struct st_data_s {unsigned long st_state; -struct tty_struct *tty;struct sk_buff *tx_skb;#define ST_TX_SENDING 1#define ST_TX_WAKEUP 2unsigned long tx_state;struct st_proto_s *list[ST_MAX_CHANNELS ]; +bool is_registered[ST_MAX_CHANNELS ];unsigned long rx_state;unsigned long rx_count;struct sk_buff *rx_skb;
@@ -155,6 +155,7 @@ struct st_data_s {unsigned char protos_registered;unsigned long ll_state;void *kim_data; +struct tty_struct *tty; };/*
Signature · 1 line
1.7.4.2
PATCH 15/44 drivers:misc:ti-st: remove rfkill dependency
In reply to Greg Kroah-HartmanFrom: Pavan Savoy <[email protected]>
rfkill is no longer used by Texas Instruments shared transport driver to communicate with user-space.
This patch removes the dependency of rfkill to be enabled to build shared transport driver in the Kconfig.
--- drivers/misc/ti-st/Kconfig | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/misc/ti-st/Kconfig +0 -1
@@ -5,7 +5,6 @@ menu "Texas Instruments shared transport line discipline" config TI_ST tristate "Shared transport core driver" - depends on RFKILL select FW_LOADER help This enables the shared transport core driver for TI
Signature · 1 line
1.7.4.2
PATCH 16/44 driver-core: fix race between device_register and driver_register
In reply to Greg Kroah-HartmanFrom: Sebastian Ott <[email protected]>
When a device is registered to a bus it will be a) added to the list of devices of the bus and b) bind to a driver (if one matches). As a result of a driver being registered at this bus between a) and b) this device could already be bound to a driver. This leads to a warning and incorrect refcounting.
To fix this add a check to device_attach to identify an already bound device.
--- drivers/base/dd.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/base/dd.c +5 -0
@@ -245,6 +245,10 @@ int device_attach(struct device *dev)device_lock (dev);if (dev->driver) { +if (klist_node_attached (&dev->p->knode_driver)) { + ret =1 ; + goto out_unlock; + } ret =device_bind_driver (dev);if (ret ==0 ) ret =1 ;
@@ -257,6 +261,7 @@ int device_attach(struct device *dev) ret =bus_for_each_drv (dev->bus,NULL , dev, __device_attach);pm_runtime_put_sync (dev); } +out_unlock:device_unlock (dev);return ret; }
Signature · 1 line
1.7.4.2
PATCH 17/44 drivers/base/core.c: Fixed brace coding style issue.
In reply to Greg Kroah-HartmanFrom: Karthigan Srinivasan <[email protected]>
Fixed brace coding style issue.
--- drivers/base/core.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/base/core.c +1 -2
@@ -1314,8 +1314,7 @@ EXPORT_SYMBOL_GPL(put_device);EXPORT_SYMBOL_GPL (device_create_file);EXPORT_SYMBOL_GPL (device_remove_file); -struct root_device -{ +struct root_device {struct device dev;struct module *owner; };
Signature · 1 line
1.7.4.2
PATCH 18/44 driver core/platform_device_add_data: set platform_data to NULL if !data
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
This makes the data = NULL case more consistent to the data != NULL case. The functional change is that now
platform_device_add_data(somepdev, NULL, somesize)
sets pdev->dev.platform_data to NULL instead of not touching it.
--- drivers/base/platform.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-)
drivers/base/platform.c +8 -9
@@ -220,17 +220,16 @@ EXPORT_SYMBOL_GPL(platform_device_add_resources);int platform_device_add_data (struct platform_device *pdev,const void *data,size_t size) { -void *d; +void *d =NULL ; -if (!data) -return 0 ; - - d =kmemdup (data, size,GFP_KERNEL ); -if (d) { - pdev->dev.platform_data = d; -return 0 ; +if (data) { + d =kmemdup (data, size,GFP_KERNEL ); +if (!d) +return -ENOMEM ; } -return -ENOMEM ; + + pdev->dev.platform_data = d; +return 0 ; }EXPORT_SYMBOL_GPL (platform_device_add_data);
Signature · 1 line
1.7.4.2
PATCH 19/44 driver core/platform_device_add_data: free platform data before overwriting
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
--- drivers/base/platform.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/base/platform.c +1 -0
@@ -228,6 +228,7 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,return -ENOMEM ; } +kfree (pdev->dev.platform_data); pdev->dev.platform_data = d;return 0 ; }
Signature · 1 line
1.7.4.2
PATCH 20/44 driver core/platform_device_add_resources: set resource to NULL if !res
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
This makes the res = NULL case more consistant to the res != NULL case as now both overwrite pdev->resource.
--- drivers/base/platform.c | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/base/platform.c +9 -10
@@ -192,18 +192,17 @@ EXPORT_SYMBOL_GPL(platform_device_alloc);int platform_device_add_resources (struct platform_device *pdev,const struct resource *res,unsigned int num) { -struct resource *r; +struct resource *r =NULL ; -if (!res) -return 0 ; - - r =kmemdup (res,sizeof (struct resource ) * num,GFP_KERNEL ); -if (r) { - pdev->resource = r; - pdev->num_resources = num; -return 0 ; +if (res) { + r =kmemdup (res,sizeof (struct resource ) * num,GFP_KERNEL ); +if (!r) +return -ENOMEM ; } -return -ENOMEM ; + + pdev->resource = r; + pdev->num_resources = num; +return 0 ; }EXPORT_SYMBOL_GPL (platform_device_add_resources);
Signature · 1 line
1.7.4.2
PATCH 21/44 driver core/platform_device_add_resources: free resource before overwriting
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
--- drivers/base/platform.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/base/platform.c +1 -0
@@ -200,6 +200,7 @@ int platform_device_add_resources(struct platform_device *pdev,return -ENOMEM ; } +kfree (pdev->resource); pdev->resource = r; pdev->num_resources = num;return 0 ;
Signature · 1 line
1.7.4.2
PATCH 22/44 driver core: let dev_set_drvdata return int instead of void as it can fail
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
Before commit
b402843 (Driver core: move dev_get/set_drvdata to drivers/base/dd.c)
calling dev_set_drvdata with dev=NULL was an unchecked error. After some discussion about what to return in this case removing the check (and so producing a null pointer exception) seems fine.
--- drivers/base/dd.c | 7 +++---- include/linux/device.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/base/dd.c +3 -4
@@ -413,17 +413,16 @@ void *dev_get_drvdata(const struct device *dev) }EXPORT_SYMBOL (dev_get_drvdata); -void dev_set_drvdata (struct device *dev,void *data) +int dev_set_drvdata (struct device *dev,void *data) {int error; -if (!dev) -return ;if (!dev->p) { error =device_private_init (dev);if (error) -return ; +return error; } dev->p->driver_data = data; +return 0 ; }EXPORT_SYMBOL (dev_set_drvdata);
include/linux/device.h +1 -1
@@ -557,7 +557,7 @@ extern int device_move(struct device *dev, struct device *new_parent,extern const char *device_get_devnode (struct device *dev,mode_t *mode,const char **tmp);extern void *dev_get_drvdata (const struct device *dev); -extern void dev_set_drvdata (struct device *dev,void *data); +extern int dev_set_drvdata (struct device *dev,void *data);/* * Root device objects for grouping under /sys/devices
Signature · 1 line
1.7.4.2
Re: [22/44] driver core: let dev_set_drvdata return int instead of void as it can fail
Quoted 5 lines · Greg Kroah-Hartman
From: Uwe Kleine-König <[email protected]>
Before commit
Quoted 9 lines
b402843 (Driver core: move dev_get/set_drvdata to
drivers/base/dd.c)calling
dev_set_drvdatawith dev=NULL was an unchecked error. After some discussion about what to return in this case removing the check (and so producing a null pointer exception) seems fine.Signed-off-by Uwe Kleine-König <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
I obviously didn't follow the discussions close enough and got confused[1], but I don't like the anticipated fallout of pushing this change though all the drivers. Let alone see the arguments that not being able to free the device when it fails is no reason to fail.
So, my first question is: When is it legal for a driver to set driver data before a device is registered?
I understand we can call device_initialize and then set driver and then add it to the bus, but is there ever a reason to add driver data before we call device_initialize?
And if for some obscure reason we need it early, could we instead move it to the public portion of struct device? Its not like its core data list that needs special locking.
Or ... I was going to say move the private allocation to device_initialize instead, but I see that too is void. On the other hand there are only 116 lines found by git grep device_initialize, as oposed to 3543 with set_drvdata.
AHH!
I just found this quote:
https://lkml.org/lkml/2011/4/29/57
Uwe:
Quoted 7 lines
Russell:
Quoted 3 lines
If the answer is no one, its pointless returning an error value in the first place (which I think is what the original author already thought about.)
In the meantime I learned that
dev->pis valid when the device is registered. As callingdev_set_drvdataon an unregisted device is not allowed maybe issuing a warning instead would be OK for me, too.
So why is this in the queue to be merged?
milton
[1] I scanned the commit message and saw "just dereference NULL" and didn't notice we are still changing the return type.
So we loose the check on no-mmu or archs that allow map of page 0. Where is Russell's BUG_ON_MAPPABLE_NULL?
Actually I probably read https://lkml.org/lkml/2011/4/29/57 and expected the patch in its current form to be dead.
Anyways, here is a patch for next:
Prove no driver calls dev_set_drvdata before device_add, so we can make it a full BUG_ON(!dev || !dev->p);
drivers/base/dd.c +1 -0
@@ -413,6 +413,7 @@ int dev_set_drvdata(struct device *dev,int error;if (!dev->p) { +WARN (1 ,"dev_set_drvdata called before device_add" ); error =device_private_init (dev);if (error)return error;
Re: [22/44] driver core: let dev_set_drvdata return int instead of void as it can fail
Quoted 16 lines · Milton Miller
Quoted 5 lines · Greg Kroah-Hartman
From: Uwe Kleine-König <[email protected]>
Before commit
Quoted 9 lines
b402843 (Driver core: move dev_get/set_drvdata to
drivers/base/dd.c)calling
dev_set_drvdatawith dev=NULL was an unchecked error. After some discussion about what to return in this case removing the check (and so producing a null pointer exception) seems fine.Signed-off-by Uwe Kleine-König <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 7 lines
I obviously didn't follow the discussions close enough and got confused[1], but I don't like the anticipated fallout of pushing this change though all the drivers. Let alone see the arguments that not being able to free the device when it fails is no reason to fail.
So, my first question is: When is it legal for a driver to set driver data before a device is registered?
A driver cannot set driver data on an unregistered device because it doesn't get it's hands on it before. So it's only the code that registers a device that has a chance to do so.
A while back I thought about breaking these constructs by setting driver_data to NULL before a device is handed to a driver. Never came around to make a patch tough.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 23/44 drivers:base:fix the coding format of memory.c
In reply to Greg Kroah-HartmanFrom: Wanlong Gao <[email protected]>
Fix the line longer than 80 of memory_uevent function .
--- drivers/base/memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/base/memory.c +2 -1
@@ -48,7 +48,8 @@ static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)return MEMORY_CLASS_NAME ; } -static int memory_uevent (struct kset *kset,struct kobject *obj,struct kobj_uevent_env *env) +static int memory_uevent (struct kset *kset,struct kobject *obj, +struct kobj_uevent_env *env) {int retval =0 ;
Signature · 1 line
1.7.4.2
PATCH 24/44 Add a strtobool function matching semantics of existing in kernel equivalents
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
This is a rename of the usr_strtobool proposal, which was a renamed, relocated and fixed version of previous kstrtobool RFC
--- include/linux/string.h | 1 + lib/string.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-)
include/linux/string.h +1 -0
@@ -123,6 +123,7 @@ extern char **argv_split(gfp_t gfp, const char *str, int *argcp);extern void argv_free (char **argv);extern bool sysfs_streq (const char *s1,const char *s2); +extern int strtobool (const char *s,bool *res);#ifdef CONFIG_BINARY_PRINTF int vbin_printf (u32 *bin_buf,size_t size,const char *fmt,va_list args);
lib/string.c +29 -0
@@ -535,6 +535,35 @@ bool sysfs_streq(const char *s1, const char *s2) }EXPORT_SYMBOL (sysfs_streq); +/** +* strtobool - convert common user inputs into boolean values +* @s: input string +* @res: result +* +* This routine returns 0 iff the first character is one of 'Yy1Nn0'. +* Otherwise it will return -EINVAL. Value pointed to by res is +* updated upon finding a match. +*/ +int strtobool (const char *s,bool *res) +{ +switch (s[0 ]) { +case 'y' : +case 'Y' : +case '1' : + *res = true; +break ; +case 'n' : +case 'N' : +case '0' : + *res = false; +break ; +default : +return -EINVAL ; + } +return 0 ; +} +EXPORT_SYMBOL (strtobool); +#ifndef __HAVE_ARCH_MEMSET/** * memset - Fill a region of memory with the given value
Signature · 1 line
1.7.4.2
PATCH 25/44 debugfs: move to new strtobool
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
No functional changes requires that we eat errors from strtobool. If people want to not do this, then it should be fixed at a later date.
V2: Simplification suggested by Rusty Russell removes the need for additional variable ret.
--- fs/debugfs/file.c | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-)
fs/debugfs/file.c +4 -13
@@ -429,25 +429,16 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf, {char buf[32 ];int buf_size; +bool bv;u32 *val = file->private_data; buf_size =min (count, (sizeof (buf)-1 ));if (copy_from_user (buf, user_buf, buf_size))return -EFAULT ; -switch (buf[0 ]) { -case 'y' : -case 'Y' : -case '1' : - *val =1 ; -break ; -case 'n' : -case 'N' : -case '0' : - *val =0 ; -break ; - } - +if (strtobool (buf, &bv) ==0 ) + *val = bv; +return count; }
Signature · 1 line
1.7.4.2
PATCH 26/44 params.c: Use new strtobool function to process boolean inputs
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
No functional changes.
--- kernel/params.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-)
kernel/params.c +4 -10
@@ -297,21 +297,15 @@ EXPORT_SYMBOL(param_ops_charp);int param_set_bool (const char *val,const struct kernel_param *kp) {bool v; +int ret;/* No equals means "set"... */ if (!val) val ="1" ;/* One of =[yYnN01] */ -switch (val[0 ]) { -case 'y' :case 'Y' :case '1' : - v = true; -break ; -case 'n' :case 'N' :case '0' : - v = false; -break ; -default : -return -EINVAL ; - } + ret =strtobool (val, &v); +if (ret) +return ret;if (kp->flags &KPARAM_ISBOOL ) *(bool *)kp->arg = v;
Signature · 1 line
1.7.4.2
PATCH 27/44 misc: fix ti-st build issues
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
st_drv uses skb*() interfaces, so it should depend on NET. It also uses GPIO interfaces, so it should depend on GPIOLIB.
st_kim.c uses syss_*() calls, so it should #include <linux/sysfs.h>.
Fixes these observed build errors:
ERROR: "skb_queue_purge" [drivers/misc/ti-st/st_drv.ko] undefined!
ERROR: "skb_pull" [drivers/misc/ti-st/st_drv.ko] undefined!
ERROR: "skb_queue_tail" [drivers/misc/ti-st/st_drv.ko] undefined!
ERROR: "__alloc_skb" [drivers/misc/ti-st/st_drv.ko] undefined!
ERROR: "kfree_skb" [drivers/misc/ti-st/st_drv.ko] undefined!
ERROR: "skb_dequeue" [drivers/misc/ti-st/st_drv.ko] undefined!
ERROR: "skb_put" [drivers/misc/ti-st/st_drv.ko] undefined!
--- drivers/misc/ti-st/Kconfig | 1 + drivers/misc/ti-st/st_kim.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/misc/ti-st/Kconfig +1 -0
@@ -5,6 +5,7 @@ menu "Texas Instruments shared transport line discipline" config TI_ST tristate "Shared transport core driver" + depends on NET && GPIOLIB select FW_LOADER help This enables the shared transport core driver for TI
drivers/misc/ti-st/st_kim.c +1 -0
@@ -30,6 +30,7 @@#include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/sched.h> +#include <linux/sysfs.h> #include <linux/tty.h> #include <linux/skbuff.h>
Signature · 1 line
1.7.4.2
PATCH 28/44 x86: get_bios_ebda_length()
In reply to Greg Kroah-HartmanFrom: Mike Waychison <[email protected]>
Add a wrapper routine that tells us the length of the EBDA if it is present. This guy also ensures that the returned length doesn't let the EBDA run past the 640KiB mark.
--- arch/x86/include/asm/bios_ebda.h | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
arch/x86/include/asm/bios_ebda.h +21 -0
@@ -14,6 +14,27 @@ static inline unsigned int get_bios_ebda(void)return address;/* 0 means none */ } +/* +* Return the sanitized length of the EBDA in bytes, if it exists. +*/ +static inline unsigned int get_bios_ebda_length (void ) +{ +unsigned int address; +unsigned int length; + + address =get_bios_ebda (); +if (!address) +return 0 ; + +/* EBDA length is byte 0 of the EBDA (stored in KiB) */ + length = *(unsigned char *)phys_to_virt (address); + length <<=10 ; + +/* Trim the length if it extends beyond 640KiB */ + length = min_t(unsigned int, (640 * 1024) - address, length); +return length; +} +void reserve_ebda_region (void );#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
Signature · 1 line
1.7.4.2
PATCH 29/44 x86: Better comments for get_bios_ebda()
In reply to Greg Kroah-HartmanFrom: Mike Waychison <[email protected]>
Make the comments a bit clearer for get_bios_ebda so that it actually tells us what it is returning.
--- arch/x86/include/asm/bios_ebda.h | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
arch/x86/include/asm/bios_ebda.h +5 -2
@@ -4,11 +4,14 @@#include <asm/io.h> /* -* there is a real-mode segmented pointer pointing to the -* 4K EBDA area at 0x40E. +* Returns physical address of EBDA. Returns 0 if there is no EBDA. */ static inline unsigned int get_bios_ebda (void ) { +/* +* There is a real-mode segmented pointer pointing to the +* 4K EBDA area at 0x40E. +*/ unsigned int address = *(unsigned short *)phys_to_virt (0x40E ); address <<=4 ;return address;/* 0 means none */
Signature · 1 line
1.7.4.2
PATCH 30/44 driver: Google EFI SMI
In reply to Greg Kroah-HartmanFrom: Mike Waychison <[email protected]>
The "gsmi" driver bridges userland with firmware specific routines for accessing hardware.
Currently, this driver only supports NVRAM and eventlog information. Deprecated functions have been removed from the driver, though their op-codes are left in place so that they are not re-used.
This driver works by trampolining into the firmware via the smi_command outlined in the FADT table. Three protocols are used due to various limitations over time, but all are included herein.
This driver should only ever load on Google boards, identified by either a "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEM strings of the FADT ACPI table. This logic happens in gsmi_system_valid().
--- Documentation/ABI/testing/sysfs-firmware-gsmi | 58 ++ drivers/firmware/Kconfig | 2 + drivers/firmware/Makefile | 2 + drivers/firmware/google/Kconfig | 9 + drivers/firmware/google/Makefile | 2 + drivers/firmware/google/gsmi.c | 940 +++++++++++++++++++++++++ 6 files changed, 1013 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-gsmi create mode 100644 drivers/firmware/google/Kconfig create mode 100644 drivers/firmware/google/Makefile create mode 100644 drivers/firmware/google/gsmi.c
Documentation/ABI/testing/sysfs-firmware-gsmi new file +58 -0
@@ -0,0 +1,58 @@ +What: /sys/firmware/gsmi +Date: March 2011 +Contact: Mike Waychison <[email protected]> +Description: + Some servers used internally at Google have firmware + that provides callback functionality via explicit SMI + triggers. Some of the callbacks are similar to those + provided by the EFI runtime services page, but due to + historical reasons this different entry-point has been + used. + + The gsmi driver implements the kernel's abstraction for + these firmware callbacks. Currently, this functionality + is limited to handling the system event log and getting + access to EFI-style variables stored in nvram. + + Layout: + + /sys/firmware/gsmi/vars: + + This directory has the same layout (and + underlying implementation as /sys/firmware/efi/vars. + See Documentation/ABI/*/sysfs-firmware-efi-vars + for more information on how to interact with + this structure. + + /sys/firmware/gsmi/append_to_eventlog - write-only: + + This file takes a binary blob and passes it onto + the firmware to be timestamped and appended to + the system eventlog. The binary format is + interpreted by the firmware and may change from + platform to platform. The only kernel-enforced + requirement is that the blob be prefixed with a + 32bit host-endian type used as part of the + firmware call. + + /sys/firmware/gsmi/clear_config - write-only: + + Writing any value to this file will cause the + entire firmware configuration to be reset to + "factory defaults". Callers should assume that + a reboot is required for the configuration to be + cleared. + + /sys/firmware/gsmi/clear_eventlog - write-only: + + This file is used to clear out a portion/the + whole of the system event log. Values written + should be values between 1 and 100 inclusive (in + ASCII) representing the fraction of the log to + clear. Not all platforms support fractional + clearing though, and this writes to this file + will error out if the firmware doesn't like your + submitted fraction. + + Callers should assume that a reboot is needed + for this operation to complete.
drivers/firmware/Kconfig +2 -0
@@ -157,4 +157,6 @@ config SIGMA If unsure, say N here. Drivers that need these helpers will select this option automatically. +source "drivers/firmware/google/Kconfig" + endmenu
drivers/firmware/Makefile +2 -0
@@ -13,3 +13,5 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_SIGMA) += sigma.o + +obj-y += google/
drivers/firmware/google/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +config GOOGLE_SMI + tristate "SMI interface for Google platforms" + depends on ACPI && DMI + select EFI_VARS + help + Say Y here if you want to enable SMI callbacks for Google + platforms. This provides an interface for writing to and + clearing the EFI event log and reading and writing NVRAM + variables.
drivers/firmware/google/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
drivers/firmware/google/gsmi.c new file +940 -0
940 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH 31/44 driver: Google Memory Console
In reply to Greg Kroah-HartmanFrom: Mike Waychison <[email protected]>
This patch introduces the 'memconsole' driver.
Our firmware gives us access to an in-memory log of the firmware's
output. This gives us visibility in a data-center of headless machines
as to what the firmware is doing.
The memory console is found by the driver by finding a header block in the EBDA. The buffer is then copied out, and is exported to userland in the file /sys/firmware/log.
--- Documentation/ABI/testing/sysfs-firmware-log | 7 + drivers/firmware/google/Kconfig | 8 ++ drivers/firmware/google/Makefile | 1 + drivers/firmware/google/memconsole.c | 166 ++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-log create mode 100644 drivers/firmware/google/memconsole.c
Documentation/ABI/testing/sysfs-firmware-log new file +7 -0
@@ -0,0 +1,7 @@ +What: /sys/firmware/log +Date: February 2011 +Contact: Mike Waychison <[email protected]> +Description: + The /sys/firmware/log is a binary file that represents a + read-only copy of the firmware's log if one is + available.
drivers/firmware/google/Kconfig +8 -0
@@ -7,3 +7,11 @@ config GOOGLE_SMI platforms. This provides an interface for writing to and clearing the EFI event log and reading and writing NVRAM variables. + +config GOOGLE_MEMCONSOLE + tristate "Firmware Memory Console" + depends on DMI + help + This option enables the kernel to search for a firmware log in + the EBDA on Google servers. If found, this log is exported to + userland in the file /sys/firmware/log.
drivers/firmware/google/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_GOOGLE_SMI) += gsmi.o +obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
drivers/firmware/google/memconsole.c new file +166 -0
166 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH 32/44 Introduce CONFIG_GOOGLE_FIRMWARE
In reply to Greg Kroah-HartmanFrom: Mike Waychison <[email protected]>
In order to keep Google's firmware drivers organized amongst themselves, all Google firmware drivers are gated on CONFIG_GOOGLE_FIRMWARE=y, which defaults to 'n' in the kernel build.
--- drivers/firmware/Makefile | 2 +- drivers/firmware/google/Kconfig | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-)
drivers/firmware/Makefile +1 -1
@@ -14,4 +14,4 @@ obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_SIGMA) += sigma.o -obj-y += google/ +obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
drivers/firmware/google/Kconfig +14 -0
@@ -1,3 +1,15 @@ +config GOOGLE_FIRMWARE + bool "Google Firmware Drivers" + depends on X86 + default n + help + These firmware drivers are used by Google's servers. They are + only useful if you are working directly on one of their + proprietary servers. If in doubt, say "N". + +menu "Google Firmware Drivers" + depends on GOOGLE_FIRMWARE + config GOOGLE_SMI tristate "SMI interface for Google platforms" depends on ACPI && DMI
@@ -15,3 +27,5 @@ config GOOGLE_MEMCONSOLE This option enables the kernel to search for a firmware log in the EBDA on Google servers. If found, this log is exported to userland in the file /sys/firmware/log. + +endmenu
Signature · 1 line
1.7.4.2
PATCH 33/44 Allow setting of number of raw devices as a module parameter
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
Allow setting of maximal number of raw devices as a module parameter. This requires changing of static array into a vmalloced one (the array is going to be too large for kmalloc).
--- drivers/char/Kconfig | 2 +- drivers/char/raw.c | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-)
drivers/char/Kconfig +1 -1
@@ -523,7 +523,7 @@ config RAW_DRIVER with the O_DIRECT flag. config MAX_RAW_DEVS - int "Maximum number of RAW devices to support (1-8192)" + int "Maximum number of RAW devices to support (1-65536)" depends on RAW_DRIVER default "256" help
drivers/char/raw.c +27 -6
@@ -21,6 +21,7 @@#include <linux/mutex.h> #include <linux/gfp.h> #include <linux/compat.h> +#include <linux/vmalloc.h> #include <asm/uaccess.h>
@@ -30,10 +31,15 @@ struct raw_device_data { };static struct class *raw_class; -static struct raw_device_data raw_devices[MAX_RAW_MINORS ]; +static struct raw_device_data *raw_devices;static DEFINE_MUTEX (raw_mutex);static const struct file_operations raw_ctl_fops;/* forward declaration */ +static int max_raw_minors =MAX_RAW_MINORS ; + +module_param (max_raw_minors, int,0 ); +MODULE_PARM_DESC (max_raw_minors,"Maximum number of raw devices (1-65536)" ); +/* * Open/close code for raw IO. *
@@ -125,7 +131,7 @@ static int bind_set(int number, u64 major, u64 minor)struct raw_device_data *rawdev;int err =0 ; -if (number <=0 || number >=MAX_RAW_MINORS ) +if (number <=0 || number >= max_raw_minors)return -EINVAL ;if (MAJOR (dev) != major ||MINOR (dev) != minor)
@@ -312,12 +318,26 @@ static int __init raw_init(void)dev_t dev =MKDEV (RAW_MAJOR ,0 );int ret; - ret =register_chrdev_region (dev,MAX_RAW_MINORS ,"raw" ); +if (max_raw_minors <1 || max_raw_minors >65536 ) { +printk (KERN_WARNING "raw: invalid max_raw_minors (must be" +" between 1 and 65536), using %d\n" ,MAX_RAW_MINORS ); + max_raw_minors =MAX_RAW_MINORS ; + } + + raw_devices =vmalloc (sizeof (struct raw_device_data ) * max_raw_minors); +if (!raw_devices) { +printk (KERN_ERR "Not enough memory for raw device structures\n" ); + ret = -ENOMEM ; + goto error; + } +memset (raw_devices,0 ,sizeof (struct raw_device_data ) * max_raw_minors); + + ret =register_chrdev_region (dev, max_raw_minors,"raw" );if (ret) goto error;cdev_init (&raw_cdev, &raw_fops); - ret =cdev_add (&raw_cdev, dev,MAX_RAW_MINORS ); + ret =cdev_add (&raw_cdev, dev, max_raw_minors);if (ret) {kobject_put (&raw_cdev.kobj); goto error_region;
@@ -336,8 +356,9 @@ static int __init raw_init(void)return 0 ; error_region: -unregister_chrdev_region (dev,MAX_RAW_MINORS ); +unregister_chrdev_region (dev, max_raw_minors); error: +vfree (raw_devices);return ret; }
@@ -346,7 +367,7 @@ static void __exit raw_exit(void)device_destroy (raw_class,MKDEV (RAW_MAJOR ,0 ));class_destroy (raw_class);cdev_del (&raw_cdev); -unregister_chrdev_region (MKDEV (RAW_MAJOR ,0 ),MAX_RAW_MINORS ); +unregister_chrdev_region (MKDEV (RAW_MAJOR ,0 ), max_raw_minors); }module_init (raw_init);
Signature · 1 line
1.7.4.2
PATCH 34/44 efivars: prevent oops on unload when efi is not enabled
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
efivars_exit() should check for efi_enabled and not undo allocations when efi is not enabled. Otherwise there is an Oops during module unload:
calling efivars_init+0x0/0x1000 [efivars] @ 2810
EFI Variables Facility v0.08 2004-May-17
initcall efivars_init+0x0/0x1000 [efivars] returned 0 after 5120 usecs
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC last sysfs file: /sys/module/firmware_class/initstate CPU 1 Modules linked in: efivars(-) af_packet tun nfsd lockd nfs_acl auth_rpcgss sunrpc ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT xt_tcpudp nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables x_tables ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf binfmt_misc dm_mirror dm_region_hash dm_log dm_multipath scsi_dh dm_mod snd_hda_codec_analog snd_hda_intel snd_hda_codec snd_hwdep mousedev snd_seq joydev snd_seq_device mac_hid evdev snd_pcm usbkbd usbmouse usbhid snd_timer hid tg3 snd sr_mod pcspkr rtc_cmos soundcore cdrom iTCO_wdt processor sg dcdbas i2c_i801 rtc_core iTCO_vendor_support intel_agp snd_page_alloc thermal_sys rtc_lib intel_gtt 8250_pnp button hwmon unix ide_pci_generic ide_core ata_generic pata_acpi ata_piix sd_mod crc_t10dif ext3 jbd mbcache uhci_hcd ohci_hcd ssb mmc_core pcmcia pcmcia_core firmware_class ehci_hcd usbcore [last unloaded: dell_rbu]
Pid: 2812, comm: rmmod Not tainted 2.6.39-rc6 #1 Dell Inc. OptiPlex 745 /0TY565
RIP: 0010:[<ffffffffa06a17f6>] [<ffffffffa06a17f6>] unregister_efivars+0x28/0x12c [efivars] RSP: 0018:ffff88005eedde98 EFLAGS: 00010283 RAX: ffffffffa06a23fc RBX: ffffffffa06a44c0 RCX: ffff88007c227a50 RDX: 0000000000000000 RSI: 00000055ac13db78 RDI: ffffffffa06a44c0 RBP: ffff88005eeddec8 R08: 0000000000000000 R09: ffff88005eeddd78 R10: ffffffffa06a4220 R11: ffff88005eeddd78 R12: fffffffffffff7d0 R13: 00007fff5a3aaec0 R14: 0000000000000000 R15: ffffffffa06a4508 FS: 00007fa8dcc4a6f0(0000) GS:ffff88007c200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000000 CR3: 000000005d148000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process rmmod (pid: 2812, threadinfo ffff88005eedc000, task ffff88006754b000) Stack: ffff88005eeddec8 ffffffffa06a4220 0000000000000000 00007fff5a3aaec0 0000000000000000 0000000000000001 ffff88005eedded8 ffffffffa06a2418 ffff88005eeddf78 ffffffff810d3598 ffffffffa06a4220 0000000000000880 Call Trace: [<ffffffffa06a2418>] efivars_exit+0x1c/0xc04 [efivars] [<ffffffff810d3598>] sys_delete_module+0x2d6/0x368 [<ffffffff812d1db9>] ? lockdep_sys_exit_thunk+0x35/0x67 [<ffffffff810fcba1>] ? audit_syscall_entry+0x172/0x1a5 [<ffffffff81575082>] system_call_fastpath+0x16/0x1b Code: 5c c9 c3 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 08 0f 1f 44 00 00 4c 8b 67 48 48 89 fb 4c 8d 7f 48 49 81 ec 30 08 00 00 <4d> 8b ac 24 30 08 00 00 49 81 ed 30 08 00 00 eb 59 48 89 df 48 RIP [<ffffffffa06a17f6>] unregister_efivars+0x28/0x12c [efivars] RSP <ffff88005eedde98> CR2: 0000000000000000 ---[ end trace aa99b99090f70baa ]---
Matt apparently removed such a check in 2004 (with no reason given):
* 17 May 2004 - Matt Domsch <[email protected]>
* remove check for efi_enabled in exit
but there have been several changes since then.
--- drivers/firmware/efivars.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/firmware/efivars.c +4 -2
@@ -827,8 +827,10 @@ err_put: static void __exitefivars_exit (void ) { -unregister_efivars (&__efivars); -kobject_put (efi_kobj); +if (efi_enabled) { +unregister_efivars (&__efivars); +kobject_put (efi_kobj); + } }module_init (efivars_init);
Signature · 1 line
1.7.4.2
PATCH 35/44 reboot: disable usermodehelper to prevent fs access
In reply to Greg Kroah-HartmanFrom: Kay Sievers <[email protected]>
In case CONFIG_UEVENT_HELPER_PATH is not set to "", which it should be on every system, the kernel forks processes during shutdown, which try to access the rootfs, even when the binary does not exist. It causes exceptions and long delays in the disk driver, which gets read requests at the time it tries to shut down the disk.
This patch disables all kernel-forked processes during reboot to allow a clean poweroff.
--- kernel/sys.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sys.c +2 -0
@@ -314,6 +314,7 @@ void kernel_restart_prepare(char *cmd) {blocking_notifier_call_chain (&reboot_notifier_list,SYS_RESTART , cmd); system_state =SYSTEM_RESTART ; +usermodehelper_disable ();device_shutdown ();sysdev_shutdown ();syscore_shutdown ();
@@ -344,6 +345,7 @@ static void kernel_shutdown_prepare(enum system_states state)blocking_notifier_call_chain (&reboot_notifier_list, (state ==SYSTEM_HALT )?SYS_HALT :SYS_POWER_OFF ,NULL ); system_state = state; +usermodehelper_disable ();device_shutdown (); }/**
Signature · 1 line
1.7.4.2
PATCH 36/44 RAW driver: Remove call to kobject_put().
In reply to Greg Kroah-HartmanFrom: Robert P. J. Day <[email protected]>
If cdev_add() fails, there is no justification for subsequently calling kobject_put().
--- drivers/char/raw.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/char/raw.c +0 -1
@@ -339,7 +339,6 @@ static int __init raw_init(void)cdev_init (&raw_cdev, &raw_fops); ret =cdev_add (&raw_cdev, dev, max_raw_minors);if (ret) { -kobject_put (&raw_cdev.kobj); goto error_region; }
Signature · 1 line
1.7.4.2
PATCH 37/44 Translated Documentation/email-clients.txt
In reply to Greg Kroah-HartmanFrom: Harry Wei <[email protected]>
The patch includes the translation Documentation/email-clients.txt. If anyone has other problems, please let me know.
--- Documentation/zh_CN/email-clients.txt | 210 +++++++++++++++++++++++++++++++++ 1 files changed, 210 insertions(+), 0 deletions(-) create mode 100644 Documentation/zh_CN/email-clients.txt
Documentation/zh_CN/email-clients.txt new file +210 -0
@@ -0,0 +1,210 @@ +锘?Chinese translated version of Documentation/email-clients.txt + +If you have any comment or update to the content, please contact the +original document maintainer directly. However, if you have a problem +communicating in English you can also ask the Chinese maintainer for +help. Contact the Chinese maintainer if this translation is outdated +or if there is a problem with the translation. + +Chinese maintainer: Harry Wei <[email protected]> +--------------------------------------------------------------------- +Documentation/email-clients.txt ???涓????缈昏?? + +濡??????宠??璁烘????存?版???????????瀹癸??璇风?存?ヨ??绯诲?????妗g??缁存?よ?????濡????浣?浣跨?ㄨ?辨?? +浜ゆ???????伴?剧??璇?锛?涔????浠ュ??涓???????缁存?よ??姹???┿??濡???????缈昏????存?颁???????舵?????缈? +璇?瀛???ㄩ??棰?锛?璇疯??绯讳腑??????缁存?よ????? + +涓???????缁存?よ??锛? 璐惧??濞? Harry Wei <[email protected]> +涓???????缈昏?????锛? 璐惧??濞? Harry Wei <[email protected]> +涓?????????¤?????锛? Yinglin Luan <[email protected]> + Xiaochen Wang <[email protected]> + yaxinsn <[email protected]> + +浠ヤ??涓烘?f?? +--------------------------------------------------------------------- + +Linux???浠跺?㈡?风?????缃?淇℃?? +====================================================================== + +?????????缃? +---------------------------------------------------------------------- +Linux?????歌ˉ涓???????杩????浠惰?????浜ょ??锛????濂芥??琛ヤ??浣?涓洪??浠朵????????宓?????????????浜?缁存?よ?? +??ユ?堕??浠讹??浣???????浠剁?????瀹规?煎??搴?璇ユ??"text/plain"?????惰??锛????浠朵????????涓?璧???????锛? +???涓鸿??浼?浣胯ˉ涓????寮???ㄩ?ㄥ????ㄨ??璁鸿??绋?涓???????寰???伴?俱?? + +??ㄦ?ュ?????Linux?????歌ˉ涓???????浠跺?㈡?风????ㄥ?????琛ヤ????跺??璇ュ??浜?????????????濮???舵?????渚?濡?锛? +浠?浠?涓???芥?瑰?????????????ゅ?惰〃绗???????绌烘?硷???????虫????ㄦ??涓?琛????寮?澶存?????缁?灏俱?? + +涓?瑕????杩?"format=flowed"妯″????????琛ヤ?????杩???蜂??寮?璧蜂?????棰????浠ュ?????瀹崇?????琛???? + +涓?瑕?璁╀????????浠跺?㈡?风??杩?琛??????ㄦ?㈣?????杩???蜂??浼???村??浣????琛ヤ????? + +???浠跺?㈡?风??涓???芥?瑰???????????瀛?绗????缂??????瑰?????瑕??????????琛ヤ???????芥??ASCII??????UTF-8缂??????瑰??锛? +濡????浣?浣跨??UTF-8缂??????瑰???????????浠讹????d??浣?灏?浼???垮??涓?浜??????藉????????瀛?绗???????棰???? + +???浠跺?㈡?风??搴?璇ュ舰???骞朵??淇???? References: ?????? In-Reply-To: ???棰?锛???d?? +???浠惰??棰?灏变??浼?涓??????? + +澶???剁??甯?(?????????璐寸??甯?)???甯镐????界?ㄤ??琛ヤ??锛????涓哄?惰〃绗?浼?杞????涓虹┖??笺??浣跨??xclipboard, xclip +??????xcutsel涔?璁稿??浠ワ??浣???????濂芥??璇?涓?涓?????????垮??浣跨?ㄥ????剁??甯???? + +涓?瑕???ㄤ娇???PGP/GPG缃插????????浠朵腑??????琛ヤ?????杩???蜂??浣垮??寰?澶???????涓???借?诲??????????ㄤ??浣????琛ヤ????? +锛?杩?涓????棰?搴?璇ユ?????浠ヤ慨澶????锛? + +??ㄧ???????搁??浠跺??琛ㄥ?????琛ヤ??涔????锛?缁????宸卞?????涓?涓?琛ヤ?????涓?涓???????涓绘??锛?淇?瀛???ユ?跺?扮?? +???浠讹??灏?琛ヤ?????'patch'??戒护???涓?锛?濡??????????浜?锛????缁??????搁??浠跺??琛ㄥ???????? + + +涓?浜????浠跺?㈡?风?????绀? +---------------------------------------------------------------------- +杩????缁???轰??浜?璇?缁????MUA???缃????绀猴?????浠ョ?ㄤ??缁?Linux?????稿?????琛ヤ?????杩?浜?骞朵???????虫?? +?????????杞?浠跺?????缃???荤????? + +璇存??锛? +TUI = 浠ユ?????涓哄?虹???????ㄦ?锋?ュ?? +GUI = ??惧舰?????㈢?ㄦ?锋?ュ?? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Alpine (TUI) + +???缃????椤癸?? +???"Sending Preferences"??ㄥ??锛? + +- "Do Not Send Flowed Text"蹇?椤诲????? +- "Strip Whitespace Before Sending"蹇?椤诲?抽?? + +褰???????浠舵?讹????????搴?璇ユ?惧?ㄨˉ涓?浼???虹?扮????版?癸????跺?????涓?CTRL-R缁???????锛?浣挎??瀹???? +琛ヤ?????浠跺????ュ?伴??浠朵腑??? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Evolution (GUI) + +涓?浜?寮????????????????浣跨?ㄥ????????琛ヤ?? + +褰??????╅??浠堕??椤癸??Preformat + 浠?Format->Heading->Preformatted (Ctrl-7)??????宸ュ?锋?? + +??跺??浣跨??锛? + Insert->Text File... (Alt-n x)?????ヨˉ涓????浠躲?? + +浣?杩????浠?"diff -Nru old.c new.c | xclip"锛???????Preformat锛???跺??浣跨?ㄤ腑??撮??杩?琛?绮?甯???? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Kmail (GUI) + +涓?浜?寮????????????????浣跨?ㄥ????????琛ヤ????? + +榛?璁よ?剧疆涓?涓?HTML??煎??????????????锛?涓?瑕??????ㄥ????? + +褰?涔????涓?灏????浠剁????跺??锛???ㄩ??椤逛?????涓?瑕??????╄????ㄦ?㈣????????涓????缂虹?瑰氨???浣???ㄩ??浠朵腑杈???ョ??浠讳???????? +??戒??浼?琚??????ㄦ?㈣??锛????姝や??蹇?椤诲?ㄥ?????琛ヤ??涔?????????ㄦ?㈣????????绠?????????规??灏辨???????ㄨ????ㄦ?㈣????ヤ功??????浠讹?? +??跺?????瀹?淇?瀛?涓鸿??绋裤??涓????浣???ㄨ??绋夸腑???娆℃??寮?瀹?锛?瀹?宸茬????ㄩ?ㄨ????ㄦ?㈣??浜?锛???d??浣???????浠惰?界?舵病??? +?????╄????ㄦ?㈣??锛?浣????杩?涓?浼?澶卞?诲凡???????????ㄦ?㈣????? + +??ㄩ??浠剁??搴????锛??????ヨˉ涓?涔????锛???句??甯哥?ㄧ??琛ヤ??瀹????绗?锛?涓?涓?杩?瀛????(---)??? + +??跺?????"Message"????????$??锛??????╂????ユ??浠讹????ョ????????浣????琛ヤ?????浠躲??杩????涓?涓?棰?澶???????椤癸??浣????浠? +???杩?瀹????缃?浣???????浠跺缓绔?宸ュ?锋????????锛?杩????浠ュ甫涓?"insert file"??炬????? + +浣????浠ュ????ㄥ?伴??杩?GPG???璁伴??浠讹??浣???????宓?琛ヤ?????濂戒??瑕?浣跨??GPG???璁板??浠????浣?涓哄??宓??????????绛惧??琛ヤ??锛? +褰?浠?GPG涓???????7浣?缂??????朵??浣夸??浠?????????村??澶??????? + +濡????浣????瑕?浠ラ??浠剁??褰㈠????????琛ヤ??锛???d??灏卞?抽????瑰?婚??浠讹????跺?????涓?灞???э??绐????"Suggest automatic +display"锛?杩???峰??宓????浠舵?村?规??璁╄?昏???????般?? + +褰?浣?瑕?淇?瀛?灏?瑕?????????????宓???????琛ヤ??锛?浣????浠ヤ??娑???????琛ㄧ????奸????╁?????琛ヤ????????浠讹????跺????冲?婚????? +"save as"???浣????浠ヤ娇??ㄤ??涓?娌℃????存?圭????????琛ヤ????????浠讹??濡????瀹????浠ユ?g‘???褰㈠??缁???????褰?浣?姝g????ㄥ?? +???宸辩??绐???d??涓?瀵????锛???f?舵病??????椤瑰??浠ヤ??瀛????浠?--宸茬?????涓?涓?杩???风??bug琚?姹???ュ?颁??kmail???bugzilla +骞朵??甯????杩?灏?浼?琚?澶??????????浠舵??浠ュ?????瀵规??涓???ㄦ?峰??璇诲???????????琚?淇?瀛????锛????浠ュ?????浣???虫?????浠跺????跺?板?朵????版?癸?? +浣?涓?寰?涓????浠?浠????????????逛负缁?????????翠?????璇汇?? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Lotus Notes (GUI) + +涓?瑕?浣跨?ㄥ????? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Mutt (TUI) + +寰?澶?Linux寮????浜哄??浣跨??mutt瀹㈡?风??锛????浠ヨ?????瀹????瀹?宸ヤ????????甯告??浜???? + +Mutt涓????甯?缂?杈????锛????浠ヤ??绠′??浣跨?ㄤ??涔?缂?杈???ㄩ?戒??搴?璇ュ甫????????ㄦ??琛????澶у????扮??杈???ㄩ?藉甫??? +涓?涓?"insert file"???椤癸??瀹????浠ラ??杩?涓???瑰?????浠跺??瀹圭????瑰???????ユ??浠躲?? + +'vim'浣?涓?mutt???缂?杈????锛? + set editor="vi" + + 濡????浣跨??xclip锛???插?ヤ互涓???戒护 + :set paste + ???涓????涔??????????shift-insert??????浣跨?? + :r filename + +濡??????宠?????琛ヤ??浣?涓哄??宓?????????? +(a)ttach宸ヤ?????寰?濂斤??涓?甯????"set paste"??? + +???缃????椤癸?? +瀹?搴?璇ヤ互榛?璁よ?剧疆???褰㈠??宸ヤ????? +??惰??锛????"send_charset"璁剧疆涓?"us-ascii::utf-8"涔????涓?涓?涓???????涓绘????? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Pine (TUI) + +Pine杩???绘??涓?浜?绌烘?煎????????棰?锛?浣????杩?浜???板?ㄥ??璇ラ?借??淇?澶?浜???? + +濡???????浠ワ??璇蜂娇???alpine(pine???缁ф?胯??) + +???缃????椤癸?? +- ???杩?????????????瑕?娑???ゆ??绋??????? +- "no-strip-whitespace-before-send"???椤逛????????瑕??????? + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Sylpheed (GUI) + +- ???宓??????????浠ュ??濂界??宸ヤ??锛???????浣跨?ㄩ??浠讹????? +- ???璁镐娇??ㄥ????ㄧ??缂?杈???ㄣ?? +- 瀵逛?????褰?杈?澶???堕??甯告????? +- 濡???????杩?non-SSL杩???ワ?????娉?浣跨??TLS SMTP????????? +- ??ㄧ?????绐???d腑???涓?涓?寰??????ㄧ??ruler bar??? +- 缁???板?????涓?娣诲????板??灏变??浼?姝g‘???浜?瑙f?剧ず?????? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Thunderbird (GUI) + +榛?璁ゆ????典??锛?thunderbird寰?瀹规??????????????锛?浣????杩????涓?浜???规?????浠ュ己??跺?????寰???村ソ??? + +- ??ㄧ?ㄦ?峰????疯?剧疆???锛?缁???????瀵诲??锛?涓?瑕???????"Compose messages in HTML format"??? + +- 缂?杈?浣????Thunderbird???缃?璁剧疆??ヤ娇瀹?涓?瑕????琛?浣跨??锛?user_pref("mailnews.wraplength", 0); + +- 缂?杈?浣????Thunderbird???缃?璁剧疆锛?浣垮??涓?瑕?浣跨??"format=flowed"??煎??锛?user_pref("mailnews. + send_plaintext_flowed", false); + +- 浣????瑕?浣?Thunderbird???涓洪???????煎????瑰??锛? + 濡????榛?璁ゆ????典??浣?涔??????????HTML??煎??锛???d?????寰???俱??浠?浠?浠????棰???????涓????妗?涓???????"Preformat"??煎????? + 濡????榛?璁ゆ????典??浣?涔??????????????????煎??锛?浣?涓?寰????瀹???逛负HTML??煎??锛?浠?浠?浣?涓轰??娆℃?х??锛???ヤ功?????扮??娑????锛? + ??跺??寮哄?朵娇瀹??????版???????煎??锛???????瀹?灏变?????琛????瑕?瀹???板??锛???ㄥ??淇$????炬??涓?浣跨??shift?????ヤ娇瀹????涓?HTML + ??煎??锛???跺?????棰???????涓????妗?涓???????"Preformat"??煎????? + +- ???璁镐娇??ㄥ????ㄧ??缂?杈????锛? + ???瀵?Thunderbird???琛ヤ?????绠?????????规??灏辨??浣跨?ㄤ??涓?"external editor"??╁??锛???跺??浣跨?ㄤ????????娆㈢?? + $EDITOR??ヨ?诲???????????骞惰ˉ涓???版?????涓????瑕?瀹???板??锛????浠ヤ??杞藉苟涓?瀹?瑁?杩?涓???╁??锛???跺??娣诲??涓?涓?浣跨?ㄥ????? + ??????View->Toolbars->Customize...??????褰?浣?涔????淇℃???????跺??浠?浠???瑰?诲??灏卞??浠ヤ????? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +TkRat (GUI) + +???浠ヤ娇??ㄥ?????浣跨??"Insert file..."??????澶???ㄧ??缂?杈???ㄣ?? + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Gmail (Web GUI) + +涓?瑕?浣跨?ㄥ????????琛ヤ????? + +Gmail缃?椤靛?㈡?风???????ㄥ?版????惰〃绗?杞????涓虹┖??笺?? + +??界?跺?惰〃绗?杞????涓虹┖??奸??棰????浠ヨ??澶???ㄧ??杈???ㄨВ??筹???????跺??杩?浼?浣跨?ㄥ??杞???㈣?????姣?琛???????涓?78涓?瀛?绗???? + +???涓?涓????棰????Gmail杩?浼????浠讳??涓????ASCII???瀛?绗????淇℃????逛负base64缂???????瀹????涓?瑗垮????????娆ф床浜虹?????瀛???? + + ###
Signature · 1 line
1.7.4.2
PATCH 38/44 driver core: Add the device driver-model structures to kerneldoc
In reply to Greg Kroah-HartmanFrom: Wanlong Gao <[email protected]>
Add the comments to the structure bus_type, device_driver, device, class to device.h for generating the driver-model kerneldoc. With another patch these all removed from the files in Documentation/driver-model/ since they are out of date. That will keep things up to date and provide a better way to document this stuff.
--- Documentation/DocBook/device-drivers.tmpl | 6 +- include/linux/device.h | 154 ++++++++++++++++++++++++++++- 2 files changed, 154 insertions(+), 6 deletions(-)
Documentation/DocBook/device-drivers.tmpl +3 -3
@@ -96,10 +96,10 @@ X!Iinclude/linux/kobject.h <chapter id="devdrivers"> <title>Device drivers infrastructure</title> + <sect1><title>The Basic Device Driver-Model Structures </title> +!Iinclude/linux/device.h + </sect1> <sect1><title>Device Drivers Base</title> -<!-- -X!Iinclude/linux/device.h ---> !Edrivers/base/driver.c !Edrivers/base/core.c !Edrivers/base/class.c
include/linux/device.h +151 -3
184 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH 39/44 driver core: remove the driver-model structures from the documentation
In reply to Greg Kroah-HartmanFrom: Wanlong Gao <[email protected]>
Remove the struct bus_type, class, device, device_driver from the driver-model docs. With another patch add them to device.h, since they are out of date. That will keep things up to date and provide a better way to document this stuff.
--- Documentation/driver-model/bus.txt | 19 +------- Documentation/driver-model/class.txt | 17 +------ Documentation/driver-model/device.txt | 91 +-------------------------------- Documentation/driver-model/driver.txt | 18 +------ 4 files changed, 4 insertions(+), 141 deletions(-)
Documentation/driver-model/bus.txt +1 -18
@@ -3,24 +3,7 @@ Bus Types Definition ~~~~~~~~~~ - -struct bus_type { - char * name; - - struct subsystem subsys; - struct kset drivers; - struct kset devices; - - struct bus_attribute * bus_attrs; - struct device_attribute * dev_attrs; - struct driver_attribute * drv_attrs; - - int (*match)(struct device * dev, struct device_driver * drv); - int (*hotplug) (struct device *dev, char **envp, - int num_envp, char *buffer, int buffer_size); - int (*suspend)(struct device * dev, pm_message_t state); - int (*resume)(struct device * dev); -}; +See the kerneldoc for the struct bus_type. int bus_register(struct bus_type * bus);
Documentation/driver-model/class.txt +1 -16
@@ -27,22 +27,7 @@ The device class structure looks like: typedef int (*devclass_add)(struct device *); typedef void (*devclass_remove)(struct device *); -struct device_class { - char * name; - rwlock_t lock; - u32 devnum; - struct list_head node; - - struct list_head drivers; - struct list_head intf_list; - - struct driver_dir_entry dir; - struct driver_dir_entry device_dir; - struct driver_dir_entry driver_dir; - - devclass_add add_device; - devclass_remove remove_device; -}; +See the kerneldoc for the struct class. A typical device class definition would look like:
Documentation/driver-model/device.txt +1 -90
97 lines not on this page · raw message
Documentation/driver-model/driver.txt +1 -17
@@ -1,23 +1,7 @@ Device Drivers -struct device_driver { - char * name; - struct bus_type * bus; - - struct completion unloaded; - struct kobject kobj; - list_t devices; - - struct module *owner; - - int (*probe) (struct device * dev); - int (*remove) (struct device * dev); - - int (*suspend) (struct device * dev, pm_message_t state); - int (*resume) (struct device * dev); -}; - +See the kerneldoc for the struct device_driver. Allocation
Signature · 1 line
1.7.4.2
PATCH 40/44 SYSFS: Fix erroneous comments for sysfs_update_group().
In reply to Greg Kroah-HartmanFrom: Robert P. J. Day <[email protected]>
Fix what is clearly a simple copy-and-paste error in commenting the sysfs_update_group() routine.
--- fs/sysfs/group.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/sysfs/group.c +3 -3
@@ -101,9 +101,9 @@ int sysfs_create_group(struct kobject *kobj, }/** -* sysfs_update_group - given a directory kobject, create an attribute group -* @kobj: The kobject to create the group on -* @grp: The attribute group to create +* sysfs_update_group - given a directory kobject, update an attribute group +* @kobj: The kobject to update the group on +* @grp: The attribute group to update * * This function updates an attribute group. Unlike * sysfs_create_group(), it will explicitly not warn or error if any
Signature · 1 line
1.7.4.2
PATCH 41/44 memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION
In reply to Greg Kroah-HartmanFrom: Anton Blanchard <[email protected]>
On ppc64 the minimum memory section for hotplug is 16MB but most recent machines have a memory block size of 256MB. This means memory_block_change_state does 16 separate calls to memory_section_action.
This also means we call the notifiers 16 times and the hook in the ehea network driver is quite costly. To offline one 256MB region takes:
# time echo offline > /sys/devices/system/memory/memory32/state 7.9s
This patch removes the loop and calls online_pages or remove_memory once for the entire region and in doing so makes the logic simpler since we don't have to back out if things fail part way through.
The same test to offline one region now takes:
# time echo online > /sys/devices/system/memory/memory32/state 0.67s
Over 11 times faster.
--- drivers/base/memory.c | 24 ++++++++---------------- 1 files changed, 8 insertions(+), 16 deletions(-)
drivers/base/memory.c +8 -16
@@ -229,10 +229,11 @@ int memory_isolate_notify(unsigned long val, void *v)* OK to have direct references to sparsemem variables in here. */ static int -memory_section_action (unsigned long phys_index,unsigned long action) +memory_block_action (unsigned long phys_index,unsigned long action) {int i;unsigned long start_pfn, start_paddr; +unsigned long nr_pages =PAGES_PER_SECTION * sections_per_block;struct page *first_page;int ret;
@@ -244,7 +245,7 @@ memory_section_action(unsigned long phys_index, unsigned long action)* that way. */ if (action ==MEM_ONLINE ) { -for (i =0 ; i <PAGES_PER_SECTION ; i++) { +for (i =0 ; i < nr_pages; i++) {if (PageReserved (first_page+i))continue ;
@@ -258,12 +259,12 @@ memory_section_action(unsigned long phys_index, unsigned long action)switch (action) {case MEM_ONLINE : start_pfn =page_to_pfn (first_page); - ret =online_pages (start_pfn,PAGES_PER_SECTION ); + ret =online_pages (start_pfn, nr_pages);break ;case MEM_OFFLINE : start_paddr =page_to_pfn (first_page) <<PAGE_SHIFT ; ret =remove_memory (start_paddr, -PAGES_PER_SECTION <<PAGE_SHIFT ); + nr_pages <<PAGE_SHIFT );break ;default : WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
@@ -289,20 +290,11 @@ static int memory_block_change_state(struct memory_block *mem,if (to_state ==MEM_OFFLINE ) mem->state =MEM_GOING_OFFLINE ; -for (i =0 ; i < sections_per_block; i++) { - ret =memory_section_action (mem->start_section_nr + i, - to_state); -if (ret) -break ; - } - -if (ret) { -for (i =0 ; i < sections_per_block; i++) -memory_section_action (mem->start_section_nr + i, - from_state_req); + ret =memory_block_action (mem->start_section_nr, to_state); +if (ret) mem->state = from_state_req; - }else +else mem->state = to_state; out:
Signature · 1 line
1.7.4.2
PATCH 42/44 drivers/base/memory.c: fix warning due to "memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION"
In reply to Greg Kroah-HartmanFrom: Andrew Morton <[email protected]>
drivers/base/memory.c: In function 'memory_block_change_state':drivers/base/memory.c:281: warning: unused variable 'i'
less beer, more testing
--- drivers/base/memory.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/memory.c +1 -1
@@ -278,7 +278,7 @@ memory_block_action(unsigned long phys_index, unsigned long action)static int memory_block_change_state (struct memory_block *mem,unsigned long to_state,unsigned long from_state_req) { -int i, ret =0 ; +int ret =0 ;mutex_lock (&mem->state_mutex);
Signature · 1 line
1.7.4.2
PATCH 43/44 sysfs: remove "last sysfs file:" line from the oops messages
In reply to Greg Kroah-HartmanOn some arches (x86, sh, arm, unicore, powerpc) the oops message would print out the last sysfs file accessed.
This was very useful in finding a number of sysfs and driver core bugs in the 2.5 and early 2.6 development days, but it has been a number of years since this file has actually helped in debugging anything that couldn't also be trivially determined from the stack traceback.
So it's time to delete the line. This is good as we need all the space we can get for oops messages at times on consoles.
--- arch/arm/kernel/traps.c | 1 - arch/powerpc/kernel/traps.c | 1 - arch/sh/kernel/traps_32.c | 1 - arch/unicore32/kernel/traps.c | 1 - arch/x86/kernel/dumpstack.c | 1 - fs/sysfs/file.c | 12 ------------ include/linux/sysfs.h | 5 ----- 7 files changed, 0 insertions(+), 22 deletions(-)
arch/arm/kernel/traps.c +0 -1
@@ -234,7 +234,6 @@ static int __die(const char *str, int err, struct thread_info *thread, struct ptprintk (KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n" , str, err, ++die_counter); -sysfs_printk_last_file ();/* trap and error numbers are mostly meaningless on ARM */ ret =notify_die (DIE_OOPS , str, regs, err, tsk->thread.trap_no,SIGSEGV );
arch/powerpc/kernel/traps.c +0 -1
@@ -143,7 +143,6 @@ int die(const char *str, struct pt_regs *regs, long err)#endif printk ("%s\n" , ppc_md.name ? ppc_md.name :"" ); -sysfs_printk_last_file ();if (notify_die (DIE_OOPS , str, regs, err,255 ,SIGSEGV ) ==NOTIFY_STOP )return 1 ;
arch/sh/kernel/traps_32.c +0 -1
@@ -87,7 +87,6 @@ void die(const char * str, struct pt_regs * regs, long err)bust_spinlocks (1 );printk ("%s: %04lx [#%d]\n" , str, err &0xffff , ++die_counter); -sysfs_printk_last_file ();print_modules ();show_regs (regs);
arch/unicore32/kernel/traps.c +0 -1
@@ -192,7 +192,6 @@ static int __die(const char *str, int err, struct thread_info *thread,printk (KERN_EMERG "Internal error: %s: %x [#%d]\n" , str, err, ++die_counter); -sysfs_printk_last_file ();/* trap and error numbers are mostly meaningless on UniCore */ ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, \
arch/x86/kernel/dumpstack.c +0 -1
@@ -279,7 +279,6 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)printk ("DEBUG_PAGEALLOC" );#endif printk ("\n" ); -sysfs_printk_last_file ();if (notify_die (DIE_OOPS , str, regs, err, current->thread.trap_no,SIGSEGV ) ==NOTIFY_STOP )return 1 ;
fs/sysfs/file.c +0 -12
@@ -24,13 +24,6 @@#include "sysfs.h" -/* used in crash dumps to help with debugging */ -static char last_sysfs_file[PATH_MAX ]; -void sysfs_printk_last_file (void ) -{ -printk (KERN_EMERG "last sysfs file: %s\n" , last_sysfs_file); -} -/* * There's one sysfs_buffer for each open file and one * sysfs_open_dirent for each sysfs_dirent with one or more open
@@ -337,11 +330,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file)struct sysfs_buffer *buffer;const struct sysfs_ops *ops;int error = -EACCES ; -char *p; - - p =d_path (&file->f_path, last_sysfs_file,sizeof (last_sysfs_file)); -if (!IS_ERR (p)) -memmove (last_sysfs_file, p,strlen (p) +1 );/* need attr_sd for attr and ops, its parent for kobj */ if (!sysfs_get_active (attr_sd))
include/linux/sysfs.h +0 -5
@@ -176,7 +176,6 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name);struct sysfs_dirent *sysfs_get (struct sysfs_dirent *sd);void sysfs_put (struct sysfs_dirent *sd); -void sysfs_printk_last_file (void );/* Called to clear a ns tag when it is no longer valid */ void sysfs_exit_ns (enum kobj_ns_type type,const void *tag);
@@ -348,10 +347,6 @@ static inline int __must_check sysfs_init(void)return 0 ; } -static inline void sysfs_printk_last_file (void ) -{ -} -#endif /* CONFIG_SYSFS */ #endif /* _SYSFS_H_ */
Signature · 1 line
1.7.4.2
PATCH 44/44 debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
Enabling DEBUG_STRICT_USER_COPY_CHECKS causes the following warning:
In file included from arch/x86/include/asm/uaccess.h:573,
from include/linux/uaccess.h:5,
from include/linux/highmem.h:7,
from include/linux/pagemap.h:10,
from fs/debugfs/file.c:18:In function 'copy_from_user',
inlined from 'write_file_bool' at fs/debugfs/file.c:435:arch/x86/include/asm/uaccess_64.h:65: warning: call to 'copy_from_user_overflow' declared with attribute warning:copy_from_user() buffer size is not provably correct
presumably due to buf_size being signed causing GCC to fail to see that buf_size can't become negative.
--- fs/debugfs/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/debugfs/file.c +1 -1
@@ -428,7 +428,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { char buf[32]; -int buf_size; +size_t buf_size;bool bv;u32 *val = file->private_data;
Signature · 1 line
1.7.4.2