x86/amd-iommu: Add function to complete a tlb flush
[linux/fpc-iii.git] / drivers / scsi / fnic / fnic_attrs.c
blobaea0c3becfd45020ad4fec52e28c5f73bc4a892d
1 /*
2 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
5 * This program is free software; you may redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
10 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
13 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
14 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
15 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16 * SOFTWARE.
18 #include <linux/string.h>
19 #include <linux/device.h>
20 #include <scsi/scsi_host.h>
21 #include "fnic.h"
23 static ssize_t fnic_show_state(struct device *dev,
24 struct device_attribute *attr, char *buf)
26 struct fc_lport *lp = shost_priv(class_to_shost(dev));
27 struct fnic *fnic = lport_priv(lp);
29 return snprintf(buf, PAGE_SIZE, "%s\n", fnic_state_str[fnic->state]);
32 static ssize_t fnic_show_drv_version(struct device *dev,
33 struct device_attribute *attr, char *buf)
35 return snprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION);
38 static ssize_t fnic_show_link_state(struct device *dev,
39 struct device_attribute *attr, char *buf)
41 struct fc_lport *lp = shost_priv(class_to_shost(dev));
43 return snprintf(buf, PAGE_SIZE, "%s\n", (lp->link_up)
44 ? "Link Up" : "Link Down");
47 static DEVICE_ATTR(fnic_state, S_IRUGO, fnic_show_state, NULL);
48 static DEVICE_ATTR(drv_version, S_IRUGO, fnic_show_drv_version, NULL);
49 static DEVICE_ATTR(link_state, S_IRUGO, fnic_show_link_state, NULL);
51 struct device_attribute *fnic_attrs[] = {
52 &dev_attr_fnic_state,
53 &dev_attr_drv_version,
54 &dev_attr_link_state,
55 NULL,