From patchwork Fri Jul 14 09:17:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 703138 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 1F3F4EB64DC for ; Fri, 14 Jul 2023 09:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235814AbjGNJSY (ORCPT ); Fri, 14 Jul 2023 05:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235801AbjGNJSV (ORCPT ); Fri, 14 Jul 2023 05:18:21 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A1952D51; Fri, 14 Jul 2023 02:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689326298; x=1720862298; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zN+eDH4bSonahOLd7oZfC6x/CMBxwEXOjKeHROeGChE=; b=MCARfTwUMLBcCdiH7djCuTtadkbhmKboMsBdn2zWSFV+QkPQRm8P5fGQ b1V8mc9jZ8mesR9GgKUMjHcZYxzlrXqfpT7j/il4JCQo8UxNcP0YYq/mO tY5fc7NhbZNtFP6+m/HMXl1MzSZ+DUbzeBYzdUffy03LJxcM5x/7FS/ZY 1+RCY0Rz7Hm6PozBmPgTiHJV0pI16y1sBeRPBXul0AoUr8nlKfJpfq7Yj l/xrXShiytF/aQULn8m9NlmDd/gFj/qro/M/e4PxFPyQ4id0c25iQPJKw dODWp2Azc6tR3o2DB6BYYNuBl+1hmSd8GXie9iENRPTePdXttdINJghXa A==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="365468998" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="365468998" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 02:17:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="716281742" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="716281742" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 14 Jul 2023 02:17:44 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 93C71385; Fri, 14 Jul 2023 12:17:50 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sebastian Reichel Subject: [PATCH v4 2/4] spi: Kill spi_add_device_locked() Date: Fri, 14 Jul 2023 12:17:46 +0300 Message-Id: <20230714091748.89681-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230714091748.89681-1-andriy.shevchenko@linux.intel.com> References: <20230714091748.89681-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Now, spi_add_device_locked() has just a line on top of __spi_add_device(). Besides that, it has a single caller. So, just kill it and embed its parts into the caller. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8e70f4183e62..05f702339182 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -708,14 +708,6 @@ int spi_add_device(struct spi_device *spi) } EXPORT_SYMBOL_GPL(spi_add_device); -static int spi_add_device_locked(struct spi_device *spi) -{ - struct spi_controller *ctlr = spi->controller; - - WARN_ON(!mutex_is_locked(&ctlr->add_lock)); - return __spi_add_device(spi); -} - /** * spi_new_device - instantiate one new SPI device * @ctlr: Controller to which device is connected @@ -2417,11 +2409,12 @@ static void of_register_spi_devices(struct spi_controller *ctlr) { } struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 chip_select) { + struct spi_controller *ctlr = spi->controller; struct spi_device *ancillary; int rc = 0; /* Alloc an spi_device */ - ancillary = spi_alloc_device(spi->controller); + ancillary = spi_alloc_device(ctlr); if (!ancillary) { rc = -ENOMEM; goto err_out; @@ -2436,8 +2429,10 @@ struct spi_device *spi_new_ancillary_device(struct spi_device *spi, ancillary->max_speed_hz = spi->max_speed_hz; ancillary->mode = spi->mode; + WARN_ON(!mutex_is_locked(&ctlr->add_lock)); + /* Register the new device */ - rc = spi_add_device_locked(ancillary); + rc = __spi_add_device(ancillary); if (rc) { dev_err(&spi->dev, "failed to register ancillary device\n"); goto err_out;