Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp430445lqp; Mon, 10 Jun 2024 08:19:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVpaXLM8H5N4ImEwtzooNDwYnoJSS7aD6n9K5hCvHTA4sVIL4H+4r6KuOt5DiYIpkU+UkwJZzp+MNQrpcwDXHPQR82CBkCgJfuF2M/PVA== X-Google-Smtp-Source: AGHT+IH3Nx1aqAej8h0vbV7dO8ypRb33P2qGjgwPuiZ39sA6KekvQjW+t6gs1/7vYJDsD68OWufY X-Received: by 2002:a05:6a20:3d89:b0:1b5:b214:efb8 with SMTP id adf61e73a8af0-1b5b22438b6mr7590741637.34.1718032772213; Mon, 10 Jun 2024 08:19:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718032772; cv=pass; d=google.com; s=arc-20160816; b=CxjX8CsWuDvboAmW8aPSxInzyck+XaT022k0ykHCveksN8y+3yS8QPd6wQ3zp0hQfl cnnbk2SGMb8ZeGOV+p3zh5nGwqXddl1V3keiCVmWJOah5Zu5ngLVYvTaHiSitLC9AzXf +Cu48Aormk6whXTPmf/DEdN/2DLpHTofD+4STHHPNhDJ2MGkyMeOnaNBG48k5OlJene9 UblwvUYnceNcZ2bcH5rDYtvXdvgyohSMa/8RE27Pg/XS6C4aU3vdtlCnHyFzrgJXbL1K KE3aM3xq+RZBhMqiU8bWL0G+sH/fJuf0yXmdTR4Xmhf99xsBclYotMLOorfqcB8UtlOK HKWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UIJouERmppUalE0J8gICZtjFJhQ1JN77/tIkUQ2LKPE=; fh=UhLEOJkhihH1HVsbl9jRxBlppfrIadoZ3LfcUKBVyRA=; b=wjmMXyF64cE7zjdiPcz39lpfxctOcBZFapF6SpjHGncuIT7AvGvk99oX15tfgvqLs5 /eZTVihDtLhHzKSUoUxswnKk8Egx9Q7vT2RmP8cnc20gbt480yGCEgm5jQSdTgVTwvFQ UU1DQ2xHzc4TO+kfU3nXaeKbyiF2KkPj946kOFbbsl8GukSTt+Aq66V28CeUU4TyAq1t RxrFcamogsGTHXyL/HaGuZT5zUnhStgCQELG41vuNrflTfDKsoVCCc3ZyRk8pi9d8weq 8XiMtdxwaqzpRQMql0nmhH+86zynkyE3MWIepedAQeOhWbHUFNdksDB3lRfbFSk/Nyt7 WQcQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=iAUWpvfF; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-208331-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208331-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de28f32c46si4119078a12.560.2024.06.10.08.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 08:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208331-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=iAUWpvfF; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-208331-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208331-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EFEA328CF8F for ; Mon, 10 Jun 2024 14:08:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BA4813D615; Mon, 10 Jun 2024 14:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="iAUWpvfF" Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 106D912FF63 for ; Mon, 10 Jun 2024 14:05:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718028360; cv=none; b=kTvbMweOFlwNO5YptVvfAh0JiEaNI60RsyXiNPaV+CsQ/sn5T6MpPp7gNeU3OFLBbk3JeyXTe9pcAbmmWS58yRmaei1v/VJi/jpBigJyGpH169xPaMrpJ0eZTq8FYY7xYRPuI2HxwhbNKn5WlAmfevjluvIJGh0v5iJkgnslYbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718028360; c=relaxed/simple; bh=gBa1n5V5gUIsszcEppINk2D8zEynondAoO83jLEUfYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rFgGQ7YCnKtFqg51p+5fHjeN7w+Fmj5zzPRn2Sccl/xIzSm7LYQG637kqvLFuBhJC3IaGBGi54afmD87UEgtyEUm4+MsEKp9qGXqnG4vqaYHhcUbpRsRv2Zwt8OzAlNEd7r5KpnkVA6gv8mzz0py/fGRWt/bg62rciXic/ihezI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=iAUWpvfF; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-42121d27861so39053645e9.0 for ; Mon, 10 Jun 2024 07:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718028357; x=1718633157; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UIJouERmppUalE0J8gICZtjFJhQ1JN77/tIkUQ2LKPE=; b=iAUWpvfFP8nHFPCVQ7JhvU1uY6/D3fs44mT5ZiD4pMoIOUoaeWb1M0TenuTmG0Yntr vahd7Vsg6xInQlsppro9iPWerE0eWW25RAH8kA/Hg//hneooVGSMEPM5+Xwkn3Yk3U+9 4xZJ5vVvpwhPwqofo4yt5QHlf2/W8AXFaWw3u3X3WKGMdqU7EEexnYKAnqw4tn1YoQPX t2VWOZs2au6oPVeXjOdgAyrphv/R20qFa/MWMUqJK+4Uj5Yxi0kVaz93bf98he8umI/v yYOo5fqN9cD3UFaJxUL23ydE48rhQV4n8ghPJP18TvBxSCsbW7iKKRXDorPnLsugI472 eg1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718028357; x=1718633157; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UIJouERmppUalE0J8gICZtjFJhQ1JN77/tIkUQ2LKPE=; b=jeK9rmYOh56F7wULl8+cwmAqPhqOOdnlWbK8tt/U1qUwjyK9HGqyd8SHaFUxjJ1OFu aNijomxdScHOg9itGOHtHLO3NljsC8MCbhD97P0h8wJtAhGG/qaLfUGHxYn9zplGKth4 2ph9dFlgFnvx4qwFloPgixoWo8AGTUkajWT65+LVqlyw313GWzvjOTRhZvNnX+OiAeMD 2P0LOm2dMnkYrzJKnfqGqi/1PZlSD0/46pm2jID01PT6jezni5uLWBAQ3zlKeBwKRONK FQp6CvNymAK1z1XbmuqMfdliSC10K+bvNZSVUmeaO6HpjpNE5u2sAPNbopmC2NfJUZol rHoQ== X-Forwarded-Encrypted: i=1; AJvYcCVbOF359TV7LofzUcMfI+n6KIQ1XkBqQopDsgdoqo2+8taLsr63zZmGK73McqAg23xZEPWDH/1VRUms6Y498v+Ir3miagNN9PDQbei1 X-Gm-Message-State: AOJu0YzC7ANhoFalMYW/27lK/Y0sNazgJwBmI4BNK+MF7WeystsEQbVp 3Au6KoLzsTqNA1KJ4L3abdaldAUQJmbhgu/i46AS1Pv9tEsWytyh3RR20GQALMM= X-Received: by 2002:a05:600c:a42:b0:41d:d406:9416 with SMTP id 5b1f17b1804b1-42164a4ddd2mr81776455e9.34.1718028357271; Mon, 10 Jun 2024 07:05:57 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:75a:e000:b790:b49b:9038:8e99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42217ff4302sm11113845e9.31.2024.06.10.07.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 07:05:56 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , Andy Shevchenko Subject: [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name(... Date: Mon, 10 Jun 2024 16:05:46 +0200 Message-ID: <20240610140548.35358-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240610140548.35358-1-brgl@bgdev.pl> References: <20240610140548.35358-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Bartosz Golaszewski Use the dedicated helper for comparing device names against strings. While at it: reshuffle the code a bit for less indentation. Suggested-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-sim.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index 2ed5cbe7c8a8..278bb0c54636 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -581,19 +581,19 @@ static int gpio_sim_bus_notifier_call(struct notifier_block *nb, snprintf(devname, sizeof(devname), "gpio-sim.%u", simdev->id); - if (strcmp(dev_name(dev), devname) == 0) { - if (action == BUS_NOTIFY_BOUND_DRIVER) - simdev->driver_bound = true; - else if (action == BUS_NOTIFY_DRIVER_NOT_BOUND) - simdev->driver_bound = false; - else - return NOTIFY_DONE; + if (!device_match_name(dev, devname)) + return NOTIFY_DONE; - complete(&simdev->probe_completion); - return NOTIFY_OK; - } + if (action == BUS_NOTIFY_BOUND_DRIVER) + simdev->driver_bound = true; + else if (action == BUS_NOTIFY_DRIVER_NOT_BOUND) + simdev->driver_bound = false; + else + return NOTIFY_DONE; - return NOTIFY_DONE; + complete(&simdev->probe_completion); + + return NOTIFY_OK; } static struct gpio_sim_device *to_gpio_sim_device(struct config_item *item) -- 2.40.1