Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8475720imu; Thu, 15 Nov 2018 12:12:09 -0800 (PST) X-Google-Smtp-Source: AJdET5cniQOtpdbas7vVlEbcUZRZ8HFZPdgzt3NI78kmMWCAGwE+8xYvQLwDQ9MtHfmraDmLy3BD X-Received: by 2002:a65:5c4b:: with SMTP id v11mr7064691pgr.333.1542312729572; Thu, 15 Nov 2018 12:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542312729; cv=none; d=google.com; s=arc-20160816; b=QApeo2wB7JdMmqOuRIgOtyiR5nMw0krppnotxkgSVjYWZW9QpF1rDoL7/KY4fnl3JE OuYgfFhPN/xx2YA17p9tseDP1zS2WPn8niu7qMnbEhzc5oZ0nWYTUbmcQ2DcC2HIj0eU mOZdrxF8URLwa614lTmfG2QonctYMX8+bw5ZZg16aCIlrHZcpQGzNVSz6ScuPLRRuULT RAAhJ3ztS0DVuhQaQ8VHAgH2cB0K4I0gOS1+Izt3xnUann6D/CiId69Gy3FDZNEt9N12 2BseVEAd9k+hcpzc0bsiWRTDywTZF1eAT7+wq2u8GVoE5GfcjpFRx3r/szDJ+j77Gq76 WOAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:date:from:dkim-signature; bh=vAevjgMoXGxymF5+bZHqF1QU7oU437ycHKufbSxDchc=; b=mhsoDT/rt0hRxAwK1NV6ummxea7CcJb0vE84SdrqeC1mF0OZNX+8jxK1wyp85tC85t AMUJTNqoRJSLNksBS9tqAQKA1g8y1h6QOwzhjuRJbGbu2RlDt8v+fVZf8dyUk8dYHub3 r8IRENPVNV56pWR57yrrcjcrn47SpUEbe++6CwvRWgaWDixeCIkfKRb7sBVUnSBjzFJQ tKNEaSYvSsNScR/j6zPjEd+TmYiVqHAKfa4kynRU3AATDTTwy/OksWbehPLxTt6e3TSR h0SwD3zRr+oLzqupTwErfwrwOgA8mrZ7epYOvt1vfxQBGOeTXBSik6iMKCypxxGGDVBc Uaqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=MjtR7bSI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si30040208pld.137.2018.11.15.12.11.54; Thu, 15 Nov 2018 12:12:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=MjtR7bSI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725890AbeKPGUa (ORCPT + 99 others); Fri, 16 Nov 2018 01:20:30 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46326 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeKPGUa (ORCPT ); Fri, 16 Nov 2018 01:20:30 -0500 Received: by mail-pl1-f196.google.com with SMTP id t13so7019155ply.13 for ; Thu, 15 Nov 2018 12:11:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=vAevjgMoXGxymF5+bZHqF1QU7oU437ycHKufbSxDchc=; b=MjtR7bSIuPtEtgHY551xH2t3SmmeidBvI7uWV6WYZq6/A5GnnE0kTa0w8/4fsfKhLK +SK+pRkAKNDBbwCH4DjIy4oaA2IIDcWoN3inYiOM7+Rsx6nu3+4Sr1ohhwaA3CGXJaaQ H6vcjmvIJwcQJWfxKgXxDcI5/NKtrzCUgZYbXpBtzgLbqnhoxP8dv5bJAl8V40lo9BvR 6vFEfZugjyArYGClH8wAAWzluwJbZZqOwEOJekQurtM4xR6RsXhOvwL8a4WcQtwtiEsJ gs+/0iA6a4kclql6uF2KKsGKgn6yIss7hET7/m1/FgP2G0ytug8/THM9IQ283/yJacCt xN8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=vAevjgMoXGxymF5+bZHqF1QU7oU437ycHKufbSxDchc=; b=IeB8hdS6tDl6ymUTyRvqvUCXBDE9f2E6bjUOFdYaLP6OiUhtuH1korNUmagobIjA7q J7cp3EeTmoeoKbThazjl99lji+Okk2h+BJPPzrHfJtZKPLF0B4VArOTqovenm9yHosDf 8OlHWaB1tcoSH+43/vc/8UQYtMoGdc2+Rxl2iLvNqQU8ojJXCV8wsKMQbB9IZLTuC6kA UiDdEmCcQH0rzqrd/po+EjKok1yU6djcvdw1JUsmZwQtDtZxNnRIfaoqm8ee0nTlKjsR 5F0GUq+12A1HrZDTKFnX8alrXrpZbfMsocuWi2yrk4mPY8NxlCbM9olNBacg9W6aMeWr yhLA== X-Gm-Message-State: AGRZ1gLqf3u1QiZoWL/xpmnac76yqIuy9Vg4Ga7SJ2uW4Ly7ae7eXzLO EveuRk1aodX03iXCdTiYc4crQQ== X-Received: by 2002:a17:902:9045:: with SMTP id w5mr4013858plz.32.1542312674330; Thu, 15 Nov 2018 12:11:14 -0800 (PST) Received: from localhost ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id i189-v6sm49605953pfc.16.2018.11.15.12.11.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 12:11:13 -0800 (PST) From: Paul Walmsley X-Google-Original-From: Paul Walmsley Date: Thu, 15 Nov 2018 12:11:12 -0800 (PST) To: Emil Renner Berthing cc: paul.walmsley@sifive.com, linux-serial@vger.kernel.org, paul@pwsan.com, Palmer Dabbelt , wesley@sifive.com, jslaby@suse.com, Linux Kernel Mailing List , julia.lawall@lip6.fr, Greg Kroah-Hartman , linux-riscv@lists.infradead.org Subject: Re: [PATCH v3 2/2] tty: serial: add driver for the SiFive UART In-Reply-To: Message-ID: References: <20181020101045.15991-1-paul.walmsley@sifive.com> <20181020101045.15991-3-paul.walmsley@sifive.com> User-Agent: Alpine 2.21.9999 (DEB 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Emil, On Thu, 15 Nov 2018, Emil Renner Berthing wrote: > Thanks for the patch! Thanks for your comments! > On Sat, 20 Oct 2018 at 12:12, Paul Walmsley wrote: > >> +static int __init sifive_serial_console_setup(struct console *co, char *options) > > Unfortunately I get this error unless I remove the __init: > ... > GEN .version > CHK include/generated/compile.h > AR built-in.a > LD vmlinux.o > MODPOST vmlinux.o > WARNING: vmlinux.o(.data+0x14e48): Section mismatch in reference from > the variable .LANCHOR0 to the function > .init.text:sifive_serial_console_setup() > The variable .LANCHOR0 references > the function __init sifive_serial_console_setup() > If the reference is valid then annotate the > variable with __init* or __refdata (see linux/init.h) or name the variable: > *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console > > FATAL: modpost: Section mismatches detected. > Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them. > make[1]: *** [scripts/Makefile.modpost:98: vmlinux.o] Error 1 > make: *** [Makefile:1040: vmlinux] Error 2 > > I have > CONFIG_SERIAL_CORE=y > CONFIG_SERIAL_CORE_CONSOLE=y > CONFIG_SERIAL_SIFIVE=y > CONFIG_SERIAL_SIFIVE_CONSOLE=y > and it happens both on v4.20-rc2 and v4.19. > Without the __init everything seems to work fine though. Thanks for the report. There are some patches to address this: https://lore.kernel.org/lkml/20181115005602.30746-1-paul.walmsley@sifive.com/ >> +#else >> + >> +#define SIFIVE_SERIAL_CONSOLE NULL >> + >> +static inline void __ssp_add_console_port(struct sifive_serial_port *ssp) >> +{} >> +static void __ssp_remove_console_port(struct sifive_serial_port *ssp) >> +{} > > Missing "inline"? That is indeed an error, but the other way around: I didn't mean for that inline to be there. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst I've dropped the inline; thanks for pointing the situation out. >> +static int __init sifive_serial_init(void) >> +{ >> + int r; > > If you're sending a v4 anyway, here and in the the probe function > using int ret; for this kind of variable is a common idiom and > hence easier to read. Precedent exists in the kernel for using "r" as a return value also: $ fgrep -r 'return r;' linux/ 4491 $ which probably traces back ultimately to Torvalds' guidance to keep variable names short: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst#n284 But I am not religious about it. So if this is a big deal for you, I guess reply back, and it can be changed. - Paul