Skip to content

Commit 9e12104

Browse files
firmware: sysfb: Make sysfb_create_simplefb() return a pdev pointer
This function just returned 0 on success or an errno code on error, but it could be useful for sysfb_init() callers to have a pointer to the device. Signed-off-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5f70132 commit 9e12104

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

drivers/firmware/sysfb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ static __init int sysfb_init(void)
4646
/* try to create a simple-framebuffer device */
4747
compatible = sysfb_parse_mode(si, &mode);
4848
if (compatible) {
49-
ret = sysfb_create_simplefb(si, &mode);
50-
if (!ret)
49+
pd = sysfb_create_simplefb(si, &mode);
50+
if (!IS_ERR(pd))
5151
return 0;
5252
}
5353

drivers/firmware/sysfb_simplefb.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
5757
return false;
5858
}
5959

60-
__init int sysfb_create_simplefb(const struct screen_info *si,
61-
const struct simplefb_platform_data *mode)
60+
__init struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
61+
const struct simplefb_platform_data *mode)
6262
{
6363
struct platform_device *pd;
6464
struct resource res;
@@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
7676
base |= (u64)si->ext_lfb_base << 32;
7777
if (!base || (u64)(resource_size_t)base != base) {
7878
printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n");
79-
return -EINVAL;
79+
return ERR_PTR(-EINVAL);
8080
}
8181

8282
/*
@@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
9393
length = mode->height * mode->stride;
9494
if (length > size) {
9595
printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n");
96-
return -EINVAL;
96+
return ERR_PTR(-EINVAL);
9797
}
9898
length = PAGE_ALIGN(length);
9999

@@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
104104
res.start = base;
105105
res.end = res.start + length - 1;
106106
if (res.end <= res.start)
107-
return -EINVAL;
107+
return ERR_PTR(-EINVAL);
108108

109109
pd = platform_device_alloc("simple-framebuffer", 0);
110110
if (!pd)
111-
return -ENOMEM;
111+
return ERR_PTR(-ENOMEM);
112112

113113
sysfb_apply_efi_quirks(pd);
114114

@@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
124124
if (ret)
125125
goto err_put_device;
126126

127-
return 0;
127+
return pd;
128128

129129
err_put_device:
130130
platform_device_put(pd);
131131

132-
return ret;
132+
return ERR_PTR(ret);
133133
}

include/linux/sysfb.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform_device *pd)
7272

7373
bool sysfb_parse_mode(const struct screen_info *si,
7474
struct simplefb_platform_data *mode);
75-
int sysfb_create_simplefb(const struct screen_info *si,
76-
const struct simplefb_platform_data *mode);
75+
struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
76+
const struct simplefb_platform_data *mode);
7777

7878
#else /* CONFIG_SYSFB_SIMPLE */
7979

@@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen_info *si,
8383
return false;
8484
}
8585

86-
static inline int sysfb_create_simplefb(const struct screen_info *si,
87-
const struct simplefb_platform_data *mode)
86+
static inline struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
87+
const struct simplefb_platform_data *mode)
8888
{
89-
return -EINVAL;
89+
return ERR_PTR(-EINVAL);
9090
}
9191

9292
#endif /* CONFIG_SYSFB_SIMPLE */

0 commit comments

Comments
 (0)