2019-05-29 00:57:05 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2008-02-04 05:40:56 +08:00
|
|
|
/*
|
|
|
|
* Enclosure Services
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
|
|
|
|
*
|
|
|
|
**-----------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**-----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/enclosure.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/mutex.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
static LIST_HEAD(container_list);
|
|
|
|
static DEFINE_MUTEX(container_list_lock);
|
|
|
|
static struct class enclosure_class;
|
|
|
|
|
|
|
|
/**
|
2009-08-01 08:39:36 +08:00
|
|
|
* enclosure_find - find an enclosure given a parent device
|
|
|
|
* @dev: the parent to match against
|
|
|
|
* @start: Optional enclosure device to start from (NULL if none)
|
2008-02-04 05:40:56 +08:00
|
|
|
*
|
2009-08-01 08:39:36 +08:00
|
|
|
* Looks through the list of registered enclosures to find all those
|
|
|
|
* with @dev as a parent. Returns NULL if no enclosure is
|
|
|
|
* found. @start can be used as a starting point to obtain multiple
|
|
|
|
* enclosures per parent (should begin with NULL and then be set to
|
|
|
|
* each returned enclosure device). Obtains a reference to the
|
2022-12-15 17:08:04 +08:00
|
|
|
* enclosure class device which must be released with put_device().
|
2009-08-01 08:39:36 +08:00
|
|
|
* If @start is not NULL, a reference must be taken on it which is
|
|
|
|
* released before returning (this allows a loop through all
|
|
|
|
* enclosures to exit with only the reference on the enclosure of
|
|
|
|
* interest held). Note that the @dev may correspond to the actual
|
|
|
|
* device housing the enclosure, in which case no iteration via @start
|
|
|
|
* is required.
|
2008-02-04 05:40:56 +08:00
|
|
|
*/
|
2009-08-01 08:39:36 +08:00
|
|
|
struct enclosure_device *enclosure_find(struct device *dev,
|
|
|
|
struct enclosure_device *start)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
2008-02-22 07:13:36 +08:00
|
|
|
struct enclosure_device *edev;
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
mutex_lock(&container_list_lock);
|
2009-08-01 08:39:36 +08:00
|
|
|
edev = list_prepare_entry(start, &container_list, node);
|
|
|
|
if (start)
|
|
|
|
put_device(&start->edev);
|
|
|
|
|
|
|
|
list_for_each_entry_continue(edev, &container_list, node) {
|
|
|
|
struct device *parent = edev->edev.parent;
|
|
|
|
/* parent might not be immediate, so iterate up to
|
|
|
|
* the root of the tree if necessary */
|
|
|
|
while (parent) {
|
|
|
|
if (parent == dev) {
|
|
|
|
get_device(&edev->edev);
|
|
|
|
mutex_unlock(&container_list_lock);
|
|
|
|
return edev;
|
|
|
|
}
|
|
|
|
parent = parent->parent;
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
mutex_unlock(&container_list_lock);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_find);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enclosure_for_each_device - calls a function for each enclosure
|
|
|
|
* @fn: the function to call
|
|
|
|
* @data: the data to pass to each call
|
|
|
|
*
|
|
|
|
* Loops over all the enclosures calling the function.
|
|
|
|
*
|
|
|
|
* Note, this function uses a mutex which will be held across calls to
|
|
|
|
* @fn, so it must have non atomic context, and @fn may (although it
|
|
|
|
* should not) sleep or otherwise cause the mutex to be held for
|
|
|
|
* indefinite periods
|
|
|
|
*/
|
|
|
|
int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *),
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
struct enclosure_device *edev;
|
|
|
|
|
|
|
|
mutex_lock(&container_list_lock);
|
|
|
|
list_for_each_entry(edev, &container_list, node) {
|
|
|
|
error = fn(edev, data);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
mutex_unlock(&container_list_lock);
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_for_each_device);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enclosure_register - register device as an enclosure
|
|
|
|
*
|
|
|
|
* @dev: device containing the enclosure
|
2020-07-01 16:58:44 +08:00
|
|
|
* @name: chosen device name
|
2008-02-04 05:40:56 +08:00
|
|
|
* @components: number of components in the enclosure
|
2020-07-01 16:58:44 +08:00
|
|
|
* @cb: platform call-backs
|
2008-02-04 05:40:56 +08:00
|
|
|
*
|
|
|
|
* This sets up the device for being an enclosure. Note that @dev does
|
|
|
|
* not have to be a dedicated enclosure device. It may be some other type
|
|
|
|
* of device that additionally responds to enclosure services
|
|
|
|
*/
|
|
|
|
struct enclosure_device *
|
|
|
|
enclosure_register(struct device *dev, const char *name, int components,
|
|
|
|
struct enclosure_component_callbacks *cb)
|
|
|
|
{
|
|
|
|
struct enclosure_device *edev =
|
2019-01-08 23:32:08 +08:00
|
|
|
kzalloc(struct_size(edev, component, components), GFP_KERNEL);
|
2008-02-04 05:40:56 +08:00
|
|
|
int err, i;
|
|
|
|
|
|
|
|
BUG_ON(!cb);
|
|
|
|
|
|
|
|
if (!edev)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
|
|
edev->components = components;
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
edev->edev.class = &enclosure_class;
|
|
|
|
edev->edev.parent = get_device(dev);
|
2008-02-04 05:40:56 +08:00
|
|
|
edev->cb = cb;
|
2009-05-01 10:13:41 +08:00
|
|
|
dev_set_name(&edev->edev, "%s", name);
|
2008-02-22 07:13:36 +08:00
|
|
|
err = device_register(&edev->edev);
|
2008-02-04 05:40:56 +08:00
|
|
|
if (err)
|
|
|
|
goto err;
|
|
|
|
|
2014-12-31 06:46:17 +08:00
|
|
|
for (i = 0; i < components; i++) {
|
2008-02-04 05:40:56 +08:00
|
|
|
edev->component[i].number = -1;
|
2014-12-31 06:46:17 +08:00
|
|
|
edev->component[i].slot = -1;
|
scsi: ses: don't get power status of SES device slot on probe
The commit 08024885a2a3 ("ses: Add power_status to SES device slot")
introduced the 'power_status' attribute to enclosure components and
the associated callbacks.
There are 2 callbacks available to get the power status of a device:
1) ses_get_power_status() for 'struct enclosure_component_callbacks'
2) get_component_power_status() for the sysfs device attribute
(these are available for kernel-space and user-space, respectively.)
However, despite both methods being available to get power status
on demand, that commit also introduced a call to get power status
in ses_enclosure_data_process().
This dramatically increased the total probe time for SCSI devices
on larger configurations, because ses_enclosure_data_process() is
called several times during the SCSI devices probe and loops over
the component devices (but that is another problem, another patch).
That results in a tremendous continuous hammering of SCSI Receive
Diagnostics commands to the enclosure-services device, which does
delay the total probe time for the SCSI devices __significantly__:
Originally, ~34 minutes on a system attached to ~170 disks:
[ 9214.490703] mpt3sas version 13.100.00.00 loaded
...
[11256.580231] scsi 17:0:177:0: qdepth(16), tagged(1), simple(0),
ordered(0), scsi_level(6), cmd_que(1)
With this patch, it decreased to ~2.5 minutes -- a 13.6x faster
[ 1002.992533] mpt3sas version 13.100.00.00 loaded
...
[ 1151.978831] scsi 11:0:177:0: qdepth(16), tagged(1), simple(0),
ordered(0), scsi_level(6), cmd_que(1)
Back to the commit discussion.. on the ses_get_power_status() call
introduced in ses_enclosure_data_process(): impact of removing it.
That may possibly be in place to initialize the power status value
on device probe. However, those 2 functions available to retrieve
that value _do_ automatically refresh/update it. So the potential
benefit would be a direct access of the 'power_status' field which
does not use the callbacks...
But the only reader of 'struct enclosure_component::power_status'
is the get_component_power_status() callback for sysfs attribute,
and it _does_ check for and call the .get_power_status callback,
(which indeed is defined and implemented by that commit), so the
power status value is, again, automatically updated.
So, the remaining potential for a direct/non-callback access to
the power_status attribute would be out-of-tree modules -- well,
for those, if they are for whatever reason interested in values
that are set during device probe and not up-to-date by the time
they need it.. well, that would be curious.
Well, to handle that more properly, set the initial power state
value to '-1' (i.e., uninitialized) instead of '1' (power 'on'),
and check for it in that callback which may do an direct access
to the field value _if_ a callback function is not defined.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Fixes: 08024885a2a3 ("ses: Add power_status to SES device slot")
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-04-05 23:18:19 +08:00
|
|
|
edev->component[i].power_status = -1;
|
2014-12-31 06:46:17 +08:00
|
|
|
}
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
mutex_lock(&container_list_lock);
|
|
|
|
list_add_tail(&edev->node, &container_list);
|
|
|
|
mutex_unlock(&container_list_lock);
|
|
|
|
|
|
|
|
return edev;
|
|
|
|
|
|
|
|
err:
|
2008-02-22 07:13:36 +08:00
|
|
|
put_device(edev->edev.parent);
|
2008-02-04 05:40:56 +08:00
|
|
|
kfree(edev);
|
|
|
|
return ERR_PTR(err);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_register);
|
|
|
|
|
|
|
|
static struct enclosure_component_callbacks enclosure_null_callbacks;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enclosure_unregister - remove an enclosure
|
|
|
|
*
|
|
|
|
* @edev: the registered enclosure to remove;
|
|
|
|
*/
|
|
|
|
void enclosure_unregister(struct enclosure_device *edev)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
mutex_lock(&container_list_lock);
|
|
|
|
list_del(&edev->node);
|
|
|
|
mutex_unlock(&container_list_lock);
|
|
|
|
|
|
|
|
for (i = 0; i < edev->components; i++)
|
|
|
|
if (edev->component[i].number != -1)
|
2008-02-22 07:13:36 +08:00
|
|
|
device_unregister(&edev->component[i].cdev);
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
/* prevent any callbacks into service user */
|
|
|
|
edev->cb = &enclosure_null_callbacks;
|
2008-02-22 07:13:36 +08:00
|
|
|
device_unregister(&edev->edev);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_unregister);
|
|
|
|
|
2008-03-16 02:01:40 +08:00
|
|
|
#define ENCLOSURE_NAME_SIZE 64
|
2014-10-04 21:35:15 +08:00
|
|
|
#define COMPONENT_NAME_SIZE 64
|
2008-03-16 02:01:40 +08:00
|
|
|
|
|
|
|
static void enclosure_link_name(struct enclosure_component *cdev, char *name)
|
|
|
|
{
|
|
|
|
strcpy(name, "enclosure_device:");
|
2008-12-04 05:41:36 +08:00
|
|
|
strcat(name, dev_name(&cdev->cdev));
|
2008-03-16 02:01:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void enclosure_remove_links(struct enclosure_component *cdev)
|
|
|
|
{
|
|
|
|
char name[ENCLOSURE_NAME_SIZE];
|
|
|
|
|
2015-03-19 06:56:16 +08:00
|
|
|
enclosure_link_name(cdev, name);
|
|
|
|
|
2013-11-16 06:58:00 +08:00
|
|
|
/*
|
|
|
|
* In odd circumstances, like multipath devices, something else may
|
|
|
|
* already have removed the links, so check for this condition first.
|
|
|
|
*/
|
2015-03-19 06:56:16 +08:00
|
|
|
if (cdev->dev->kobj.sd)
|
|
|
|
sysfs_remove_link(&cdev->dev->kobj, name);
|
2013-11-16 06:58:00 +08:00
|
|
|
|
2015-03-19 06:56:16 +08:00
|
|
|
if (cdev->cdev.kobj.sd)
|
|
|
|
sysfs_remove_link(&cdev->cdev.kobj, "device");
|
2008-03-16 02:01:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int enclosure_add_links(struct enclosure_component *cdev)
|
|
|
|
{
|
|
|
|
int error;
|
|
|
|
char name[ENCLOSURE_NAME_SIZE];
|
|
|
|
|
|
|
|
error = sysfs_create_link(&cdev->cdev.kobj, &cdev->dev->kobj, "device");
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
enclosure_link_name(cdev, name);
|
|
|
|
error = sysfs_create_link(&cdev->dev->kobj, &cdev->cdev.kobj, name);
|
|
|
|
if (error)
|
|
|
|
sysfs_remove_link(&cdev->cdev.kobj, "device");
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static void enclosure_release(struct device *cdev)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev);
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
put_device(cdev->parent);
|
2008-02-04 05:40:56 +08:00
|
|
|
kfree(edev);
|
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static void enclosure_component_release(struct device *dev)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
2008-02-22 07:13:36 +08:00
|
|
|
struct enclosure_component *cdev = to_enclosure_component(dev);
|
|
|
|
|
2008-03-16 02:01:40 +08:00
|
|
|
if (cdev->dev) {
|
|
|
|
enclosure_remove_links(cdev);
|
|
|
|
put_device(cdev->dev);
|
|
|
|
}
|
2008-02-22 07:13:36 +08:00
|
|
|
put_device(dev->parent);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
2014-10-04 21:35:15 +08:00
|
|
|
static struct enclosure_component *
|
|
|
|
enclosure_component_find_by_name(struct enclosure_device *edev,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
const char *cname;
|
|
|
|
struct enclosure_component *ecomp;
|
|
|
|
|
|
|
|
if (!edev || !name || !name[0])
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < edev->components; i++) {
|
|
|
|
ecomp = &edev->component[i];
|
|
|
|
cname = dev_name(&ecomp->cdev);
|
|
|
|
if (ecomp->number != -1 &&
|
|
|
|
cname && cname[0] &&
|
|
|
|
!strcmp(cname, name))
|
|
|
|
return ecomp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-25 06:05:16 +08:00
|
|
|
static const struct attribute_group *enclosure_component_groups[];
|
2008-03-16 02:01:40 +08:00
|
|
|
|
2008-02-04 05:40:56 +08:00
|
|
|
/**
|
2014-12-31 06:46:14 +08:00
|
|
|
* enclosure_component_alloc - prepare a new enclosure component
|
2008-02-04 05:40:56 +08:00
|
|
|
* @edev: the enclosure to add the component
|
2020-07-01 16:58:44 +08:00
|
|
|
* @number: the device number
|
2008-02-04 05:40:56 +08:00
|
|
|
* @type: the type of component being added
|
|
|
|
* @name: an optional name to appear in sysfs (leave NULL if none)
|
|
|
|
*
|
2014-12-31 06:46:14 +08:00
|
|
|
* The name is optional for enclosures that give their components a unique
|
|
|
|
* name. If not, leave the field NULL and a name will be assigned.
|
2008-02-04 05:40:56 +08:00
|
|
|
*
|
|
|
|
* Returns a pointer to the enclosure component or an error.
|
|
|
|
*/
|
|
|
|
struct enclosure_component *
|
2014-12-31 06:46:14 +08:00
|
|
|
enclosure_component_alloc(struct enclosure_device *edev,
|
|
|
|
unsigned int number,
|
|
|
|
enum enclosure_component_type type,
|
|
|
|
const char *name)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_component *ecomp;
|
2008-02-22 07:13:36 +08:00
|
|
|
struct device *cdev;
|
2014-12-31 06:46:14 +08:00
|
|
|
int i;
|
2014-10-04 21:35:15 +08:00
|
|
|
char newname[COMPONENT_NAME_SIZE];
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
if (number >= edev->components)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
ecomp = &edev->component[number];
|
|
|
|
|
|
|
|
if (ecomp->number != -1)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
ecomp->type = type;
|
|
|
|
ecomp->number = number;
|
|
|
|
cdev = &ecomp->cdev;
|
2008-02-22 07:13:36 +08:00
|
|
|
cdev->parent = get_device(&edev->edev);
|
2014-10-04 21:35:15 +08:00
|
|
|
|
|
|
|
if (name && name[0]) {
|
|
|
|
/* Some hardware (e.g. enclosure in RX300 S6) has components
|
|
|
|
* with non unique names. Registering duplicates in sysfs
|
|
|
|
* will lead to warnings during bootup. So make the names
|
|
|
|
* unique by appending consecutive numbers -1, -2, ... */
|
|
|
|
i = 1;
|
|
|
|
snprintf(newname, COMPONENT_NAME_SIZE,
|
|
|
|
"%s", name);
|
|
|
|
while (enclosure_component_find_by_name(edev, newname))
|
|
|
|
snprintf(newname, COMPONENT_NAME_SIZE,
|
|
|
|
"%s-%i", name, i++);
|
|
|
|
dev_set_name(cdev, "%s", newname);
|
|
|
|
} else
|
2008-12-04 05:41:36 +08:00
|
|
|
dev_set_name(cdev, "%u", number);
|
2008-02-04 05:40:56 +08:00
|
|
|
|
2008-03-16 02:01:40 +08:00
|
|
|
cdev->release = enclosure_component_release;
|
2013-07-25 06:05:16 +08:00
|
|
|
cdev->groups = enclosure_component_groups;
|
2008-03-16 02:01:40 +08:00
|
|
|
|
2014-12-31 06:46:14 +08:00
|
|
|
return ecomp;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_component_alloc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enclosure_component_register - publishes an initialized enclosure component
|
|
|
|
* @ecomp: component to add
|
|
|
|
*
|
|
|
|
* Returns 0 on successful registration, releases the component otherwise
|
|
|
|
*/
|
|
|
|
int enclosure_component_register(struct enclosure_component *ecomp)
|
|
|
|
{
|
|
|
|
struct device *cdev;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
cdev = &ecomp->cdev;
|
2008-02-22 07:13:36 +08:00
|
|
|
err = device_register(cdev);
|
2010-03-13 06:14:42 +08:00
|
|
|
if (err) {
|
|
|
|
ecomp->number = -1;
|
|
|
|
put_device(cdev);
|
2014-12-31 06:46:14 +08:00
|
|
|
return err;
|
2010-03-13 06:14:42 +08:00
|
|
|
}
|
2008-02-04 05:40:56 +08:00
|
|
|
|
2014-12-31 06:46:14 +08:00
|
|
|
return 0;
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_component_register);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enclosure_add_device - add a device as being part of an enclosure
|
|
|
|
* @edev: the enclosure device being added to.
|
2020-07-01 16:58:44 +08:00
|
|
|
* @component: the number of the component
|
2008-02-04 05:40:56 +08:00
|
|
|
* @dev: the device being added
|
|
|
|
*
|
|
|
|
* Declares a real device to reside in slot (or identifier) @num of an
|
|
|
|
* enclosure. This will cause the relevant sysfs links to appear.
|
|
|
|
* This function may also be used to change a device associated with
|
|
|
|
* an enclosure without having to call enclosure_remove_device() in
|
|
|
|
* between.
|
|
|
|
*
|
|
|
|
* Returns zero on success or an error.
|
|
|
|
*/
|
|
|
|
int enclosure_add_device(struct enclosure_device *edev, int component,
|
|
|
|
struct device *dev)
|
|
|
|
{
|
2008-02-22 07:13:36 +08:00
|
|
|
struct enclosure_component *cdev;
|
2017-06-27 17:53:27 +08:00
|
|
|
int err;
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
if (!edev || component >= edev->components)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
cdev = &edev->component[component];
|
2008-02-04 05:40:56 +08:00
|
|
|
|
2009-08-01 08:43:59 +08:00
|
|
|
if (cdev->dev == dev)
|
|
|
|
return -EEXIST;
|
|
|
|
|
2017-06-27 17:53:27 +08:00
|
|
|
if (cdev->dev) {
|
2008-03-16 02:01:40 +08:00
|
|
|
enclosure_remove_links(cdev);
|
2017-06-27 17:53:27 +08:00
|
|
|
put_device(cdev->dev);
|
|
|
|
}
|
2008-02-04 05:40:56 +08:00
|
|
|
cdev->dev = get_device(dev);
|
2017-06-27 17:53:27 +08:00
|
|
|
err = enclosure_add_links(cdev);
|
|
|
|
if (err) {
|
|
|
|
put_device(cdev->dev);
|
|
|
|
cdev->dev = NULL;
|
|
|
|
}
|
|
|
|
return err;
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_add_device);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enclosure_remove_device - remove a device from an enclosure
|
|
|
|
* @edev: the enclosure device
|
2020-07-01 16:58:48 +08:00
|
|
|
* @dev: device to remove/put
|
2008-02-04 05:40:56 +08:00
|
|
|
*
|
|
|
|
* Returns zero on success or an error.
|
|
|
|
*
|
|
|
|
*/
|
2009-08-01 08:41:22 +08:00
|
|
|
int enclosure_remove_device(struct enclosure_device *edev, struct device *dev)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
2008-02-22 07:13:36 +08:00
|
|
|
struct enclosure_component *cdev;
|
2009-08-01 08:41:22 +08:00
|
|
|
int i;
|
2008-02-04 05:40:56 +08:00
|
|
|
|
2009-08-01 08:41:22 +08:00
|
|
|
if (!edev || !dev)
|
2008-02-04 05:40:56 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2009-08-01 08:41:22 +08:00
|
|
|
for (i = 0; i < edev->components; i++) {
|
|
|
|
cdev = &edev->component[i];
|
|
|
|
if (cdev->dev == dev) {
|
|
|
|
enclosure_remove_links(cdev);
|
|
|
|
put_device(dev);
|
|
|
|
cdev->dev = NULL;
|
2020-01-09 09:21:32 +08:00
|
|
|
return 0;
|
2009-08-01 08:41:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return -ENODEV;
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(enclosure_remove_device);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sysfs pieces below
|
|
|
|
*/
|
|
|
|
|
2013-07-25 06:05:16 +08:00
|
|
|
static ssize_t components_show(struct device *cdev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev);
|
|
|
|
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%d\n", edev->components);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
2013-07-25 06:05:16 +08:00
|
|
|
static DEVICE_ATTR_RO(components);
|
2008-02-04 05:40:56 +08:00
|
|
|
|
2014-12-31 06:46:16 +08:00
|
|
|
static ssize_t id_show(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev);
|
|
|
|
|
|
|
|
if (edev->cb->show_id)
|
|
|
|
return edev->cb->show_id(edev, buf);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(id);
|
|
|
|
|
2013-07-25 06:05:16 +08:00
|
|
|
static struct attribute *enclosure_class_attrs[] = {
|
|
|
|
&dev_attr_components.attr,
|
2014-12-31 06:46:16 +08:00
|
|
|
&dev_attr_id.attr,
|
2013-07-25 06:05:16 +08:00
|
|
|
NULL,
|
2008-02-04 05:40:56 +08:00
|
|
|
};
|
2013-07-25 06:05:16 +08:00
|
|
|
ATTRIBUTE_GROUPS(enclosure_class);
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
static struct class enclosure_class = {
|
|
|
|
.name = "enclosure",
|
2008-02-22 07:13:36 +08:00
|
|
|
.dev_release = enclosure_release,
|
2013-07-25 06:05:16 +08:00
|
|
|
.dev_groups = enclosure_class_groups,
|
2008-02-04 05:40:56 +08:00
|
|
|
};
|
|
|
|
|
2017-11-29 21:08:31 +08:00
|
|
|
static const char *const enclosure_status[] = {
|
2008-02-04 05:40:56 +08:00
|
|
|
[ENCLOSURE_STATUS_UNSUPPORTED] = "unsupported",
|
|
|
|
[ENCLOSURE_STATUS_OK] = "OK",
|
|
|
|
[ENCLOSURE_STATUS_CRITICAL] = "critical",
|
|
|
|
[ENCLOSURE_STATUS_NON_CRITICAL] = "non-critical",
|
|
|
|
[ENCLOSURE_STATUS_UNRECOVERABLE] = "unrecoverable",
|
|
|
|
[ENCLOSURE_STATUS_NOT_INSTALLED] = "not installed",
|
|
|
|
[ENCLOSURE_STATUS_UNKNOWN] = "unknown",
|
|
|
|
[ENCLOSURE_STATUS_UNAVAILABLE] = "unavailable",
|
2009-11-26 23:50:20 +08:00
|
|
|
[ENCLOSURE_STATUS_MAX] = NULL,
|
2008-02-04 05:40:56 +08:00
|
|
|
};
|
|
|
|
|
2017-11-29 21:08:31 +08:00
|
|
|
static const char *const enclosure_type[] = {
|
2008-02-04 05:40:56 +08:00
|
|
|
[ENCLOSURE_COMPONENT_DEVICE] = "device",
|
|
|
|
[ENCLOSURE_COMPONENT_ARRAY_DEVICE] = "array device",
|
|
|
|
};
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t get_component_fault(struct device *cdev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
|
|
|
|
if (edev->cb->get_fault)
|
|
|
|
edev->cb->get_fault(edev, ecomp);
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%d\n", ecomp->fault);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t set_component_fault(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
const char *buf, size_t count)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
int val = simple_strtoul(buf, NULL, 0);
|
|
|
|
|
|
|
|
if (edev->cb->set_fault)
|
|
|
|
edev->cb->set_fault(edev, ecomp, val);
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t get_component_status(struct device *cdev,
|
|
|
|
struct device_attribute *attr,char *buf)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
|
|
|
|
if (edev->cb->get_status)
|
|
|
|
edev->cb->get_status(edev, ecomp);
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%s\n", enclosure_status[ecomp->status]);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t set_component_status(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
const char *buf, size_t count)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; enclosure_status[i]; i++) {
|
|
|
|
if (strncmp(buf, enclosure_status[i],
|
|
|
|
strlen(enclosure_status[i])) == 0 &&
|
|
|
|
(buf[strlen(enclosure_status[i])] == '\n' ||
|
|
|
|
buf[strlen(enclosure_status[i])] == '\0'))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enclosure_status[i] && edev->cb->set_status) {
|
|
|
|
edev->cb->set_status(edev, ecomp, i);
|
|
|
|
return count;
|
|
|
|
} else
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t get_component_active(struct device *cdev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
|
|
|
|
if (edev->cb->get_active)
|
|
|
|
edev->cb->get_active(edev, ecomp);
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%d\n", ecomp->active);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t set_component_active(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
const char *buf, size_t count)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
int val = simple_strtoul(buf, NULL, 0);
|
|
|
|
|
|
|
|
if (edev->cb->set_active)
|
|
|
|
edev->cb->set_active(edev, ecomp, val);
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t get_component_locate(struct device *cdev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
|
|
|
|
if (edev->cb->get_locate)
|
|
|
|
edev->cb->get_locate(edev, ecomp);
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%d\n", ecomp->locate);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t set_component_locate(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
const char *buf, size_t count)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
int val = simple_strtoul(buf, NULL, 0);
|
|
|
|
|
|
|
|
if (edev->cb->set_locate)
|
|
|
|
edev->cb->set_locate(edev, ecomp, val);
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2014-12-31 06:46:18 +08:00
|
|
|
static ssize_t get_component_power_status(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
|
|
|
|
if (edev->cb->get_power_status)
|
|
|
|
edev->cb->get_power_status(edev, ecomp);
|
scsi: ses: don't get power status of SES device slot on probe
The commit 08024885a2a3 ("ses: Add power_status to SES device slot")
introduced the 'power_status' attribute to enclosure components and
the associated callbacks.
There are 2 callbacks available to get the power status of a device:
1) ses_get_power_status() for 'struct enclosure_component_callbacks'
2) get_component_power_status() for the sysfs device attribute
(these are available for kernel-space and user-space, respectively.)
However, despite both methods being available to get power status
on demand, that commit also introduced a call to get power status
in ses_enclosure_data_process().
This dramatically increased the total probe time for SCSI devices
on larger configurations, because ses_enclosure_data_process() is
called several times during the SCSI devices probe and loops over
the component devices (but that is another problem, another patch).
That results in a tremendous continuous hammering of SCSI Receive
Diagnostics commands to the enclosure-services device, which does
delay the total probe time for the SCSI devices __significantly__:
Originally, ~34 minutes on a system attached to ~170 disks:
[ 9214.490703] mpt3sas version 13.100.00.00 loaded
...
[11256.580231] scsi 17:0:177:0: qdepth(16), tagged(1), simple(0),
ordered(0), scsi_level(6), cmd_que(1)
With this patch, it decreased to ~2.5 minutes -- a 13.6x faster
[ 1002.992533] mpt3sas version 13.100.00.00 loaded
...
[ 1151.978831] scsi 11:0:177:0: qdepth(16), tagged(1), simple(0),
ordered(0), scsi_level(6), cmd_que(1)
Back to the commit discussion.. on the ses_get_power_status() call
introduced in ses_enclosure_data_process(): impact of removing it.
That may possibly be in place to initialize the power status value
on device probe. However, those 2 functions available to retrieve
that value _do_ automatically refresh/update it. So the potential
benefit would be a direct access of the 'power_status' field which
does not use the callbacks...
But the only reader of 'struct enclosure_component::power_status'
is the get_component_power_status() callback for sysfs attribute,
and it _does_ check for and call the .get_power_status callback,
(which indeed is defined and implemented by that commit), so the
power status value is, again, automatically updated.
So, the remaining potential for a direct/non-callback access to
the power_status attribute would be out-of-tree modules -- well,
for those, if they are for whatever reason interested in values
that are set during device probe and not up-to-date by the time
they need it.. well, that would be curious.
Well, to handle that more properly, set the initial power state
value to '-1' (i.e., uninitialized) instead of '1' (power 'on'),
and check for it in that callback which may do an direct access
to the field value _if_ a callback function is not defined.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Fixes: 08024885a2a3 ("ses: Add power_status to SES device slot")
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-04-05 23:18:19 +08:00
|
|
|
|
|
|
|
/* If still uninitialized, the callback failed or does not exist. */
|
|
|
|
if (ecomp->power_status == -1)
|
|
|
|
return (edev->cb->get_power_status) ? -EIO : -ENOTTY;
|
|
|
|
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%s\n", ecomp->power_status ? "on" : "off");
|
2014-12-31 06:46:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t set_component_power_status(struct device *cdev,
|
|
|
|
struct device_attribute *attr,
|
|
|
|
const char *buf, size_t count)
|
|
|
|
{
|
|
|
|
struct enclosure_device *edev = to_enclosure_device(cdev->parent);
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
int val;
|
|
|
|
|
|
|
|
if (strncmp(buf, "on", 2) == 0 &&
|
|
|
|
(buf[2] == '\n' || buf[2] == '\0'))
|
|
|
|
val = 1;
|
|
|
|
else if (strncmp(buf, "off", 3) == 0 &&
|
|
|
|
(buf[3] == '\n' || buf[3] == '\0'))
|
|
|
|
val = 0;
|
|
|
|
else
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (edev->cb->set_power_status)
|
|
|
|
edev->cb->set_power_status(edev, ecomp, val);
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2008-02-22 07:13:36 +08:00
|
|
|
static ssize_t get_component_type(struct device *cdev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
2008-02-04 05:40:56 +08:00
|
|
|
{
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%s\n", enclosure_type[ecomp->type]);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
2014-12-31 06:46:17 +08:00
|
|
|
static ssize_t get_component_slot(struct device *cdev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
{
|
|
|
|
struct enclosure_component *ecomp = to_enclosure_component(cdev);
|
|
|
|
int slot;
|
|
|
|
|
|
|
|
/* if the enclosure does not override then use 'number' as a stand-in */
|
|
|
|
if (ecomp->slot >= 0)
|
|
|
|
slot = ecomp->slot;
|
|
|
|
else
|
|
|
|
slot = ecomp->number;
|
|
|
|
|
2021-10-22 17:06:04 +08:00
|
|
|
return sysfs_emit(buf, "%d\n", slot);
|
2014-12-31 06:46:17 +08:00
|
|
|
}
|
2008-02-04 05:40:56 +08:00
|
|
|
|
2008-03-16 02:01:40 +08:00
|
|
|
static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault,
|
|
|
|
set_component_fault);
|
|
|
|
static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, get_component_status,
|
|
|
|
set_component_status);
|
|
|
|
static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active,
|
|
|
|
set_component_active);
|
|
|
|
static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate,
|
|
|
|
set_component_locate);
|
2014-12-31 06:46:18 +08:00
|
|
|
static DEVICE_ATTR(power_status, S_IRUGO | S_IWUSR, get_component_power_status,
|
|
|
|
set_component_power_status);
|
2008-03-16 02:01:40 +08:00
|
|
|
static DEVICE_ATTR(type, S_IRUGO, get_component_type, NULL);
|
2014-12-31 06:46:17 +08:00
|
|
|
static DEVICE_ATTR(slot, S_IRUGO, get_component_slot, NULL);
|
2008-03-16 02:01:40 +08:00
|
|
|
|
|
|
|
static struct attribute *enclosure_component_attrs[] = {
|
|
|
|
&dev_attr_fault.attr,
|
|
|
|
&dev_attr_status.attr,
|
|
|
|
&dev_attr_active.attr,
|
|
|
|
&dev_attr_locate.attr,
|
2014-12-31 06:46:18 +08:00
|
|
|
&dev_attr_power_status.attr,
|
2008-03-16 02:01:40 +08:00
|
|
|
&dev_attr_type.attr,
|
2014-12-31 06:46:17 +08:00
|
|
|
&dev_attr_slot.attr,
|
2008-03-16 02:01:40 +08:00
|
|
|
NULL
|
2008-02-04 05:40:56 +08:00
|
|
|
};
|
2013-07-25 06:05:16 +08:00
|
|
|
ATTRIBUTE_GROUPS(enclosure_component);
|
2008-02-04 05:40:56 +08:00
|
|
|
|
|
|
|
static int __init enclosure_init(void)
|
|
|
|
{
|
2017-11-29 21:08:32 +08:00
|
|
|
return class_register(&enclosure_class);
|
2008-02-04 05:40:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit enclosure_exit(void)
|
|
|
|
{
|
|
|
|
class_unregister(&enclosure_class);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(enclosure_init);
|
|
|
|
module_exit(enclosure_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("James Bottomley");
|
|
|
|
MODULE_DESCRIPTION("Enclosure Services");
|
|
|
|
MODULE_LICENSE("GPL v2");
|