Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4481122imw; Tue, 19 Jul 2022 07:24:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tO84GdSJoqUsg8wLaQMvRXOGgTG+Rw9G+4hb2on4mqxsYmLnEcUYpN5d4tAqeQjtnwaG4c X-Received: by 2002:a17:902:d58c:b0:16c:fdb7:86e9 with SMTP id k12-20020a170902d58c00b0016cfdb786e9mr5892658plh.74.1658240691995; Tue, 19 Jul 2022 07:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658240691; cv=none; d=google.com; s=arc-20160816; b=tBfa4IVpQKuojLdVmMypifCK0YZmBmFLTpSzAAhAlHU8kuW1gPNh52kQi/p8+Ah9Ac DQnshgBfr9HR2mMQc9gqDOLbfMB3LfxJen5NJpEn7Ii7lE8zCt5haaQ1zdxc+4FAn/Pl ipoAEwQryQZKku0YP0sYInPBCaOD7bDMGt7G8kjjwPfByIZS2qMA/bThN3PwUWHtW5oQ si3LsnGlBNdH6OeKPk2ydGR2036G9Vs8VW0V5SghxAiuEZDh0b1Uw89agg2Zd43ZANAX Q5P6gEER67HP5r8V+cTXSm6+wuc1l3EouBF3PmhbUcouX6vFW4rZgTMeCSQkEhGd+SSl 7gRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6LuLR+d2CG8sLvcl5iQgOqNtNwRdc+CN1Uz/ZEty58g=; b=YnFOXEmMBQXW3A2wlqqXjR1xD2U7nudocNqQLM3FBDxio1jf7IGFm8w5z9OqM9oHB8 Po1qccVauuxpP2q4N7p+36zgxZv8tEgVq/1dNiqzzniQxzovt4/v2ZICmMTg4jFEgTN0 rWrU1+KLl4w5cgS91ICkT+HMbBW8uOC7pVksRRogr1ZVj5Id9DPR4qf5ZxE+K8nXqlPh eLmZyBOoNcl0ClITYbf54ZJn6j+fJDdaSiWZvFJAYinx+osA3zkPbGSZq6Zi4bFI/F8o omMDcOz/7M7fB/xaCWXTa3CsGPqmRnq60phm2MewbVVeFHSvakM0S8sNTWxjNfQ0jy+f B8gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pknuuY9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f127-20020a636a85000000b00419dc0c2d71si16496968pgc.115.2022.07.19.07.24.36; Tue, 19 Jul 2022 07:24:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pknuuY9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241404AbiGSMld (ORCPT + 99 others); Tue, 19 Jul 2022 08:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241370AbiGSMjb (ORCPT ); Tue, 19 Jul 2022 08:39:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8921C53D27; Tue, 19 Jul 2022 05:15:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0CD2C61790; Tue, 19 Jul 2022 12:15:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF237C341C6; Tue, 19 Jul 2022 12:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232953; bh=bHTgc0qtiNP7x5YW1a2kyD6Vgm8GCCz+ZEiFfZ3F8AY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pknuuY9GId5ywzIIo3Skw3AD41QcD8iuDL7PQDrukN60w+5XQa4KGGE0rCBIUUZZN XYGlwknyqn/bJH9M9qY+Ah7GDWOTJLZMX5KpimMXOYduT7+/QMS8FfF6CK6Ca/g7b2 M3R2eJ52b8+QdbpoUoLBxtzrj8w75f2VRUiaCZn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Daniel Vetter , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.15 123/167] firmware: sysfb: Make sysfb_create_simplefb() return a pdev pointer Date: Tue, 19 Jul 2022 13:54:15 +0200 Message-Id: <20220719114708.517968197@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Javier Martinez Canillas [ Upstream commit 9e121040e54abef9ed5542e5fdfa87911cd96204 ] 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 Reviewed-by: Daniel Vetter Reviewed-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-2-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/firmware/sysfb.c | 4 ++-- drivers/firmware/sysfb_simplefb.c | 16 ++++++++-------- include/linux/sysfb.h | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 2bfbb05f7d89..b032f40a92de 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -46,8 +46,8 @@ static __init int sysfb_init(void) /* try to create a simple-framebuffer device */ compatible = sysfb_parse_mode(si, &mode); if (compatible) { - ret = sysfb_create_simplefb(si, &mode); - if (!ret) + pd = sysfb_create_simplefb(si, &mode); + if (!IS_ERR(pd)) return 0; } diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c index 757cc8b9f3de..eac51c2a27ba 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -57,8 +57,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si, return false; } -__init int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +__init struct platform_device *sysfb_create_simplefb(const struct screen_info *si, + const struct simplefb_platform_data *mode) { struct platform_device *pd; struct resource res; @@ -76,7 +76,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si, base |= (u64)si->ext_lfb_base << 32; if (!base || (u64)(resource_size_t)base != base) { printk(KERN_DEBUG "sysfb: inaccessible VRAM base\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } /* @@ -93,7 +93,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si, length = mode->height * mode->stride; if (length > size) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } length = PAGE_ALIGN(length); @@ -104,11 +104,11 @@ __init int sysfb_create_simplefb(const struct screen_info *si, res.start = base; res.end = res.start + length - 1; if (res.end <= res.start) - return -EINVAL; + return ERR_PTR(-EINVAL); pd = platform_device_alloc("simple-framebuffer", 0); if (!pd) - return -ENOMEM; + return ERR_PTR(-ENOMEM); sysfb_apply_efi_quirks(pd); @@ -124,10 +124,10 @@ __init int sysfb_create_simplefb(const struct screen_info *si, if (ret) goto err_put_device; - return 0; + return pd; err_put_device: platform_device_put(pd); - return ret; + return ERR_PTR(ret); } diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index b0dcfa26d07b..708152e9037b 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -72,8 +72,8 @@ static inline void sysfb_apply_efi_quirks(struct platform_device *pd) bool sysfb_parse_mode(const struct screen_info *si, struct simplefb_platform_data *mode); -int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode); +struct platform_device *sysfb_create_simplefb(const struct screen_info *si, + const struct simplefb_platform_data *mode); #else /* CONFIG_SYSFB_SIMPLE */ @@ -83,10 +83,10 @@ static inline bool sysfb_parse_mode(const struct screen_info *si, return false; } -static inline int sysfb_create_simplefb(const struct screen_info *si, - const struct simplefb_platform_data *mode) +static inline struct platform_device *sysfb_create_simplefb(const struct screen_info *si, + const struct simplefb_platform_data *mode) { - return -EINVAL; + return ERR_PTR(-EINVAL); } #endif /* CONFIG_SYSFB_SIMPLE */ -- 2.35.1