staging: fbtft: change 'gamma' array to u32

Having a local variable of 1024 bytes on 64-bit architectures is a bit
too much, and I ran into this warning while trying to see what functions
use the largest stack:

drivers/staging/fbtft/fbtft-sysfs.c: In function 'store_gamma_curve':
drivers/staging/fbtft/fbtft-sysfs.c:132:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

As there is no need for 64-bit gamma values (on 32-bit architectures,
we don't use those either), I'm changing the type from 'unsigned long'
to 'u32' here, which cuts the required space in half everywhere.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Arnd Bergmann 2017-02-02 15:43:42 +01:00 committed by Greg Kroah-Hartman
parent 26190d41b9
commit 22eb36b814
22 changed files with 26 additions and 26 deletions

View File

@ -158,7 +158,7 @@ static int set_var(struct fbtft_par *par)
* ON0 ON1 CN0 CN1 CN2 CN3 CN4 MN0 MN1 MN2 MN3 MN4 MN5 XXXX GC
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x0f, 0x0f, 0x1f, 0x0f, 0x0f, 0x0f, 0x1f, 0x07, 0x07, 0x07,

View File

@ -102,7 +102,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
* VRN0 VRN1 VRN2 VRN3 VRN4 VRN5 PRN0 PRN1 PKN0 PKN1 PKN2 PKN3 PKN4 CGM
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x7f, 0x7f, 0x1f, 0x1f,

View File

@ -118,7 +118,7 @@ static int set_var(struct fbtft_par *par)
}
/* gamma string format: */
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
write_reg(par, 0xE0,
curves[0], curves[1], curves[2], curves[3],

View File

@ -202,7 +202,7 @@ static int set_var(struct fbtft_par *par)
#ifdef GAMMA_ADJ
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int gamma_adj(struct fbtft_par *par, unsigned long *curves)
static int gamma_adj(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x3F, 0x3F, 0x3F, 0x3F, 0x3F,

View File

@ -221,7 +221,7 @@ static int set_var(struct fbtft_par *par)
* VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,

View File

@ -215,7 +215,7 @@ static int set_var(struct fbtft_par *par)
* VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,

View File

@ -121,7 +121,7 @@ static int set_var(struct fbtft_par *par)
* Negative: Par1 Par2 [...] Par15
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i;

View File

@ -137,7 +137,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
return ret;
}
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
/* apply mask */
curves[0] &= 0x7F;

View File

@ -130,7 +130,7 @@ static int set_var(struct fbtft_par *par)
* PKN0 PKN1 PKN2 PKN3 PKN4 PKN5 PKN6 PKN7 PRN8 PRN9 PRN10 PRN11 VRN0 VRN1
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,

View File

@ -136,7 +136,7 @@ static int set_var(struct fbtft_par *par)
* VRN0 VRN1 PRN0 PRN1 PKN0 PKN1 PKN2 PKN3 PKN4 PKN5
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long mask[] = {
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,

View File

@ -148,7 +148,7 @@ static int blank(struct fbtft_par *par, bool on)
}
/* Gamma is used to control Contrast */
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
curves[0] &= 0xFF;
/* Set Contrast Control for BANK0 */

View File

@ -168,7 +168,7 @@ static int blank(struct fbtft_par *par, bool on)
}
/* Gamma is used to control Contrast */
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
/* apply mask */
curves[0] &= 0xFF;

View File

@ -116,7 +116,7 @@ static int blank(struct fbtft_par *par, bool on)
* 0 = Setting of GS1 < Setting of GS2 < Setting of GS3.....<
* Setting of GS14 < Setting of GS15
*/
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i;

View File

@ -122,7 +122,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
* Setting of GS63 has to be > Setting of GS62 +1
*
*/
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long tmp[GAMMA_NUM * GAMMA_LEN];
int i, acc = 0;

View File

@ -117,7 +117,7 @@ static int set_var(struct fbtft_par *par)
* Setting of GS63 has to be > Setting of GS62 +1
*
*/
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
unsigned long tmp[GAMMA_NUM * GAMMA_LEN];
int i, acc = 0;

View File

@ -143,7 +143,7 @@ static int set_var(struct fbtft_par *par)
* VRF0N VOS0N PK0N PK1N PK2N PK3N PK4N PK5N PK6N PK7N PK8N PK9N SELV0N SELV1N SELV62N SELV63N
*/
#define CURVE(num, idx) curves[num * par->gamma.num_values + idx]
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i, j;

View File

@ -178,7 +178,7 @@ static int set_var(struct fbtft_par *par)
*
* Return: 0 on success, < 0 if error occurred.
*/
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i;
int j;

View File

@ -130,7 +130,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
return ret;
}
static int set_gamma(struct fbtft_par *par, unsigned long *curves)
static int set_gamma(struct fbtft_par *par, u32 *curves)
{
/* apply mask */
curves[0] &= 0x7F;

View File

@ -661,7 +661,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
int vmem_size, i;
s16 *init_sequence = display->init_sequence;
char *gamma = display->gamma;
unsigned long *gamma_curves = NULL;
u32 *gamma_curves = NULL;
/* sanity check */
if (display->gamma_num * display->gamma_len >

View File

@ -16,7 +16,7 @@ static int get_next_ulong(char **str_p, unsigned long *val, char *sep, int base)
return kstrtoul(p_val, base, val);
}
int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
const char *str, int size)
{
char *str_p, *curve_p = NULL;
@ -89,7 +89,7 @@ out:
}
static ssize_t
sprintf_gamma(struct fbtft_par *par, unsigned long *curves, char *buf)
sprintf_gamma(struct fbtft_par *par, u32 *curves, char *buf)
{
ssize_t len = 0;
unsigned int i, j;
@ -98,7 +98,7 @@ sprintf_gamma(struct fbtft_par *par, unsigned long *curves, char *buf)
for (i = 0; i < par->gamma.num_curves; i++) {
for (j = 0; j < par->gamma.num_values; j++)
len += scnprintf(&buf[len], PAGE_SIZE,
"%04lx ", curves[i * par->gamma.num_values + j]);
"%04x ", curves[i * par->gamma.num_values + j]);
buf[len - 1] = '\n';
}
mutex_unlock(&par->gamma.lock);
@ -112,7 +112,7 @@ static ssize_t store_gamma_curve(struct device *device,
{
struct fb_info *fb_info = dev_get_drvdata(device);
struct fbtft_par *par = fb_info->par;
unsigned long tmp_curves[FBTFT_GAMMA_MAX_VALUES_TOTAL];
u32 tmp_curves[FBTFT_GAMMA_MAX_VALUES_TOTAL];
int ret;
ret = fbtft_gamma_parse_str(par, tmp_curves, buf, count);

View File

@ -92,7 +92,7 @@ struct fbtft_ops {
void (*unregister_backlight)(struct fbtft_par *par);
int (*set_var)(struct fbtft_par *par);
int (*set_gamma)(struct fbtft_par *par, unsigned long *curves);
int (*set_gamma)(struct fbtft_par *par, u32 *curves);
};
/**
@ -231,7 +231,7 @@ struct fbtft_par {
s16 *init_sequence;
struct {
struct mutex lock;
unsigned long *curves;
u32 *curves;
int num_values;
int num_curves;
} gamma;

View File

@ -19,7 +19,7 @@
void fbtft_sysfs_init(struct fbtft_par *par);
void fbtft_sysfs_exit(struct fbtft_par *par);
void fbtft_expand_debug_value(unsigned long *debug);
int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves,
int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
const char *str, int size);
#endif /* __LINUX_FBTFT_INTERNAL_H */