diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 6784cd11..119030f9 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -69,7 +69,7 @@ static ssize_t elcg_enable_read(struct device *dev, | |||
69 | { | 69 | { |
70 | struct gk20a *g = get_gk20a(dev); | 70 | struct gk20a *g = get_gk20a(dev); |
71 | 71 | ||
72 | return sprintf(buf, "%d\n", g->elcg_enabled ? 1 : 0); | 72 | return snprintf(buf, PAGE_SIZE, "%d\n", g->elcg_enabled ? 1 : 0); |
73 | } | 73 | } |
74 | 74 | ||
75 | static DEVICE_ATTR(elcg_enable, ROOTRW, elcg_enable_read, elcg_enable_store); | 75 | static DEVICE_ATTR(elcg_enable, ROOTRW, elcg_enable_read, elcg_enable_store); |
@@ -125,7 +125,7 @@ static ssize_t blcg_enable_read(struct device *dev, | |||
125 | { | 125 | { |
126 | struct gk20a *g = get_gk20a(dev); | 126 | struct gk20a *g = get_gk20a(dev); |
127 | 127 | ||
128 | return sprintf(buf, "%d\n", g->blcg_enabled ? 1 : 0); | 128 | return snprintf(buf, PAGE_SIZE, "%d\n", g->blcg_enabled ? 1 : 0); |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
@@ -190,7 +190,7 @@ static ssize_t slcg_enable_read(struct device *dev, | |||
190 | { | 190 | { |
191 | struct gk20a *g = get_gk20a(dev); | 191 | struct gk20a *g = get_gk20a(dev); |
192 | 192 | ||
193 | return sprintf(buf, "%d\n", g->slcg_enabled ? 1 : 0); | 193 | return snprintf(buf, PAGE_SIZE, "%d\n", g->slcg_enabled ? 1 : 0); |
194 | } | 194 | } |
195 | 195 | ||
196 | static DEVICE_ATTR(slcg_enable, ROOTRW, slcg_enable_read, slcg_enable_store); | 196 | static DEVICE_ATTR(slcg_enable, ROOTRW, slcg_enable_read, slcg_enable_store); |
@@ -240,7 +240,7 @@ static ssize_t ptimer_ref_freq_show(struct device *dev, | |||
240 | return -EINVAL; | 240 | return -EINVAL; |
241 | } | 241 | } |
242 | 242 | ||
243 | res = sprintf(buf, "%u\n", PTIMER_REF_FREQ_HZ); | 243 | res = snprintf(buf, PAGE_SIZE, "%u\n", PTIMER_REF_FREQ_HZ); |
244 | 244 | ||
245 | return res; | 245 | return res; |
246 | 246 | ||
@@ -264,7 +264,7 @@ static ssize_t ptimer_src_freq_show(struct device *dev, | |||
264 | return -EINVAL; | 264 | return -EINVAL; |
265 | } | 265 | } |
266 | 266 | ||
267 | res = sprintf(buf, "%u\n", src_freq_hz); | 267 | res = snprintf(buf, PAGE_SIZE, "%u\n", src_freq_hz); |
268 | 268 | ||
269 | return res; | 269 | return res; |
270 | 270 | ||
@@ -325,7 +325,7 @@ static ssize_t railgate_enable_read(struct device *dev, | |||
325 | { | 325 | { |
326 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 326 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
327 | 327 | ||
328 | return sprintf(buf, "%d\n", platform->can_railgate ? 1 : 0); | 328 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->can_railgate ? 1 : 0); |
329 | } | 329 | } |
330 | 330 | ||
331 | static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, | 331 | static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, |
@@ -365,6 +365,7 @@ static ssize_t railgate_delay_show(struct device *dev, | |||
365 | struct device_attribute *attr, char *buf) | 365 | struct device_attribute *attr, char *buf) |
366 | { | 366 | { |
367 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 367 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
368 | |||
368 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->railgate_delay); | 369 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->railgate_delay); |
369 | } | 370 | } |
370 | static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, | 371 | static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, |
@@ -477,7 +478,7 @@ static ssize_t elpg_enable_read(struct device *dev, | |||
477 | { | 478 | { |
478 | struct gk20a *g = get_gk20a(dev); | 479 | struct gk20a *g = get_gk20a(dev); |
479 | 480 | ||
480 | return sprintf(buf, "%d\n", g->elpg_enabled ? 1 : 0); | 481 | return snprintf(buf, PAGE_SIZE, "%d\n", g->elpg_enabled ? 1 : 0); |
481 | } | 482 | } |
482 | 483 | ||
483 | static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store); | 484 | static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store); |
@@ -528,7 +529,8 @@ static ssize_t aelpg_param_read(struct device *dev, | |||
528 | { | 529 | { |
529 | struct gk20a *g = get_gk20a(dev); | 530 | struct gk20a *g = get_gk20a(dev); |
530 | 531 | ||
531 | return sprintf(buf, "%d %d %d %d %d\n", g->pmu.aelpg_param[0], | 532 | return snprintf(buf, PAGE_SIZE, |
533 | "%d %d %d %d %d\n", g->pmu.aelpg_param[0], | ||
532 | g->pmu.aelpg_param[1], g->pmu.aelpg_param[2], | 534 | g->pmu.aelpg_param[1], g->pmu.aelpg_param[2], |
533 | g->pmu.aelpg_param[3], g->pmu.aelpg_param[4]); | 535 | g->pmu.aelpg_param[3], g->pmu.aelpg_param[4]); |
534 | } | 536 | } |
@@ -580,7 +582,7 @@ static ssize_t aelpg_enable_read(struct device *dev, | |||
580 | { | 582 | { |
581 | struct gk20a *g = get_gk20a(dev); | 583 | struct gk20a *g = get_gk20a(dev); |
582 | 584 | ||
583 | return sprintf(buf, "%d\n", g->aelpg_enabled ? 1 : 0); | 585 | return snprintf(buf, PAGE_SIZE, "%d\n", g->aelpg_enabled ? 1 : 0); |
584 | } | 586 | } |
585 | 587 | ||
586 | static DEVICE_ATTR(aelpg_enable, ROOTRW, | 588 | static DEVICE_ATTR(aelpg_enable, ROOTRW, |
@@ -591,7 +593,8 @@ static ssize_t allow_all_enable_read(struct device *dev, | |||
591 | struct device_attribute *attr, char *buf) | 593 | struct device_attribute *attr, char *buf) |
592 | { | 594 | { |
593 | struct gk20a *g = get_gk20a(dev); | 595 | struct gk20a *g = get_gk20a(dev); |
594 | return sprintf(buf, "%d\n", g->allow_all ? 1 : 0); | 596 | |
597 | return snprintf(buf, PAGE_SIZE, "%d\n", g->allow_all ? 1 : 0); | ||
595 | } | 598 | } |
596 | 599 | ||
597 | static ssize_t allow_all_enable_store(struct device *dev, | 600 | static ssize_t allow_all_enable_store(struct device *dev, |
@@ -633,7 +636,7 @@ static ssize_t emc3d_ratio_read(struct device *dev, | |||
633 | { | 636 | { |
634 | struct gk20a *g = get_gk20a(dev); | 637 | struct gk20a *g = get_gk20a(dev); |
635 | 638 | ||
636 | return sprintf(buf, "%d\n", g->emc3d_ratio); | 639 | return snprintf(buf, PAGE_SIZE, "%d\n", g->emc3d_ratio); |
637 | } | 640 | } |
638 | 641 | ||
639 | static DEVICE_ATTR(emc3d_ratio, ROOTRW, emc3d_ratio_read, emc3d_ratio_store); | 642 | static DEVICE_ATTR(emc3d_ratio, ROOTRW, emc3d_ratio_read, emc3d_ratio_store); |
@@ -647,7 +650,7 @@ static ssize_t fmax_at_vmin_safe_read(struct device *dev, | |||
647 | gpu_fmax_at_vmin_hz = tegra_dvfs_get_fmax_at_vmin_safe_t( | 650 | gpu_fmax_at_vmin_hz = tegra_dvfs_get_fmax_at_vmin_safe_t( |
648 | clk_get_parent(g->clk.tegra_clk)); | 651 | clk_get_parent(g->clk.tegra_clk)); |
649 | 652 | ||
650 | return sprintf(buf, "%d\n", (int)(gpu_fmax_at_vmin_hz)); | 653 | return snprintf(buf, PAGE_SIZE, "%d\n", (int)(gpu_fmax_at_vmin_hz)); |
651 | } | 654 | } |
652 | 655 | ||
653 | static DEVICE_ATTR(fmax_at_vmin_safe, S_IRUGO, fmax_at_vmin_safe_read, NULL); | 656 | static DEVICE_ATTR(fmax_at_vmin_safe, S_IRUGO, fmax_at_vmin_safe_read, NULL); |
@@ -695,7 +698,7 @@ static ssize_t force_idle_read(struct device *dev, | |||
695 | { | 698 | { |
696 | struct gk20a *g = get_gk20a(dev); | 699 | struct gk20a *g = get_gk20a(dev); |
697 | 700 | ||
698 | return sprintf(buf, "%d\n", g->forced_idle ? 1 : 0); | 701 | return snprintf(buf, PAGE_SIZE, "%d\n", g->forced_idle ? 1 : 0); |
699 | } | 702 | } |
700 | 703 | ||
701 | static DEVICE_ATTR(force_idle, ROOTRW, force_idle_read, force_idle_store); | 704 | static DEVICE_ATTR(force_idle, ROOTRW, force_idle_read, force_idle_store); |
@@ -751,7 +754,7 @@ static ssize_t tpc_fs_mask_read(struct device *dev, | |||
751 | 754 | ||
752 | gk20a_idle(g->dev); | 755 | gk20a_idle(g->dev); |
753 | 756 | ||
754 | return sprintf(buf, "0x%x\n", tpc_fs_mask); | 757 | return snprintf(buf, PAGE_SIZE, "0x%x\n", tpc_fs_mask); |
755 | } | 758 | } |
756 | 759 | ||
757 | static DEVICE_ATTR(tpc_fs_mask, ROOTRW, tpc_fs_mask_read, tpc_fs_mask_store); | 760 | static DEVICE_ATTR(tpc_fs_mask, ROOTRW, tpc_fs_mask_read, tpc_fs_mask_store); |