summary refs log tree commit diff
AgeCommit message (Collapse)Author
2011-02-12[SCSI] Add detailed SCSI I/O errorsHannes Reinecke
Instead of just passing 'EIO' for any I/O error we should be notifying the upper layers with more details about the cause of this error. Update the possible I/O errors to: - ENOLINK: Link failure between host and target - EIO: Retryable I/O error - EREMOTEIO: Non-retryable I/O error - EBADE: I/O error restricted to the I_T_L nexus 'Retryable' in this context means that an I/O error _might_ be restricted to the I_T_L nexus (vulgo: path), so retrying on another nexus / path might succeed. 'Non-retryable' in general refers to a target failure, so this error will always be generated regardless of the I_T_L nexus it was send on. I/O errors restricted to the I_T_L nexus might be retried on another nexus / path, but they should _not_ be queued if no paths are available. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] scsi_dh_hp_sw: fix deadlock in start_stop_endioMike Snitzer
The use of blk_execute_rq_nowait() implies __blk_put_request() is needed in start_stop_endio() rather than blk_put_request() -- blk_finish_request() is called with queue lock already held. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] megaraid_sas: Sanity check user supplied length before passing it to ↵Bjørn Mork
dma_alloc_coherent() The ioc->sgl[i].iov_len value is supplied by the ioctl caller, and can be zero in some cases. Assume that's valid and continue without error. Fixes (multiple individual reports of the same problem for quite a while): http://marc.info/?l=linux-ide&m=128941801715301 http://bugs.debian.org/604627 http://www.mail-archive.com/linux-poweredge@dell.com/msg02575.html megasas: Failed to alloc kernel SGL buffer for IOCTL and [ 69.162538] ------------[ cut here ]------------ [ 69.162806] kernel BUG at /build/buildd/linux-2.6.32/lib/swiotlb.c:368! [ 69.163134] invalid opcode: 0000 [#1] SMP [ 69.163570] last sysfs file: /sys/devices/system/cpu/cpu3/cache/index2/shared_cpu_map [ 69.163975] CPU 0 [ 69.164227] Modules linked in: fbcon tileblit font bitblit softcursor vga16fb vgastate ioatdma radeon ttm drm_kms_helper shpchp drm i2c_algo_bit lp parport floppy pata_jmicron megaraid_sas igb dca [ 69.167419] Pid: 1206, comm: smartctl Tainted: G W 2.6.32-25-server #45-Ubuntu X8DTN [ 69.167843] RIP: 0010:[<ffffffff812c4dc5>] [<ffffffff812c4dc5>] map_single+0x255/0x260 [ 69.168370] RSP: 0018:ffff88081c0ebc58 EFLAGS: 00010246 [ 69.168655] RAX: 000000000003bffc RBX: 00000000ffffffff RCX: 0000000000000002 [ 69.169000] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88001dffe000 [ 69.169346] RBP: ffff88081c0ebcb8 R08: 0000000000000000 R09: ffff880000030840 [ 69.169691] R10: 0000000000100000 R11: 0000000000000000 R12: 0000000000000000 [ 69.170036] R13: 00000000ffffffff R14: 0000000000000001 R15: 0000000000200000 [ 69.170382] FS: 00007fb8de189720(0000) GS:ffff88001de00000(0000) knlGS:0000000000000000 [ 69.170794] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 69.171094] CR2: 00007fb8dd59237c CR3: 000000081a790000 CR4: 00000000000006f0 [ 69.171439] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 69.171784] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 69.172130] Process smartctl (pid: 1206, threadinfo ffff88081c0ea000, task ffff88081a760000) [ 69.194513] Stack: [ 69.205788] 0000000000000034 00000002817e3390 0000000000000000 ffff88081c0ebe00 [ 69.217739] <0> 0000000000000000 000000000003bffc 0000000000000000 0000000000000000 [ 69.241250] <0> 0000000000000000 00000000ffffffff ffff88081c5b4080 ffff88081c0ebe00 [ 69.277310] Call Trace: [ 69.289278] [<ffffffff812c52ac>] swiotlb_alloc_coherent+0xec/0x130 [ 69.301118] [<ffffffff81038b31>] x86_swiotlb_alloc_coherent+0x61/0x70 [ 69.313045] [<ffffffffa002d0ce>] megasas_mgmt_fw_ioctl+0x1ae/0x690 [megaraid_sas] [ 69.336399] [<ffffffffa002d748>] megasas_mgmt_ioctl_fw+0x198/0x240 [megaraid_sas] [ 69.359346] [<ffffffffa002f695>] megasas_mgmt_ioctl+0x35/0x50 [megaraid_sas] [ 69.370902] [<ffffffff81153b12>] vfs_ioctl+0x22/0xa0 [ 69.382322] [<ffffffff8115da2a>] ? alloc_fd+0x10a/0x150 [ 69.393622] [<ffffffff81153cb1>] do_vfs_ioctl+0x81/0x410 [ 69.404696] [<ffffffff8155cc13>] ? do_page_fault+0x153/0x3b0 [ 69.415761] [<ffffffff811540c1>] sys_ioctl+0x81/0xa0 [ 69.426640] [<ffffffff810121b2>] system_call_fastpath+0x16/0x1b [ 69.437491] Code: fe ff ff 48 8b 3d 74 38 76 00 41 bf 00 00 20 00 e8 51 f5 d7 ff 83 e0 ff 48 05 ff 07 00 00 48 c1 e8 0b 48 89 45 c8 e9 13 fe ff ff <0f> 0b eb fe 0f 1f 80 00 00 00 00 55 48 89 e5 48 83 ec 20 4c 89 [ 69.478216] RIP [<ffffffff812c4dc5>] map_single+0x255/0x260 [ 69.489668] RSP <ffff88081c0ebc58> [ 69.500975] ---[ end trace 6a2181b634e2abc7 ]--- Reported-by: Bokhan Artem <aptem@ngs.ru> Reported by: Marc-Christian Petersen <m.c.p@gmx.de> Signed-off-by: Bjørn Mork <bjorn@mork.no> Cc: "Benz, Michael" <Michael.Benz@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] pm8001: simplify workqueue usageTejun Heo
pm8001 manages its own list of pending works and cancel them on device free. It is unnecessarily complex and has a race condition - the works are canceled but not synced, so the work could still be running during and after the data structures are freed. This patch simplifies workqueue usage. * A driver specific workqueue pm8001_wq is created to serve these work items. * To avoid confusion, the "queue" suffixes are dropped from work items and functions. * Delayed queueing was never used. pm8001_work now uses work_struct instead. * The driver no longer keeps track of pending works. All pm8001_works are queued to pm8001_wq and the workqueue is flushed as necessary. flush_scheduled_work() usage is removed during conversion. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Jack Wang <jack_wang@usish.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-02-12[SCSI] remove flush_scheduled_work() usagesTejun Heo
Simple conversions to drop flush_scheduled_work() usages in drivers/scsi. More involved ones will be done in separate patches. * NCR5380, megaraid_sas: cancel_delayed_work() + flush_scheduled_work() -> cancel_delayed_work_sync(). * mpt2sas_scsih: drop unnecessary flush_scheduled_work(). * arcmsr_hba, ipr, pmcraid: flush the used work explicitly instead of using flush_scheduled_work(). Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_mid_low_api.txt recommend resid usageDouglas Gilbert
As discussed in a thread on this list titled: "RFC: short reads on block devices" this patch adds recommendations for LLDs to set resid when there might be uncertainty about how much data has been returned by a device. This patch inline and attached] is against scsi-misc-2.6.git Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] libosd: osd_req_read_sg, optimize the single entry caseBoaz Harrosh
Since sg-read is a bidi operation, it is a gain to convert a single sg entry into a regular read. Better do this in the generic layer then force each caller to do so. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] libsas: remove spurious sata control register read/writeJames Bottomley
Originally, libata required the illusion that it could access the sata control register. Now, however, it can run perfectly well without them, so remove the dummy routines from libsas which tried to emulate them (but only ended up causing confusion). Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] libsas: convert to standard kernel debuggingJames Bottomley
Instead of using a config option for debugging, just dump the messages with KERN_DEBUG. Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] libsas: fix ATAPI check condition terminationJames Bottomley
ATAPI check condition needs to be treated the same as a success or protocol return. The register returns from the PACKET command are all correctly positioned in the device to host register FIS and so we should collect them properly. Right at the moment this doesn't matter because libata sends a request sense always for ATAPI errors, but if it ever checked the registers, we should have the correct contents just in case. Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_dh: Use scsi_devinfo functions to do matching of device_handler ↵Peter Jones
tables. Previously we were using strncmp in order to avoid having to include whitespace in the devlist, but this means "HSV1000" matches a device list entry that says "HSV100", which is wrong. This patch changes scsi_dh.c to use scsi_devinfo's matching functions instead, since they handle these cases correctly. Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] Add scsi_dev_info_list_del_keyed()Peter Jones
For scsi_dh.c to use devinfo lists, we have to be able to remove entries before rmmod. Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] cxgb3i: fixed connection problem with iscsi private ipkxie@chelsio.com
fixed the connection problem when the private iscsi ipv4 address is provisioned on the interface. Signed-off-by: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] MAINTAINERS: Update zfcp entryChristof Schmitt
Steffen will take over the zfcp maintainer work. Update the MAINTAINERS entry accordingly. Acked-by: Steffen Maier <maier@linux.vnet.ibm.com> Acked-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] mptfusion: Fix memory leak in mptctl_getiocinfo()Jesper Juhl
A 'kfree(karg)' is missing in a failure path in mptctl.c::mptctl_getiocinfo() which can cause a memory leak. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] bnx2i: Added reconnect fix connecting against Lefthand targetsEddie Wai
The nopout's reserved field was not being initialized to zero before being reused. Stale CDB values from previous SCSI cmds of the same BHS offset was the cause of the disconnection initiated by the Lefthand target. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] cxgbi: get rid of gl_skb in cxgbi_ddp_infokxie@chelsio.com
Remove gl_skb from cxgbi_ddp_info as it is only used by cxgb3i. Signed-off-by: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] cxgbi: set ulpmode only if digest is onkxie@chelsio.com
There is no need to set ulpmode on the tx skbs if no digest is enabled. Signed-off-by: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: avoid leaking stack contents to userlandVasiliy Kulikov
memset arg64 to zero in the passthrough ioctls to avoid leaking contents of kernel stack memory to userland via uninitialized padding fields inserted by the compiler for alignment reasons. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: Fix problem that CMD_UNABORTABLE command status was treated as ↵Stephen M. Cameron
unknown Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: fix use of uninitialized variable in ↵Stephen M. Cameron
hpsa_add_msa2xxx_enclosure_device() Thanks to Scott Teel for noticing this. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: Add a per controller commands_outstanding entry in /sysStephen M. Cameron
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: use usleep_range not msleep for small sleepsStephen M. Cameron
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: allow driver to put controller in either simple or performant modeStephen M. Cameron
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: take the adapter lock in hpsa_wait_for_mode_change_ackStephen M. Cameron
Need to take the lock while accessing the register to check to see if config table changes have taken effect. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: do not reset unknown boards on reset_devicesStephen M. Cameron
This is to prevent hpsa from resetting older boards which the cciss driver may be controlling. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: limit commands allocated on reset_devicesStephen M. Cameron
This is to conserve memory in a memory-limited kdump scenario Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: Use kernel provided PCI state save and restore functionsStephen M. Cameron
and use the doorbell reset method if available (which doesn't lock up the controller if you properly save and restore all the PCI registers that you're supposed to.) Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: fix board status waiting codeStephen M. Cameron
After a reset, we should first wait for the board to become "not ready", and then wait for it to become "ready", instead of immediately waiting for it to become "ready", and do this waiting *after* restoring PCI config space registers. Also, only wait 10 secs for board to become "not ready" after a reset (it should quickly become not ready.) Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: Remove duplicate defines of DIRECT_LOOKUP_ constantsStephen M. Cameron
They are defined in hpsa_cmd.h Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: fixup DMA address before freeing.Stephen M. Cameron
Some low bits might have been set by the driver, causing a message like this to come out: [ 13.288062] ------------[ cut here ]------------ [ 13.293211] WARNING: at lib/dma-debug.c:803 check_unmap+0x1a1/0x654() [ 13.300387] Hardware name: ProLiant DL180 G6 [ 13.305335] hpsa 0000:06:00.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x000000007f81e001] [size=640 bytes] Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] hpsa: defend against zero sized buffers in passthru ioctlsStephen M. Cameron
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_dh_alua: add scalable ONTAP lun to dev listMike Snitzer
Currently NetApp's VID/PID details in the INQUIRY response shows up as 'NETAPP' and 'LUN'. With upcoming scalable SAN ONTAP version on NetApp controllers, the PID entry alone is being modified to 'LUN C-Mode' (to distinguish current ONTAP LUNs from scalable ONTAP LUNs). 'LUN' would still suffice for matching 'LUN C-Mode' but best to explicitly add these new NetApp LUNs to the device list. Reported-by: Martin George <marting@netapp.com> Acked-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_dh_alua: Add Promise VTrak to dev listIlgu Hong
Adds Promise VTrak devices to the ALUA device handler. Signed-off-by: Ilgu Hong <ilgu.hong@promise.com> Signed-off-by: Joseph Gruher <joseph.r.gruher@intel.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_dh_alua: fix stpg_endio group state reportingJoseph Gruher
Initialize stpg_endio() 'err' to SCSI_DH_OK and only change it to SCSI_DH_IO accordingly. This allows the switching of target group state to be properly reported when no error has occurred. Signed-off-by: Joseph Gruher <joseph.r.gruher@intel.com> Signed-off-by: Ilgu Hong <ilgu.hong@promise.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_dh_alua: fix deadlock in stpg_endioJoseph Gruher
The use of blk_execute_rq_nowait() implies __blk_put_request() is needed in stpg_endio() rather than blk_put_request() -- blk_finish_request() is called with queue lock already held. Signed-off-by: Joseph Gruher <joseph.r.gruher@intel.com> Signed-off-by: Ilgu Hong <ilgu.hong@promise.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: stable@kernel.org Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] scsi_dh_alua: fix submit_stpg returnJoseph Gruher
submit_stpg() will always return failure so alua_activate() will report failure via dm-multipath callback function. Even though the stpg fired successfuly dm-multipath does not know and always fails to change the valid path. By returning SCSI_DH_OK we're now skipping alua_activate()'s call to activate_complete 'fn'. But this is fine because stpg_endio() will call it via h->callback_fn(). Signed-off-by: Joseph Gruher <joseph.r.gruher@intel.com> Signed-off-by: Ilgu Hong <ilgu.hong@promise.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] mpt2sas: Bump version 08.100.00.00Kashyap, Desai
Upgrade driver version from 7.100.00.00 to 8.100.00.00 Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] mpt2sas: Basic Code Cleanup in mpt2sas_baseKashyap, Desai
Basic Code Cleanup: (1) _base_get_cb_idx and mpt2sas_base_free_smid were reorganized in similar fashion so the order of obtaining the cbx and smid are scsiio, hi_priority, and internal. (2) The hi_priority and internal request queue struct was made smaller by removing the scmd and chain_tracker, thus saving memory allocation. (3) For scsiio request, a new structure was created having the same elements from the former request tracker struct. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] mpt2sas: Add support for Customer specific branding messagesKashyap, Desai
Add support for Customer specific branding messages when device driver loads, based on specific customer subsystem vendor and device Ids Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24[SCSI] mpt2sas: Revision P MPI Header UpdateKashyap, Desai
Revision P MPI Header Update: a) Added enable/disable SATA NCQ operations to SAS IO Unit Control Request. b) Modified Host Based Discovery Action Request message format. c) Removed Device Path bit from IO Unit Page 1 Flags field. d) Added description of ChainOffset field for Diagnostic Data Upload Tool.Chaining is not allowed. Removed mpi2_history.txt file Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-01-24Merge branch 'BUG_ON' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus * 'BUG_ON' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: Remove MAYBE_BUILD_BUG_ON BUILD_BUG_ON: make it handle more cases
2011-01-24Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linusLinus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: module: fix missing semicolons in MODULE macro usage param: add null statement to compiled-in module params module: fix linker error for MODULE_VERSION when !MODULE and CONFIG_SYSFS=n module: show version information for built-in modules in sysfs
2011-01-24Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: selinux: return -ENOMEM when memory allocation fails tpm: fix panic caused by "tpm: Autodetect itpm devices" TPM: Long default timeout fix trusted keys: Fix a memory leak in trusted_update(). keys: add trusted and encrypted maintainers encrypted-keys: rename encrypted_defined files to encrypted trusted-keys: rename trusted_defined files to trusted
2011-01-24Remove MAYBE_BUILD_BUG_ONRusty Russell
Now BUILD_BUG_ON() can handle optimizable constants, we don't need MAYBE_BUILD_BUG_ON any more. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-01-24BUILD_BUG_ON: make it handle more casesRusty Russell
BUILD_BUG_ON used to use the optimizer to do code elimination or fail at link time; it was changed to first the size of a negative array (a nicer compile time error), then (in 8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield. This forced us to change some non-constant cases to MAYBE_BUILD_BUG_ON(); as Jan points out in that commit, it didn't work as intended anyway. bitfields: needs a literal constant at parse time, and can't be put under "if (__builtin_constant_p(x))" for example. negative array: can handle anything, but if the compiler can't tell it's a constant, silently has no effect. link time: breaks link if the compiler can't determine the value, but the linker output is not usually as informative as a compiler error. If we use the negative-array-size method *and* the link time trick, we get the ability to use BUILD_BUG_ON() under __builtin_constant_p() branches, and maximal ability for the compiler to detect errors at build time. We also document it thoroughly. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Jan Beulich <JBeulich@novell.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com>
2011-01-24module: fix missing semicolons in MODULE macro usageRusty Russell
You always needed them when you were a module, but the builtin versions of the macros used to be more lenient. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-01-24param: add null statement to compiled-in module paramsLinus Walleij
Add an unused struct declaration statement requiring a terminating semicolon to the compile-in case to provoke an error if __MODULE_INFO() is used without the terminating semicolon. Previously MODULE_ALIAS("foo") (no semicolon) compiled fine if MODULE was not selected. Cc: Dan Carpenter <error27@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-01-24module: fix linker error for MODULE_VERSION when !MODULE and CONFIG_SYSFS=nRusty Russell
lib/built-in.o:(__modver+0x8): undefined reference to `__modver_version_show' lib/built-in.o:(__modver+0x2c): undefined reference to `__modver_version_show' Simplest to just not emit anything: if they've disabled SYSFS they probably want the smallest kernel possible. Reported-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-01-24module: show version information for built-in modules in sysfsDmitry Torokhov
Currently only drivers that are built as modules have their versions shown in /sys/module/<module_name>/version, but this information might also be useful for built-in drivers as well. This especially important for drivers that do not define any parameters - such drivers, if built-in, are completely invisible from userspace. This patch changes MODULE_VERSION() macro so that in case when we are compiling built-in module, version information is stored in a separate section. Kernel then uses this data to create 'version' sysfs attribute in the same fashion it creates attributes for module parameters. Signed-off-by: Dmitry Torokhov <dtor@vmware.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>