Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp599062ybz; Fri, 17 Apr 2020 06:51:20 -0700 (PDT) X-Google-Smtp-Source: APiQypLFlvJwnIdS/itBENS1Yja6bJS1Khy5c6LsbkdbtMOsySpFcneCRewRA3nnDQHJoaexgR4J X-Received: by 2002:aa7:d311:: with SMTP id p17mr3166502edq.73.1587131480467; Fri, 17 Apr 2020 06:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587131480; cv=none; d=google.com; s=arc-20160816; b=WH9UzdldB6Z745XVjr0uIwkb4azCqPIzNJjLNIOqezedlRJCKg/M/x05RxVerMouEh QxssWtH/t7FvCUMT+FuUodn7v0lCuX3paIj1OL5fOkB+cXLDqg8xwDVab+JK929mvn2d uhEiEx0qF+wgzG8Sm9VsMvoiOXrrCworaNzDuqCQd31zRK84rKWopnq420O3SC3JJLq6 Dj993EbXYPdtK41NTuey2PJfHly6KzIUcTBy9mrCRb8AaCmWnI6SDtTguXSQPvyoiMQ1 6LyagvmR1thO0PdFZEnq2tRVVbe0Tq6jDcSfVCPFZJie0kjAX2b6zEhvSdkBQfiV5DAp va2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=KmKWZbZ++U2YoDUvAF4xgjoYK/bNPGnbSjD/7SOQcxc=; b=xUMdz2sNGdMsIb26f+g/jvanEwF+LeV7coN1vSOT1LZN7ufsx/6GlFp146mcpvOCOb 8Xlyq/jYbnsX8Rl8YQecjJXC/b5bXaaJvuQtm+MZo869AwNVGUM/JGJB6RxT4wHIEjd4 lBSDWBUBOZ0S6CAdR9HyKlgeTzFPcu2qoribRgK3IpnXorp+4QVR9Wgh30Aejtc7MsEA C440mUv7MUiIBQLDzTyquFTfpOfXJMHVGl1C1gasAYH0brgskeClZl2LbVveXt/2y+3v LJsnSwZmAZ8KxCC+IKiEg2/pk1vHbV9dc1xMyWCu5FJa12jLphNwrHnvpQmNG9OxDc6l F89w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=WDLt3SaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si13862201eds.587.2020.04.17.06.50.56; Fri, 17 Apr 2020 06:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=WDLt3SaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730744AbgDQNt2 (ORCPT + 99 others); Fri, 17 Apr 2020 09:49:28 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:36358 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730731AbgDQNt1 (ORCPT ); Fri, 17 Apr 2020 09:49:27 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 03HDnQJf064011; Fri, 17 Apr 2020 08:49:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1587131366; bh=KmKWZbZ++U2YoDUvAF4xgjoYK/bNPGnbSjD/7SOQcxc=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=WDLt3SaPQOr85mDKx/bGSOySyNCbdxeALFwqQH1EoLFdfU7LSPaeJwmnKVaS2yROf pTo6FVpaR2/xMU4BXkpC/H70O7N+Lr9Zt22BPT8v8vEjRUrmQdzgbtxyOEliceFxy+ KtD9KkLaxPVu2uYSP2UExT/4EqEqxfpiG1p0s01Y= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 03HDnQdq055914 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Apr 2020 08:49:26 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 17 Apr 2020 08:49:26 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Fri, 17 Apr 2020 08:49:26 -0500 Received: from [10.250.48.148] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 03HDnPXh119310; Fri, 17 Apr 2020 08:49:26 -0500 Subject: Re: [PATCH v2 6/7] remoteproc: Split rproc_ops allocation from rproc_alloc() To: Mathieu Poirier , , CC: , , , References: <20200415204858.2448-1-mathieu.poirier@linaro.org> <20200415204858.2448-7-mathieu.poirier@linaro.org> From: Suman Anna Message-ID: <61497230-40ec-ffc6-3cc0-e5cb754ac859@ti.com> Date: Fri, 17 Apr 2020 08:49:25 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200415204858.2448-7-mathieu.poirier@linaro.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/15/20 3:48 PM, Mathieu Poirier wrote: > Make the rproc_ops allocation a function on its own in an effort > to clean up function rproc_alloc(). > > Signed-off-by: Mathieu Poirier > Reviewed-by: Alex Elder > --- > drivers/remoteproc/remoteproc_core.c | 32 +++++++++++++++++----------- > 1 file changed, 20 insertions(+), 12 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 0bfa6998705d..a5a0ceb86b3f 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -2001,6 +2001,25 @@ static int rproc_alloc_firmware(struct rproc *rproc, > return 0; > } > > +static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops) > +{ > + rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); > + if (!rproc->ops) > + return -ENOMEM; > + > + /* Default to ELF loader if no load function is specified */ > + if (!rproc->ops->load) { > + rproc->ops->load = rproc_elf_load_segments; > + rproc->ops->parse_fw = rproc_elf_load_rsc_table; > + rproc->ops->find_loaded_rsc_table = > + rproc_elf_find_loaded_rsc_table; > + rproc->ops->sanity_check = rproc_elf_sanity_check; So, the conditional check on sanity check is dropped and the callback switched here without the changelog reflecting anything why. You should just rebase this patch on top of Clement's patch [1] that removes the conditional flag, and also usage from the remoteproc platform drivers. regards Suman [1] https://patchwork.kernel.org/patch/11462013/ > + rproc->ops->get_boot_addr = rproc_elf_get_boot_addr; > + } > + > + return 0; > +} > + > /** > * rproc_alloc() - allocate a remote processor handle > * @dev: the underlying device > @@ -2040,8 +2059,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, > if (rproc_alloc_firmware(rproc, name, firmware)) > goto free_rproc; > > - rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); > - if (!rproc->ops) > + if (rproc_alloc_ops(rproc, ops)) > goto free_firmware; > > rproc->name = name; > @@ -2068,16 +2086,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, > > atomic_set(&rproc->power, 0); > > - /* Default to ELF loader if no load function is specified */ > - if (!rproc->ops->load) { > - rproc->ops->load = rproc_elf_load_segments; > - rproc->ops->parse_fw = rproc_elf_load_rsc_table; > - rproc->ops->find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table; > - if (!rproc->ops->sanity_check) > - rproc->ops->sanity_check = rproc_elf32_sanity_check; > - rproc->ops->get_boot_addr = rproc_elf_get_boot_addr; > - } > - > mutex_init(&rproc->lock); > > INIT_LIST_HEAD(&rproc->carveouts); >