Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp200482iol; Thu, 9 Jun 2022 01:57:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd7DacsjmLFs1NGpJbQFkQZwBDMGRMRCW1v/S3j+3jcnj8vKqf4aMupXg+DWuRpPQyuoa5 X-Received: by 2002:a05:6a00:e0e:b0:50a:cb86:883c with SMTP id bq14-20020a056a000e0e00b0050acb86883cmr39037993pfb.11.1654765055150; Thu, 09 Jun 2022 01:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654765055; cv=none; d=google.com; s=arc-20160816; b=DekF51M1AlPCQhnzF1NZWGtQbVX7CLeHb+IXLpxY0babEyu/hRZaIA6WLAVVMGrOJu GO6BJJLHxiBHPlvxQ7MSCrrimo2v/Q5+6s51aZ+HEU4qpS4QtpkmbvIuVZcu5geNqep3 ZqbLaEeJwnn5VmcrsYRPsDONI8O1xrE2EK8Gpaz5aGMqGSNHx1hATAf/z3n2LTYcgms/ +ekNmVn6UblL+eOsQTLAO8UZACtVJvhcgdg1x18AqinyzTA3L+4kBzudo57HXwCxu+97 1TE5hRq5aHcXS7k3Gf/0N1UHQC+rauGerm8O5OuFc6h203YNbFkux1yhAgV32TkeIEto BhqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=52cH1RR2zDd5UWSE14DErLy5RT6s7PH2N0JlmHpuNw4=; b=FWCCGuGs6UGQXpnuDqlG+CG2n9y7teb2PBusniMvlASj2iXpMFizH1vH4cA/gKoYhv 5tEhUV9Ovgkkc4xk+xj5JsByGeQzGl0J4Yg5HcxDnfoJLvu8rePYLLmPd2moGM0pNa27 4pL/tRI1WCVUg2xKH12D2lsfBjchLozxgyWVF+C4eJd6QxwLqRh0SH9HILK0hCiKSgtr k1e31CmpJHwyr7pUVl8OZp5VGdvr/KBOdKaobxAqakfGBYadgrKD25fNxJUD6F4X0eRM wlhGKUXW0fg5Qwb8dlChlj41nAQeNhx5SGA6qIGe3fRFUCMJ0AdVhLRlgU28MO7dGKv8 p5lQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020a17090a8a9000b001e3495408d6si31349122pjn.123.2022.06.09.01.57.22; Thu, 09 Jun 2022 01:57:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242072AbiFIIvK (ORCPT + 99 others); Thu, 9 Jun 2022 04:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242633AbiFIIug (ORCPT ); Thu, 9 Jun 2022 04:50:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED27F145581; Thu, 9 Jun 2022 01:47:30 -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 89659619AF; Thu, 9 Jun 2022 08:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50939C34114; Thu, 9 Jun 2022 08:47:28 +0000 (UTC) Message-ID: Date: Thu, 9 Jun 2022 10:47:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] media: hantro: fix compatible string deprecation warning Content-Language: en-US To: Robin Murphy , Martin Kepplinger , ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <20220517143521.1670663-1-martin.kepplinger@puri.sm> <0da188fa-efd8-62d0-2ea6-5a8e0c286cb5@arm.com> From: Hans Verkuil In-Reply-To: <0da188fa-efd8-62d0-2ea6-5a8e0c286cb5@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Martin, On 5/17/22 18:46, Robin Murphy wrote: > On 2022-05-17 15:35, Martin Kepplinger wrote: >> of_device_is_compatible() in the end uses strlen of the string >> for comparison, so in this case, the condition is true even if >> the requested string "nxp,imx8mq-vpu-g1" is being used. The first >> chars containing "nxp,imx8mq-vpu" are the same. > > Have you seen this go wrong in practice? AFAICS, unless you're on SPARC, which seems somewhat unlikely for an i.MX8 peripheral, of_compat_cmp() should map to strcasecmp(), which should do the right thing :/ Robin is correct, the existing code is fine for all but SPARC, which won't be using this driver. I'm rejecting this patch. Regards, Hans > > Robin. > >> Fix this by encoding what the comment says. >> >> Signed-off-by: Martin Kepplinger >> --- >> >> This is more of a bugreport as the solution doesn't look very elegant >> to me. I'm happy for advice. >> >> thanks, >>                             martin >> >> >>   drivers/staging/media/hantro/hantro_drv.c | 7 ++++--- >>   1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c >> index ac232b5f7825..014fab637df0 100644 >> --- a/drivers/staging/media/hantro/hantro_drv.c >> +++ b/drivers/staging/media/hantro/hantro_drv.c >> @@ -923,10 +923,11 @@ static int hantro_probe(struct platform_device *pdev) >>         /* >>        * Support for nxp,imx8mq-vpu is kept for backwards compatibility >> -     * but it's deprecated. Please update your DTS file to use >> -     * nxp,imx8mq-vpu-g1 or nxp,imx8mq-vpu-g2 instead. >> +     * but it's deprecated. >>        */ >> -    if (of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu")) >> +    if ((of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu")) && >> +        (!of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu-g1")) && >> +        (!of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu-g2"))) >>           dev_warn(&pdev->dev, "%s compatible is deprecated\n", >>                match->compatible); >>