sysfs.c (45808361d4491217de11cdf0661d657081f8f422) sysfs.c (e28bf1f03b01b135dc0052b3a195c2860e10f216)
1/*
2 * Copyright(c) 2015-2017 Intel Corporation.
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *

--- 137 unchanged lines hidden (view full) ---

146struct hfi1_port_attr {
147 struct attribute attr;
148 ssize_t (*show)(struct hfi1_pportdata *, char *);
149 ssize_t (*store)(struct hfi1_pportdata *, const char *, size_t);
150};
151
152static ssize_t cc_prescan_show(struct hfi1_pportdata *ppd, char *buf)
153{
1/*
2 * Copyright(c) 2015-2017 Intel Corporation.
3 *
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *

--- 137 unchanged lines hidden (view full) ---

146struct hfi1_port_attr {
147 struct attribute attr;
148 ssize_t (*show)(struct hfi1_pportdata *, char *);
149 ssize_t (*store)(struct hfi1_pportdata *, const char *, size_t);
150};
151
152static ssize_t cc_prescan_show(struct hfi1_pportdata *ppd, char *buf)
153{
154 return sprintf(buf, "%s\n", ppd->cc_prescan ? "on" : "off");
154 return sysfs_emit(buf, "%s\n", ppd->cc_prescan ? "on" : "off");
155}
156
157static ssize_t cc_prescan_store(struct hfi1_pportdata *ppd, const char *buf,
158 size_t count)
159{
160 if (!memcmp(buf, "on", 2))
161 ppd->cc_prescan = true;
162 else if (!memcmp(buf, "off", 3))

--- 128 unchanged lines hidden (view full) ---

291 char *buf)
292{
293 struct hfi1_sc2vl_attr *sattr =
294 container_of(attr, struct hfi1_sc2vl_attr, attr);
295 struct hfi1_pportdata *ppd =
296 container_of(kobj, struct hfi1_pportdata, sc2vl_kobj);
297 struct hfi1_devdata *dd = ppd->dd;
298
155}
156
157static ssize_t cc_prescan_store(struct hfi1_pportdata *ppd, const char *buf,
158 size_t count)
159{
160 if (!memcmp(buf, "on", 2))
161 ppd->cc_prescan = true;
162 else if (!memcmp(buf, "off", 3))

--- 128 unchanged lines hidden (view full) ---

291 char *buf)
292{
293 struct hfi1_sc2vl_attr *sattr =
294 container_of(attr, struct hfi1_sc2vl_attr, attr);
295 struct hfi1_pportdata *ppd =
296 container_of(kobj, struct hfi1_pportdata, sc2vl_kobj);
297 struct hfi1_devdata *dd = ppd->dd;
298
299 return sprintf(buf, "%u\n", *((u8 *)dd->sc2vl + sattr->sc));
299 return sysfs_emit(buf, "%u\n", *((u8 *)dd->sc2vl + sattr->sc));
300}
301
302static const struct sysfs_ops hfi1_sc2vl_ops = {
303 .show = sc2vl_attr_show,
304};
305
306static struct kobj_type hfi1_sc2vl_ktype = {
307 .release = port_release,

--- 88 unchanged lines hidden (view full) ---

396 char *buf)
397{
398 struct hfi1_sl2sc_attr *sattr =
399 container_of(attr, struct hfi1_sl2sc_attr, attr);
400 struct hfi1_pportdata *ppd =
401 container_of(kobj, struct hfi1_pportdata, sl2sc_kobj);
402 struct hfi1_ibport *ibp = &ppd->ibport_data;
403
300}
301
302static const struct sysfs_ops hfi1_sc2vl_ops = {
303 .show = sc2vl_attr_show,
304};
305
306static struct kobj_type hfi1_sc2vl_ktype = {
307 .release = port_release,

--- 88 unchanged lines hidden (view full) ---

396 char *buf)
397{
398 struct hfi1_sl2sc_attr *sattr =
399 container_of(attr, struct hfi1_sl2sc_attr, attr);
400 struct hfi1_pportdata *ppd =
401 container_of(kobj, struct hfi1_pportdata, sl2sc_kobj);
402 struct hfi1_ibport *ibp = &ppd->ibport_data;
403
404 return sprintf(buf, "%u\n", ibp->sl_to_sc[sattr->sl]);
404 return sysfs_emit(buf, "%u\n", ibp->sl_to_sc[sattr->sl]);
405}
406
407static const struct sysfs_ops hfi1_sl2sc_ops = {
408 .show = sl2sc_attr_show,
409};
410
411static struct kobj_type hfi1_sl2sc_ktype = {
412 .release = port_release,

--- 57 unchanged lines hidden (view full) ---

470 char *buf)
471{
472 struct hfi1_vl2mtu_attr *vlattr =
473 container_of(attr, struct hfi1_vl2mtu_attr, attr);
474 struct hfi1_pportdata *ppd =
475 container_of(kobj, struct hfi1_pportdata, vl2mtu_kobj);
476 struct hfi1_devdata *dd = ppd->dd;
477
405}
406
407static const struct sysfs_ops hfi1_sl2sc_ops = {
408 .show = sl2sc_attr_show,
409};
410
411static struct kobj_type hfi1_sl2sc_ktype = {
412 .release = port_release,

--- 57 unchanged lines hidden (view full) ---

470 char *buf)
471{
472 struct hfi1_vl2mtu_attr *vlattr =
473 container_of(attr, struct hfi1_vl2mtu_attr, attr);
474 struct hfi1_pportdata *ppd =
475 container_of(kobj, struct hfi1_pportdata, vl2mtu_kobj);
476 struct hfi1_devdata *dd = ppd->dd;
477
478 return sprintf(buf, "%u\n", dd->vld[vlattr->vl].mtu);
478 return sysfs_emit(buf, "%u\n", dd->vld[vlattr->vl].mtu);
479}
480
481static const struct sysfs_ops hfi1_vl2mtu_ops = {
482 .show = vl2mtu_attr_show,
483};
484
485static struct kobj_type hfi1_vl2mtu_ktype = {
486 .release = port_release,

--- 321 unchanged lines hidden (view full) ---

808static ssize_t sde_show_vl(struct sdma_engine *sde, char *buf)
809{
810 int vl;
811
812 vl = sdma_engine_get_vl(sde);
813 if (vl < 0)
814 return vl;
815
479}
480
481static const struct sysfs_ops hfi1_vl2mtu_ops = {
482 .show = vl2mtu_attr_show,
483};
484
485static struct kobj_type hfi1_vl2mtu_ktype = {
486 .release = port_release,

--- 321 unchanged lines hidden (view full) ---

808static ssize_t sde_show_vl(struct sdma_engine *sde, char *buf)
809{
810 int vl;
811
812 vl = sdma_engine_get_vl(sde);
813 if (vl < 0)
814 return vl;
815
816 return snprintf(buf, PAGE_SIZE, "%d\n", vl);
816 return sysfs_emit(buf, "%d\n", vl);
817}
818
819static SDE_ATTR(cpu_list, S_IWUSR | S_IRUGO,
820 sde_show_cpu_to_sde_map,
821 sde_store_cpu_to_sde_map);
822static SDE_ATTR(vl, S_IRUGO, sde_show_vl, NULL);
823
824static struct sde_attribute *sde_attribs[] = {

--- 66 unchanged lines hidden ---
817}
818
819static SDE_ATTR(cpu_list, S_IWUSR | S_IRUGO,
820 sde_show_cpu_to_sde_map,
821 sde_store_cpu_to_sde_map);
822static SDE_ATTR(vl, S_IRUGO, sde_show_vl, NULL);
823
824static struct sde_attribute *sde_attribs[] = {

--- 66 unchanged lines hidden ---