From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 ABBF733A00C for ; Fri, 29 May 2026 10:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780049202; cv=none; b=HheI9F5cjaFtujfYqEYmurlA+F7fOM8XkG3WaAv6ZKh9YVznWCkf9blKFh6C2MNrMk/ODrSkTu/AXYK1Sda0Rdqpc2cdxx0qxbkWtX2vm7KMI26ES/57r1+RzgzFCKbR3LZ6WyBYZUvLgs3HMkVawZXXDVXAVD65Zk3rSkHDBrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780049202; c=relaxed/simple; bh=QfUzfWoOXiL72zMeBuDp3Dcw59J9gT9O6isLKmJ9bhA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dMqneZpa3BEeLXXumiL1WQqXrWMoSucyUjx7CqN4wdMbMBT3aFK15zmIDp+99V0ZepPZ/jJXHux83GIzGapcExp2CXUPEtzUvAkN1Cy/ExiAGO1Y2GWCjbtOI+RAt2Y55j1BUBIuY6nqInROxvF+Xa1mUmGktJlGOFebqdjeIc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=AyutMZDc; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="AyutMZDc" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-49041fb8c23so59092445e9.0 for ; Fri, 29 May 2026 03:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780049199; x=1780653999; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=j+L6ikOeUYGfi5WR8itKcJmTqkRNrSsSHJL9g1s5eJo=; b=AyutMZDccvRoFZ1y7zVEl0R6T9NAju4rjQBt4rH7jCRKzPwLnlc5k0kl1ijDWaGvHl iAZRLLwy47EX2uE4gz6/EtGXyABqZQJsLNx6irbfNUD+iOhbtx+jAhi+JzfiZV5WfW8M 2+lG7u4QQ8iFZcCULlvNkx8zNQh5tbjqfBJvHyWhJV/cK3CCxy0KPpm2S7oqZxtPe6qY u3F2hAoCOdiG+Av+zlxTdE2bMBKf0FopjLQh+I8xEWadctjFID58LeCn9wBARmvh0ASQ v4p3HmCC3+SS90O1H24/Bi6SW1YZfsJnADdkHvYSrXGMWy3SOtEzf+DJVXtEFwI3P6yj UkiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780049199; x=1780653999; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j+L6ikOeUYGfi5WR8itKcJmTqkRNrSsSHJL9g1s5eJo=; b=KwzkciQL68pKqgzi6o1T0T3JFclLapcNHpIlKRkHlIMLOl1mBdC0N5hSN9ZYqLDAQD d+ud+KIbRUqVWsicgwZKjE4DfLDUmQQChNNoEamQcpoGQqMUwTnR2MhQKdBbfv6jxcUO hpUEBF1IVinZNzRYNPwkS/TTEDFJsQArZPKnsPJarukjSPA74QN4rUt0lcmGYfEd1202 EbhT0DQ+c9AhrCWz9lVi9ha0p3Xnpa9wYncPCppCm/ln0WUEzRBnppihING0Buaeo1jt f1VhUR1ERWH0NTTlKNWaqFRVeuraBfX1xSbPXq61EfRUzZkDVovntz9N3Kz9QotN85Mg II9Q== X-Forwarded-Encrypted: i=1; AFNElJ/LYFzWSnx3Eslm+vBJSNPpNrl+cJBEu3Jl6T/UhiW9y3aGHKY3wsdHcLv3ydEUUrjYUUaLrMBcHvo1lQ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxEiuFEDtnhlk29jy8Llw4PrMAxCTneRSe6QHbWodZVagAtVU63 2wHMaDZaJaUbDkQ7wX+nzgRsfXHr4qDwpcJlNZTPc7FzYJoiiYgJSwmzN4nrtmSC+jM= X-Gm-Gg: Acq92OHs3mLTPebQmg2Nbo6tjbRt4LZES8e1AQEef5JQXnCta+gtw3tRgOkZ1G4popu RK9fVsDaBQF+Ztg10MbQh8rj9FR2kCfoZV9qYQ2gu4q2psUjf9qYMzhBD8AnkHqS82GgByotALt LSqjZpbck1rvVLuIQr/h65KP/Xq9NUDvNOW8lEGJaFWv6Ebv9SJMwL7TGmS/Kz2igeHj3FdOxBs XYW7LDBdTNhrFHglL5MWY4nzPxj7rSjzbXSMnEPuT8CJO2BExd9i6HsflEtTjfRwG9musniIWZe a4fxOcVJPllH7ndupcLh5Iv3KEdj2kQp0AEwQZaSJ6pJOVBO8XMXFulXJlvHN9jNXej+vpgXQu2 F1TwpZsdfz8+ObzzefgX5bEhjfCFxPFdHsNSY6SGbxQTgKdT/N4FyzhrvgB48vI1IOj3Pp6dmSj gvoA6g6KNcMRkIZ8rtupaO/0QiLA== X-Received: by 2002:a05:600c:4a11:b0:489:e696:8362 with SMTP id 5b1f17b1804b1-4909c08b0bfmr23524805e9.13.1780049199028; Fri, 29 May 2026 03:06:39 -0700 (PDT) Received: from pathway ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4909ca6575csm56383335e9.4.2026.05.29.03.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 03:06:38 -0700 (PDT) Date: Fri, 29 May 2026 12:06:36 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Chris Down , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/9] printk: Separate code for adding/updating preferred console metadata Message-ID: References: <20260423130015.85175-1-pmladek@suse.com> <20260423130015.85175-4-pmladek@suse.com> <87o6ih6kfh.fsf@jogness.linutronix.de> <87lddl6k2l.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lddl6k2l.fsf@jogness.linutronix.de> On Fri 2026-05-15 12:36:58, John Ogness wrote: > On 2026-05-15, John Ogness wrote: > >> + if (!pc->name[0]) { > >> + strscpy(pc->name, name); > >> + pc->index = idx; > > > > Here is the copied code. This block is about setting the name. > > > >> + } else if (strcmp(pc->name, name) != 0 || pc->index != idx) { > >> + pr_err("Updating a preferred console with an invalid name or index: %s%d vs. %s%d\n", > >> + pc->name, pc->index, name, idx); > >> + return -EINVAL; > >> + } > >> + } > > > > I would put the index setting here as it is relevant regardless of how > > the devname or name was updated. > > > > pc->index = idx; > > Ah, I guess you only wanted to update @index if it is a new entry > (because otherwise it will already have the value of @idx). Exactly ;-) > If you want to keep the index setting in the devname and name blocks, > maybe just adding a comment to clarify it is a new entry: > > if (!pc->devname[0]) { > /* This is a new entry */ > strscpy(pc->devname, devname); > pc->index = idx; > > ... > > if (!pc->name[0]) { > /* This is a new entry */ > strscpy(pc->name, name); > pc->index = idx; I am going to add the comments in v3. Best Regards, Petr