From patchwork Wed Mar 16 16:53:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12782982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB2D0C433F5 for ; Wed, 16 Mar 2022 16:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237304AbiCPQzE (ORCPT ); Wed, 16 Mar 2022 12:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356913AbiCPQzA (ORCPT ); Wed, 16 Mar 2022 12:55:00 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D78631932; Wed, 16 Mar 2022 09:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647449626; x=1678985626; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+siQ0CJV8sIl5v5e72rj8Q6p8jCbZEt28U8U4nLaIAM=; b=HIfLVIf2VehsnzXvxHz6j9fzhLBsJ+xrOW/4C6Z8TWAxlwYDTaAj5tzH aoepSs3FjIbIMrsFcoPybEUJpEmnJ2r6AwOdWhsBAQ36sYvWh53Jpul67 zieJlLFJdLX1dwSiWQEJdIoYrREDSYsGamkKjZDgr8+WnqkU45pmLVixW CaP8+h2j5RkpfyUQ0Sb1jyYyigdmQIBDGy5C9fqzz18aZ3+ERtEYDT79D vtkqai8GYpYLcxsZKayJuZL2Gq6Tn8mMcyOHswDI6A5R1xcem2py3lKzU NAM9hCyvdzx+mEZKuObAXfIhnfGMXHA9j6o5Z7/8aAtgiQ+XEwFtSQrvB Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10288"; a="256614327" X-IronPort-AV: E=Sophos;i="5.90,187,1643702400"; d="scan'208";a="256614327" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2022 09:53:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,187,1643702400"; d="scan'208";a="598790953" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 16 Mar 2022 09:53:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 59E14107; Wed, 16 Mar 2022 18:53:54 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Heiner Kallweit , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Helge Deller , Andy Shevchenko Subject: [PATCH v2 1/2] staging: fbtft: Constify buf parameter in fbtft_dbg_hex() Date: Wed, 16 Mar 2022 18:53:50 +0200 Message-Id: <20220316165351.58107-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org It's obvious that we don't and shouldn't modify buffer that is about to be dumped. Constify parameter in fbtft_dbg_hex() to make it clear. Fixes: c296d5f9957c ("staging: fbtft: core support") Signed-off-by: Andy Shevchenko --- v2: new patch to fix a warning (Greg) drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/fbtft/fbtft.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index f2684d2d6851..6dc77895a87c 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -49,7 +49,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) EXPORT_SYMBOL(fbtft_write_buf_dc); void fbtft_dbg_hex(const struct device *dev, int groupsize, - void *buf, size_t len, const char *fmt, ...) + const void *buf, size_t len, const char *fmt, ...) { va_list args; static char textbuf[512]; diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 55677efc0138..c3d8b2aae607 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -240,7 +240,7 @@ struct fbtft_par { int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc); __printf(5, 6) void fbtft_dbg_hex(const struct device *dev, int groupsize, - void *buf, size_t len, const char *fmt, ...); + const void *buf, size_t len, const char *fmt, ...); struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, struct device *dev, struct fbtft_platform_data *pdata); From patchwork Wed Mar 16 16:53:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12782981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34320C433F5 for ; Wed, 16 Mar 2022 16:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241194AbiCPQy6 (ORCPT ); Wed, 16 Mar 2022 12:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239250AbiCPQy4 (ORCPT ); Wed, 16 Mar 2022 12:54:56 -0400 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E0A931341; Wed, 16 Mar 2022 09:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647449622; x=1678985622; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=67HJ5xsUQCH77LSjNv9g0hLBWeBJ7D0jAoL2UnUtLbY=; b=RYXF41fW6Lv87cYDIdZS6gM/d4eBWGuBE/wt1/Oik+I0MJXv/VUrTExc xW8/n5y5hQuECkFGYHBAOSIgB3kcv6Hr302EzvGOY/WVAtt8PXLnqXO0P 3qkVt5RI9Rq65csYsDEBAqdKnFX9B1TF441nrFp/dP45hHjK/t4ENHS2X iYsFmRZmvKa40m/j8Z3GJNJjHAHENyf/oZ71Gs/NRmWnDBV/kfAzJpGwt WgdHM8aJUq0GwFyYfpiIqDo5bYRSwGqplaUHzPqdnM/DfGDP9Z4O0cs33 1uUSGVvDKB9Meo1VAXJkyO5V/PVyHBX4EDitc9E1xhNpV0hrCIxDqiHNl Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10288"; a="317381330" X-IronPort-AV: E=Sophos;i="5.90,187,1643702400"; d="scan'208";a="317381330" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2022 09:53:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,187,1643702400"; d="scan'208";a="513107709" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 16 Mar 2022 09:53:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7D8E3192; Wed, 16 Mar 2022 18:53:55 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Heiner Kallweit , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Helge Deller , Andy Shevchenko Subject: [PATCH v2 2/2] staging: fbtft: Consider type of init sequence values in fbtft_init_display() Date: Wed, 16 Mar 2022 18:53:51 +0200 Message-Id: <20220316165351.58107-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220316165351.58107-1-andriy.shevchenko@linux.intel.com> References: <20220316165351.58107-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org In the fbtft_init_display() the init sequence is printed for the debug purposes. Unfortunately the current code doesn't take into account that values in the buffer are of the s16 type. Consider that and replace the printing code with fbtft_par_dbg_hex() call. Fixes: b888897014a9 ("staging/fbtft: Remove all strcpy() uses") Signed-off-by: Andy Shevchenko --- v2: no changes, just based on prerequisite drivers/staging/fbtft/fbtft-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 6dc77895a87c..3b182115bd6e 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -1034,10 +1034,9 @@ int fbtft_init_display(struct fbtft_par *par) for (j = 0; par->init_sequence[i + 1 + j] >= 0; j++) ; - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, - "init: write(0x%02X) %*ph\n", - par->init_sequence[i], j, - &par->init_sequence[i + 1]); + fbtft_par_dbg_hex(DEBUG_INIT_DISPLAY, par, par->info->device, + s16, &par->init_sequence[i + 1], j, + "init: write(0x%02X)", par->init_sequence[i]); /* Write */ j = 0;