Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6:
Driver core: Remove unneeded get_{device,driver}() calls.
Driver core: Update some prototypes in platform.txt
driver core: convert to use class_find_device api
PM: Export device_pm_schedule_removal
nozomi: finish constification
nozomi: constify driver
nozomi driver update
Add ja_JP translation of stable_kernel_rules.txt
kobject: kerneldoc comment fix
kobject: Always build in kernel/ksysfs.o.

+167 -152
+3 -3
Documentation/driver-model/platform.txt
··· 122 using these calls except with such hotplug-deficient drivers. 123 124 struct platform_device *platform_device_alloc( 125 - char *name, unsigned id); 126 127 You can use platform_device_alloc() to dynamically allocate a device, which 128 you will then initialize with resources and platform_device_register(). 129 A better solution is usually: 130 131 struct platform_device *platform_device_register_simple( 132 - char *name, unsigned id, 133 - struct resource *res, unsigned nres); 134 135 You can use platform_device_register_simple() as a one-step call to allocate 136 and register a device.
··· 122 using these calls except with such hotplug-deficient drivers. 123 124 struct platform_device *platform_device_alloc( 125 + const char *name, int id); 126 127 You can use platform_device_alloc() to dynamically allocate a device, which 128 you will then initialize with resources and platform_device_register(). 129 A better solution is usually: 130 131 struct platform_device *platform_device_register_simple( 132 + const char *name, int id, 133 + struct resource *res, unsigned int nres); 134 135 You can use platform_device_register_simple() as a one-step call to allocate 136 and register a device.
+79
Documentation/ja_JP/stable_kernel_rules.txt
···
··· 1 + NOTE: 2 + This is Japanese translated version of "Documentation/stable_kernel_rules.txt". 3 + This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> 4 + and JF Project team <www.linux.or.jp/JF>. 5 + If you find difference with original file or problem in translation, 6 + please contact maintainer of this file or JF project. 7 + 8 + Please also note that purpose of this file is easier to read for non 9 + English natives and do no intended to fork. So, if you have any 10 + comment or update of this file, please try to update Original(English) 11 + file at first. 12 + 13 + ================================== 14 + これは、 15 + linux-2.6.24/Documentation/stable_kernel_rules.txt 16 + の和訳です。 17 + 18 + 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 19 + 翻訳日: 2007/12/30 20 + 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 21 + 校正者: 武井伸光さん、<takei at webmasters dot gr dot jp> 22 + かねこさん (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp> 23 + 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 24 + 野口さん (Kenji Noguchi) <tokyo246 at gmail dot com> 25 + 神宮信太郎さん <jin at libjingu dot jp> 26 + ================================== 27 + 28 + ずっと知りたかった Linux 2.6 -stable リリースの全て 29 + 30 + "-stable" ツリーにどのような種類のパッチが受け入れられるか、どのような 31 + ものが受け入れられないか、についての規則- 32 + 33 + - 明らかに正しく、テストされているものでなければならない。 34 + - 文脈(変更行の前後)を含めて 100 行より大きくてはいけない。 35 + - ただ一個のことだけを修正しているべき。 36 + - 皆を悩ませている本物のバグを修正しなければならない。("これはバグで 37 + あるかもしれないが..." のようなものではない) 38 + - ビルドエラー(CONFIG_BROKENになっているものを除く), oops, ハング、デー 39 + タ破壊、現実のセキュリティ問題、その他 "ああ、これはダメだね"という 40 + ようなものを修正しなければならない。短く言えば、重大な問題。 41 + - どのように競合状態が発生するかの説明も一緒に書かれていない限り、 42 + "理論的には競合状態になる"ようなものは不可。 43 + - いかなる些細な修正も含めることはできない。(スペルの修正、空白のクリー 44 + ンアップなど) 45 + - 対応するサブシステムメンテナが受け入れたものでなければならない。 46 + - Documentation/SubmittingPatches の規則に従ったものでなければならない。 47 + 48 + -stable ツリーにパッチを送付する手続き- 49 + 50 + - 上記の規則に従っているかを確認した後に、stable@kernel.org にパッチ 51 + を送る。 52 + - 送信者はパッチがキューに受け付けられた際には ACK を、却下された場合 53 + には NAK を受け取る。この反応は開発者たちのスケジュールによって、数 54 + 日かかる場合がある。 55 + - もし受け取られたら、パッチは他の開発者たちのレビューのために 56 + -stable キューに追加される。 57 + - セキュリティパッチはこのエイリアス (stable@kernel.org) に送られるべ 58 + きではなく、代わりに security@kernel.org のアドレスに送られる。 59 + 60 + レビューサイクル- 61 + 62 + - -stable メンテナがレビューサイクルを決めるとき、パッチはレビュー委 63 + 員会とパッチが影響する領域のメンテナ(提供者がその領域のメンテナで無 64 + い限り)に送られ、linux-kernel メーリングリストにCCされる。 65 + - レビュー委員会は 48時間の間に ACK か NAK を出す。 66 + - もしパッチが委員会のメンバから却下れるか、メンテナ達やメンバが気付 67 + かなかった問題が持ちあがり、linux-kernel メンバがパッチに異議を唱え 68 + た場合には、パッチはキューから削除される。 69 + - レビューサイクルの最後に、ACK を受けたパッチは最新の -stable リリー 70 + スに追加され、その後に新しい -stable リリースが行われる。 71 + - セキュリティパッチは、通常のレビューサイクルを通らず、セキュリティ 72 + カーネルチームから直接 -stable ツリーに受け付けられる。 73 + この手続きの詳細については kernel security チームに問い合わせること。 74 + 75 + レビュー委員会- 76 + 77 + - この委員会は、このタスクについて活動する多くのボランティアと、少数の 78 + 非ボランティアのカーネル開発者達で構成されている。 79 +
+13 -27
drivers/base/core.c
··· 423 int device_create_file(struct device *dev, struct device_attribute *attr) 424 { 425 int error = 0; 426 - if (get_device(dev)) { 427 error = sysfs_create_file(&dev->kobj, &attr->attr); 428 - put_device(dev); 429 - } 430 return error; 431 } 432 ··· 435 */ 436 void device_remove_file(struct device *dev, struct device_attribute *attr) 437 { 438 - if (get_device(dev)) { 439 sysfs_remove_file(&dev->kobj, &attr->attr); 440 - put_device(dev); 441 - } 442 } 443 444 /** ··· 1140 } 1141 EXPORT_SYMBOL_GPL(device_create); 1142 1143 - /** 1144 - * find_device - finds a device that was created with device_create() 1145 - * @class: pointer to the struct class that this device was registered with 1146 - * @devt: the dev_t of the device that was previously registered 1147 - */ 1148 - static struct device *find_device(struct class *class, dev_t devt) 1149 { 1150 - struct device *dev = NULL; 1151 - struct device *dev_tmp; 1152 1153 - down(&class->sem); 1154 - list_for_each_entry(dev_tmp, &class->devices, node) { 1155 - if (dev_tmp->devt == devt) { 1156 - dev = dev_tmp; 1157 - break; 1158 - } 1159 - } 1160 - up(&class->sem); 1161 - return dev; 1162 } 1163 1164 /** ··· 1159 { 1160 struct device *dev; 1161 1162 - dev = find_device(class, devt); 1163 - if (dev) 1164 device_unregister(dev); 1165 } 1166 EXPORT_SYMBOL_GPL(device_destroy); 1167 ··· 1187 { 1188 struct device *dev; 1189 1190 - dev = find_device(class, devt); 1191 - if (dev) 1192 device_pm_schedule_removal(dev); 1193 } 1194 EXPORT_SYMBOL_GPL(destroy_suspended_device); 1195 #endif /* CONFIG_PM_SLEEP */
··· 423 int device_create_file(struct device *dev, struct device_attribute *attr) 424 { 425 int error = 0; 426 + if (dev) 427 error = sysfs_create_file(&dev->kobj, &attr->attr); 428 return error; 429 } 430 ··· 437 */ 438 void device_remove_file(struct device *dev, struct device_attribute *attr) 439 { 440 + if (dev) 441 sysfs_remove_file(&dev->kobj, &attr->attr); 442 } 443 444 /** ··· 1144 } 1145 EXPORT_SYMBOL_GPL(device_create); 1146 1147 + static int __match_devt(struct device *dev, void *data) 1148 { 1149 + dev_t *devt = data; 1150 1151 + return dev->devt == *devt; 1152 } 1153 1154 /** ··· 1177 { 1178 struct device *dev; 1179 1180 + dev = class_find_device(class, &devt, __match_devt); 1181 + if (dev) { 1182 + put_device(dev); 1183 device_unregister(dev); 1184 + } 1185 } 1186 EXPORT_SYMBOL_GPL(device_destroy); 1187 ··· 1203 { 1204 struct device *dev; 1205 1206 + dev = class_find_device(class, &devt, __match_devt); 1207 + if (dev) { 1208 device_pm_schedule_removal(dev); 1209 + put_device(dev); 1210 + } 1211 } 1212 EXPORT_SYMBOL_GPL(destroy_suspended_device); 1213 #endif /* CONFIG_PM_SLEEP */
+3 -6
drivers/base/driver.c
··· 97 struct driver_attribute *attr) 98 { 99 int error; 100 - if (get_driver(drv)) { 101 error = sysfs_create_file(&drv->p->kobj, &attr->attr); 102 - put_driver(drv); 103 - } else 104 error = -EINVAL; 105 return error; 106 } ··· 113 void driver_remove_file(struct device_driver *drv, 114 struct driver_attribute *attr) 115 { 116 - if (get_driver(drv)) { 117 sysfs_remove_file(&drv->p->kobj, &attr->attr); 118 - put_driver(drv); 119 - } 120 } 121 EXPORT_SYMBOL_GPL(driver_remove_file); 122
··· 97 struct driver_attribute *attr) 98 { 99 int error; 100 + if (drv) 101 error = sysfs_create_file(&drv->p->kobj, &attr->attr); 102 + else 103 error = -EINVAL; 104 return error; 105 } ··· 114 void driver_remove_file(struct device_driver *drv, 115 struct driver_attribute *attr) 116 { 117 + if (drv) 118 sysfs_remove_file(&drv->p->kobj, &attr->attr); 119 } 120 EXPORT_SYMBOL_GPL(driver_remove_file); 121
+1
drivers/base/power/main.c
··· 129 list_move_tail(&dev->power.entry, &dpm_destroy); 130 mutex_unlock(&dpm_list_mtx); 131 } 132 133 /** 134 * pm_sleep_lock - mutual exclusion for registration and suspend
··· 129 list_move_tail(&dev->power.entry, &dpm_destroy); 130 mutex_unlock(&dpm_list_mtx); 131 } 132 + EXPORT_SYMBOL_GPL(device_pm_schedule_removal); 133 134 /** 135 * pm_sleep_lock - mutual exclusion for registration and suspend
-1
drivers/base/power/power.h
··· 13 14 extern void device_pm_add(struct device *); 15 extern void device_pm_remove(struct device *); 16 - extern void device_pm_schedule_removal(struct device *); 17 extern int pm_sleep_lock(void); 18 extern void pm_sleep_unlock(void); 19
··· 13 14 extern void device_pm_add(struct device *); 15 extern void device_pm_remove(struct device *); 16 extern int pm_sleep_lock(void); 17 extern void pm_sleep_unlock(void); 18
+60 -112
drivers/char/nozomi.c
··· 2 * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter 3 * 4 * Written by: Ulf Jakobsson, 5 - * Jan �erfeldt, 6 * Stefan Thomasson, 7 * 8 * Maintained by: Paul Hardwick (p.hardwick@option.com) ··· 36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 37 * 38 * -------------------------------------------------------------------------- 39 - */ 40 - 41 - /* 42 - * CHANGELOG 43 - * Version 2.1d 44 - * 11-November-2007 Jiri Slaby, Frank Seidel 45 - * - Big rework of multicard support by Jiri 46 - * - Major cleanups (semaphore to mutex, endianess, no major reservation) 47 - * - Optimizations 48 - * 49 - * Version 2.1c 50 - * 30-October-2007 Frank Seidel 51 - * - Completed multicard support 52 - * - Minor cleanups 53 - * 54 - * Version 2.1b 55 - * 07-August-2007 Frank Seidel 56 - * - Minor cleanups 57 - * - theoretical multicard support 58 - * 59 - * Version 2.1 60 - * 03-July-2006 Paul Hardwick 61 - * 62 - * - Stability Improvements. Incorporated spinlock wraps patch. 63 - * - Updated for newer 2.6.14+ kernels (tty_buffer_request_room) 64 - * - using __devexit macro for tty 65 - * 66 - * 67 - * Version 2.0 68 - * 08-feb-2006 15:34:10:Ulf 69 - * 70 - * -Fixed issue when not waking up line disipine layer, could probably result 71 - * in better uplink performance for 2.4. 72 - * 73 - * -Fixed issue with big endian during initalization, now proper toggle flags 74 - * are handled between preloader and maincode. 75 - * 76 - * -Fixed flow control issue. 77 - * 78 - * -Added support for setting DTR. 79 - * 80 - * -For 2.4 kernels, removing temporary buffer that's not needed. 81 - * 82 - * -Reading CTS only for modem port (only port that supports it). 83 - * 84 - * -Return 0 in write_room instead of netative value, it's not handled in 85 - * upper layer. 86 - * 87 - * -------------------------------------------------------------------------- 88 - * Version 1.0 89 - * 90 - * First version of driver, only tested with card of type F32_2. 91 - * Works fine with 2.4 and 2.6 kernels. 92 - * Driver also support big endian architecture. 93 */ 94 95 /* Enable this to have a lot of debug printouts */ ··· 89 /* Do we need this settable at runtime? */ 90 static int debug = NOZOMI_DEBUG_LEVEL; 91 92 - #define D(lvl, args...) do {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \ 93 - while (0) 94 #define D_(lvl, args...) D(lvl, ##args) 95 96 /* These printouts are always printed */ ··· 220 /* Big endian */ 221 222 struct toggles { 223 - unsigned enabled:5; /* 224 * Toggle fields are valid if enabled is 0, 225 * else A-channels must always be used. 226 */ 227 - unsigned diag_dl:1; 228 - unsigned mdm_dl:1; 229 - unsigned mdm_ul:1; 230 } __attribute__ ((packed)); 231 232 /* Configuration table to read at startup of card */ ··· 267 /* This stores all control downlink flags */ 268 struct ctrl_dl { 269 u8 port; 270 - unsigned reserved:4; 271 - unsigned CTS:1; 272 - unsigned RI:1; 273 - unsigned DCD:1; 274 - unsigned DSR:1; 275 } __attribute__ ((packed)); 276 277 /* This stores all control uplink flags */ 278 struct ctrl_ul { 279 u8 port; 280 - unsigned reserved:6; 281 - unsigned RTS:1; 282 - unsigned DTR:1; 283 } __attribute__ ((packed)); 284 285 #else ··· 287 288 /* This represents the toggle information */ 289 struct toggles { 290 - unsigned mdm_ul:1; 291 - unsigned mdm_dl:1; 292 - unsigned diag_dl:1; 293 - unsigned enabled:5; /* 294 * Toggle fields are valid if enabled is 0, 295 * else A-channels must always be used. 296 */ ··· 326 327 /* This stores all control downlink flags */ 328 struct ctrl_dl { 329 - unsigned DSR:1; 330 - unsigned DCD:1; 331 - unsigned RI:1; 332 - unsigned CTS:1; 333 - unsigned reserverd:4; 334 u8 port; 335 } __attribute__ ((packed)); 336 337 /* This stores all control uplink flags */ 338 struct ctrl_ul { 339 - unsigned DTR:1; 340 - unsigned RTS:1; 341 - unsigned reserved:6; 342 u8 port; 343 } __attribute__ ((packed)); 344 #endif ··· 395 } __attribute__ ((packed)); 396 397 /* Global variables */ 398 - static struct pci_device_id nozomi_pci_tbl[] = { 399 {PCI_DEVICE(VENDOR1, DEVICE1)}, 400 {}, 401 }; ··· 471 * -Optimize 472 * -Rewrite cleaner 473 */ 474 - static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf, 475 u32 size_bytes) 476 { 477 u32 i = 0; 478 u32 *ptr = (__force u32 *) mem_addr_start; 479 - u16 *buf16; 480 481 if (unlikely(!ptr || !buf)) 482 return 0; ··· 484 /* shortcut for extremely often used cases */ 485 switch (size_bytes) { 486 case 2: /* 2 bytes */ 487 - buf16 = (u16 *) buf; 488 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 489 return 2; 490 break; ··· 501 while (i < size_bytes) { 502 if (size_bytes - i == 2) { 503 /* 2 bytes */ 504 - buf16 = (u16 *) buf; 505 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 506 i += 2; 507 } else { ··· 641 dc->config_table.ul_ctrl_len); 642 } 643 #else 644 - static __inline__ void dump_table(const struct nozomi *dc) { } 645 #endif 646 647 /* ··· 723 /* Enable uplink interrupts */ 724 static void enable_transmit_ul(enum port_type port, struct nozomi *dc) 725 { 726 - u16 mask[NOZOMI_MAX_PORTS] = \ 727 - {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL}; 728 729 if (port < NOZOMI_MAX_PORTS) { 730 dc->last_ier |= mask[port]; ··· 736 /* Disable uplink interrupts */ 737 static void disable_transmit_ul(enum port_type port, struct nozomi *dc) 738 { 739 - u16 mask[NOZOMI_MAX_PORTS] = \ 740 - {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL}; 741 742 if (port < NOZOMI_MAX_PORTS) { 743 dc->last_ier &= mask[port]; ··· 750 /* Enable downlink interrupts */ 751 static void enable_transmit_dl(enum port_type port, struct nozomi *dc) 752 { 753 - u16 mask[NOZOMI_MAX_PORTS] = \ 754 - {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL}; 755 756 if (port < NOZOMI_MAX_PORTS) { 757 dc->last_ier |= mask[port]; ··· 763 /* Disable downlink interrupts */ 764 static void disable_transmit_dl(enum port_type port, struct nozomi *dc) 765 { 766 - u16 mask[NOZOMI_MAX_PORTS] = \ 767 - {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL}; 768 769 if (port < NOZOMI_MAX_PORTS) { 770 dc->last_ier &= mask[port]; ··· 778 * Return 1 - send buffer to card and ack. 779 * Return 0 - don't ack, don't send buffer to card. 780 */ 781 - static int send_data(enum port_type index, struct nozomi *dc) 782 { 783 u32 size = 0; 784 - struct port *port = &dc->port[index]; 785 - u8 toggle = port->toggle_ul; 786 void __iomem *addr = port->ul_addr[toggle]; 787 - u32 ul_size = port->ul_size[toggle]; 788 struct tty_struct *tty = port->tty; 789 790 /* Get data from tty and place in buf for now */ ··· 1047 } 1048 1049 /* 1050 - * Handle donlink data, ports that are handled are modem and diagnostics 1051 * Return 1 - ok 1052 * Return 0 - toggle fields are out of sync 1053 */ ··· 1304 static ssize_t card_type_show(struct device *dev, struct device_attribute *attr, 1305 char *buf) 1306 { 1307 - struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1308 1309 return sprintf(buf, "%d\n", dc->card_type); 1310 } 1311 - static DEVICE_ATTR(card_type, 0444, card_type_show, NULL); 1312 1313 static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr, 1314 char *buf) 1315 { 1316 - struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1317 1318 return sprintf(buf, "%u\n", dc->open_ttys); 1319 } 1320 - static DEVICE_ATTR(open_ttys, 0444, open_ttys_show, NULL); 1321 1322 static void make_sysfs_files(struct nozomi *dc) 1323 { ··· 1680 { 1681 struct port *port = tty->driver_data; 1682 int room = 0; 1683 - struct nozomi *dc = get_dc_by_tty(tty); 1684 1685 if (!dc || !port) 1686 return 0; ··· 1700 /* Gets io control parameters */ 1701 static int ntty_tiocmget(struct tty_struct *tty, struct file *file) 1702 { 1703 - struct port *port = tty->driver_data; 1704 - struct ctrl_dl *ctrl_dl = &port->ctrl_dl; 1705 - struct ctrl_ul *ctrl_ul = &port->ctrl_ul; 1706 1707 return (ctrl_ul->RTS ? TIOCM_RTS : 0) | 1708 (ctrl_ul->DTR ? TIOCM_DTR : 0) | ··· 1732 static int ntty_cflags_changed(struct port *port, unsigned long flags, 1733 struct async_icount *cprev) 1734 { 1735 - struct async_icount cnow = port->tty_icount; 1736 int ret; 1737 1738 ret = ((flags & TIOCM_RNG) && (cnow.rng != cprev->rng)) || ··· 1747 1748 static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) 1749 { 1750 - struct async_icount cnow = port->tty_icount; 1751 struct serial_icounter_struct icount; 1752 1753 icount.cts = cnow.cts; ··· 1827 /* just to discard single character writes */ 1828 static void ntty_put_char(struct tty_struct *tty, unsigned char c) 1829 { 1830 - /* FIXME !!! */ 1831 DBG2("PUT CHAR Function: %c", c); 1832 } 1833 ··· 1858 return rval; 1859 } 1860 1861 - static struct tty_operations tty_ops = { 1862 .ioctl = ntty_ioctl, 1863 .open = ntty_open, 1864 .close = ntty_close,
··· 2 * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter 3 * 4 * Written by: Ulf Jakobsson, 5 + * Jan Åkerfeldt, 6 * Stefan Thomasson, 7 * 8 * Maintained by: Paul Hardwick (p.hardwick@option.com) ··· 36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 37 * 38 * -------------------------------------------------------------------------- 39 */ 40 41 /* Enable this to have a lot of debug printouts */ ··· 143 /* Do we need this settable at runtime? */ 144 static int debug = NOZOMI_DEBUG_LEVEL; 145 146 + #define D(lvl, args...) do \ 147 + {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \ 148 + while (0) 149 #define D_(lvl, args...) D(lvl, ##args) 150 151 /* These printouts are always printed */ ··· 273 /* Big endian */ 274 275 struct toggles { 276 + unsigned int enabled:5; /* 277 * Toggle fields are valid if enabled is 0, 278 * else A-channels must always be used. 279 */ 280 + unsigned int diag_dl:1; 281 + unsigned int mdm_dl:1; 282 + unsigned int mdm_ul:1; 283 } __attribute__ ((packed)); 284 285 /* Configuration table to read at startup of card */ ··· 320 /* This stores all control downlink flags */ 321 struct ctrl_dl { 322 u8 port; 323 + unsigned int reserved:4; 324 + unsigned int CTS:1; 325 + unsigned int RI:1; 326 + unsigned int DCD:1; 327 + unsigned int DSR:1; 328 } __attribute__ ((packed)); 329 330 /* This stores all control uplink flags */ 331 struct ctrl_ul { 332 u8 port; 333 + unsigned int reserved:6; 334 + unsigned int RTS:1; 335 + unsigned int DTR:1; 336 } __attribute__ ((packed)); 337 338 #else ··· 340 341 /* This represents the toggle information */ 342 struct toggles { 343 + unsigned int mdm_ul:1; 344 + unsigned int mdm_dl:1; 345 + unsigned int diag_dl:1; 346 + unsigned int enabled:5; /* 347 * Toggle fields are valid if enabled is 0, 348 * else A-channels must always be used. 349 */ ··· 379 380 /* This stores all control downlink flags */ 381 struct ctrl_dl { 382 + unsigned int DSR:1; 383 + unsigned int DCD:1; 384 + unsigned int RI:1; 385 + unsigned int CTS:1; 386 + unsigned int reserverd:4; 387 u8 port; 388 } __attribute__ ((packed)); 389 390 /* This stores all control uplink flags */ 391 struct ctrl_ul { 392 + unsigned int DTR:1; 393 + unsigned int RTS:1; 394 + unsigned int reserved:6; 395 u8 port; 396 } __attribute__ ((packed)); 397 #endif ··· 448 } __attribute__ ((packed)); 449 450 /* Global variables */ 451 + static const struct pci_device_id nozomi_pci_tbl[] __devinitconst = { 452 {PCI_DEVICE(VENDOR1, DEVICE1)}, 453 {}, 454 }; ··· 524 * -Optimize 525 * -Rewrite cleaner 526 */ 527 + static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, 528 u32 size_bytes) 529 { 530 u32 i = 0; 531 u32 *ptr = (__force u32 *) mem_addr_start; 532 + const u16 *buf16; 533 534 if (unlikely(!ptr || !buf)) 535 return 0; ··· 537 /* shortcut for extremely often used cases */ 538 switch (size_bytes) { 539 case 2: /* 2 bytes */ 540 + buf16 = (const u16 *)buf; 541 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 542 return 2; 543 break; ··· 554 while (i < size_bytes) { 555 if (size_bytes - i == 2) { 556 /* 2 bytes */ 557 + buf16 = (const u16 *)buf; 558 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 559 i += 2; 560 } else { ··· 694 dc->config_table.ul_ctrl_len); 695 } 696 #else 697 + static inline void dump_table(const struct nozomi *dc) { } 698 #endif 699 700 /* ··· 776 /* Enable uplink interrupts */ 777 static void enable_transmit_ul(enum port_type port, struct nozomi *dc) 778 { 779 + static const u16 mask[] = {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL}; 780 781 if (port < NOZOMI_MAX_PORTS) { 782 dc->last_ier |= mask[port]; ··· 790 /* Disable uplink interrupts */ 791 static void disable_transmit_ul(enum port_type port, struct nozomi *dc) 792 { 793 + static const u16 mask[] = 794 + {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL}; 795 796 if (port < NOZOMI_MAX_PORTS) { 797 dc->last_ier &= mask[port]; ··· 804 /* Enable downlink interrupts */ 805 static void enable_transmit_dl(enum port_type port, struct nozomi *dc) 806 { 807 + static const u16 mask[] = {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL}; 808 809 if (port < NOZOMI_MAX_PORTS) { 810 dc->last_ier |= mask[port]; ··· 818 /* Disable downlink interrupts */ 819 static void disable_transmit_dl(enum port_type port, struct nozomi *dc) 820 { 821 + static const u16 mask[] = 822 + {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL}; 823 824 if (port < NOZOMI_MAX_PORTS) { 825 dc->last_ier &= mask[port]; ··· 833 * Return 1 - send buffer to card and ack. 834 * Return 0 - don't ack, don't send buffer to card. 835 */ 836 + static int send_data(enum port_type index, const struct nozomi *dc) 837 { 838 u32 size = 0; 839 + const struct port *port = &dc->port[index]; 840 + const u8 toggle = port->toggle_ul; 841 void __iomem *addr = port->ul_addr[toggle]; 842 + const u32 ul_size = port->ul_size[toggle]; 843 struct tty_struct *tty = port->tty; 844 845 /* Get data from tty and place in buf for now */ ··· 1102 } 1103 1104 /* 1105 + * Handle downlink data, ports that are handled are modem and diagnostics 1106 * Return 1 - ok 1107 * Return 0 - toggle fields are out of sync 1108 */ ··· 1359 static ssize_t card_type_show(struct device *dev, struct device_attribute *attr, 1360 char *buf) 1361 { 1362 + const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1363 1364 return sprintf(buf, "%d\n", dc->card_type); 1365 } 1366 + static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL); 1367 1368 static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr, 1369 char *buf) 1370 { 1371 + const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1372 1373 return sprintf(buf, "%u\n", dc->open_ttys); 1374 } 1375 + static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL); 1376 1377 static void make_sysfs_files(struct nozomi *dc) 1378 { ··· 1735 { 1736 struct port *port = tty->driver_data; 1737 int room = 0; 1738 + const struct nozomi *dc = get_dc_by_tty(tty); 1739 1740 if (!dc || !port) 1741 return 0; ··· 1755 /* Gets io control parameters */ 1756 static int ntty_tiocmget(struct tty_struct *tty, struct file *file) 1757 { 1758 + const struct port *port = tty->driver_data; 1759 + const struct ctrl_dl *ctrl_dl = &port->ctrl_dl; 1760 + const struct ctrl_ul *ctrl_ul = &port->ctrl_ul; 1761 1762 return (ctrl_ul->RTS ? TIOCM_RTS : 0) | 1763 (ctrl_ul->DTR ? TIOCM_DTR : 0) | ··· 1787 static int ntty_cflags_changed(struct port *port, unsigned long flags, 1788 struct async_icount *cprev) 1789 { 1790 + const struct async_icount cnow = port->tty_icount; 1791 int ret; 1792 1793 ret = ((flags & TIOCM_RNG) && (cnow.rng != cprev->rng)) || ··· 1802 1803 static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) 1804 { 1805 + const struct async_icount cnow = port->tty_icount; 1806 struct serial_icounter_struct icount; 1807 1808 icount.cts = cnow.cts; ··· 1882 /* just to discard single character writes */ 1883 static void ntty_put_char(struct tty_struct *tty, unsigned char c) 1884 { 1885 + /* 1886 + * card does not react correct when we write single chars 1887 + * to the card, so we discard them 1888 + */ 1889 DBG2("PUT CHAR Function: %c", c); 1890 } 1891 ··· 1910 return rval; 1911 } 1912 1913 + static const struct tty_operations tty_ops = { 1914 .ioctl = ntty_ioctl, 1915 .open = ntty_open, 1916 .close = ntty_close,
+6
include/linux/device.h
··· 534 extern void device_destroy(struct class *cls, dev_t devt); 535 #ifdef CONFIG_PM_SLEEP 536 extern void destroy_suspended_device(struct class *cls, dev_t devt); 537 #else /* !CONFIG_PM_SLEEP */ 538 static inline void destroy_suspended_device(struct class *cls, dev_t devt) 539 { 540 device_destroy(cls, devt); 541 } 542 #endif /* !CONFIG_PM_SLEEP */ 543
··· 534 extern void device_destroy(struct class *cls, dev_t devt); 535 #ifdef CONFIG_PM_SLEEP 536 extern void destroy_suspended_device(struct class *cls, dev_t devt); 537 + extern void device_pm_schedule_removal(struct device *); 538 #else /* !CONFIG_PM_SLEEP */ 539 static inline void destroy_suspended_device(struct class *cls, dev_t devt) 540 { 541 device_destroy(cls, devt); 542 + } 543 + 544 + static inline void device_pm_schedule_removal(struct device *dev) 545 + { 546 + device_unregister(dev); 547 } 548 #endif /* !CONFIG_PM_SLEEP */ 549
+1 -2
kernel/Makefile
··· 9 rcupdate.o extable.o params.o posix-timers.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ 12 - utsname.o notifier.o 13 14 obj-$(CONFIG_SYSCTL) += sysctl_check.o 15 obj-$(CONFIG_STACKTRACE) += stacktrace.o ··· 49 obj-$(CONFIG_AUDITSYSCALL) += auditsc.o 50 obj-$(CONFIG_AUDIT_TREE) += audit_tree.o 51 obj-$(CONFIG_KPROBES) += kprobes.o 52 - obj-$(CONFIG_SYSFS) += ksysfs.o 53 obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o 54 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ 55 obj-$(CONFIG_SECCOMP) += seccomp.o
··· 9 rcupdate.o extable.o params.o posix-timers.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ 12 + utsname.o notifier.o ksysfs.o 13 14 obj-$(CONFIG_SYSCTL) += sysctl_check.o 15 obj-$(CONFIG_STACKTRACE) += stacktrace.o ··· 49 obj-$(CONFIG_AUDITSYSCALL) += auditsc.o 50 obj-$(CONFIG_AUDIT_TREE) += audit_tree.o 51 obj-$(CONFIG_KPROBES) += kprobes.o 52 obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o 53 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ 54 obj-$(CONFIG_SECCOMP) += seccomp.o
+1 -1
lib/kobject.c
··· 637 * @name: the name for the kset 638 * @parent: the parent kobject of this kobject, if any. 639 * 640 - * This function creates a kset structure dynamically and registers it 641 * with sysfs. When you are finished with this structure, call 642 * kobject_put() and the structure will be dynamically freed when 643 * it is no longer being used.
··· 637 * @name: the name for the kset 638 * @parent: the parent kobject of this kobject, if any. 639 * 640 + * This function creates a kobject structure dynamically and registers it 641 * with sysfs. When you are finished with this structure, call 642 * kobject_put() and the structure will be dynamically freed when 643 * it is no longer being used.