Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1180752imc; Mon, 11 Mar 2019 08:08:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8pfqNWpbCfm/hkmWXlvfD5BZIH3YO82y4p90d/SBzHY2rmQQ329+G9BxIYf4KW456IJTD X-Received: by 2002:a17:902:b404:: with SMTP id x4mr34741618plr.232.1552316914118; Mon, 11 Mar 2019 08:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552316914; cv=none; d=google.com; s=arc-20160816; b=Fmnj/KKzhQ7aA2cPOto4OmhOjD9tHsXJahiNwhPwbYuDO4eEatFJPqJaNxsfOzmRn4 fsQHalul4+9v4hh03pNOfWA/L5qlFD0z7OKLTm2jesoOF27+HeAPjDdGudqW0ClUQuTX iuoWS7ZrlUnzGl48o5vkJfeCD/qOVNSQp1PBpBCdaeNQIBFf2kPS/p4QEHhn2NLeERKN I67X1loVk6XvPhA3KyEAUSnRemSDQdeN9kBn0vgjAnszKKE+pDeNaIRHeYKrkpTjhH0y NXANmuUo23rrd2kRb63MpGtbk1LoQqWoRZ7Vr0qSJYx5KHrb6tjdVg/NPLm5E3Agapgb YeEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=8JhRdJRNHWZZlJcrBLvx7nz+wU7UBcbNikrqEH9nDOw=; b=p22QEh8hBGhxDywctE3JDw8a9QmyNp5k2OcSHVmpdU5EMQXFKj3YZG37xB96Xo3kXh PW65SYb7P/LEOvaXgA4/j05RRWU/JnUsJVqmEzrm+EAF65nWFn1pcBg+haXDpBzVXPD8 6wdEdnV0nfEG6ZvWXnJB/6bZGpeCOqN0uquYNjuEAj0fpgKdVp8nTuPwk1ZhweFizB3Y DGHD9zquavEARyvwi/Y7XqxKKKd/Dk5zWBf6h3yiG2ycmYfJJfcu91renwnJXvsWlbB1 RMnbjlOAD68BoQOYHM2gfk9X2IddgE8Dgp68OWtRC/e/3atp6Lu47sIBa0D4nFUN9NGC EW8w== ARC-Authentication-Results: i=1; mx.google.com; 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 64si2282061plk.279.2019.03.11.08.08.17; Mon, 11 Mar 2019 08:08:34 -0700 (PDT) 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; 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 S1727066AbfCKPFr (ORCPT + 99 others); Mon, 11 Mar 2019 11:05:47 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:44771 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbfCKPFr (ORCPT ); Mon, 11 Mar 2019 11:05:47 -0400 Received: by mail-qt1-f194.google.com with SMTP id d2so5370734qti.11 for ; Mon, 11 Mar 2019 08:05:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8JhRdJRNHWZZlJcrBLvx7nz+wU7UBcbNikrqEH9nDOw=; b=WZFyACqZLaKRrTnE1CRq2kOZ0EHMsWR90ZSRE7L4FO8SU9HshWfmpqUj766xKGrSgq Zyxx2L55zZ0YlGurj2YXrc68c9GsieCxfWRjSX8ZCDitzDQbDO8vOVJL/8fpQ/XFNfNI 4gTAyZ7l3zqrOf6B1b7e68oHvL7kY7iA59rF34dNFp38sJ/bPBR+pViohXl7Pxlztg9l GeytQv1MnJLvBMmSqX8OTvT3u9jnwKKRjf1Z+I/QgvRkyML9LcSxl9n/F2x1iINNEP5r ormTXovM9Rl4WGVQ5qGp0ZFiZnLhEEgGznC0XAWlFeN6XBcg5up+wtjn1U4J0ipo0jKG 7qfQ== X-Gm-Message-State: APjAAAVXsBgpXtTL2ZanGKWtpejm0NIkeV5kzHKFvOShAdo5mcGXEV9F dvppFIr0U1ckJZ/bzZUnlWndk5NsaJS0ubM5HtqudyGO X-Received: by 2002:a0c:c781:: with SMTP id k1mr3051925qvj.180.1552316746114; Mon, 11 Mar 2019 08:05:46 -0700 (PDT) MIME-Version: 1.0 References: <20190308123432.20520-1-saumah@gmail.com> In-Reply-To: <20190308123432.20520-1-saumah@gmail.com> From: Arnd Bergmann Date: Mon, 11 Mar 2019 16:05:28 +0100 Message-ID: Subject: Re: [PATCH 2/4] Add SUNIX Multi-I/O card device driver To: Morris Ku Cc: gregkh , morris_ku@sunix.com, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 8, 2019 at 1:34 PM Morris Ku wrote: > > Driver for SUNIX Multi-I/O card. > Based on driver/char/serial.c by Linus Torvalds, Theodore Ts'o. > > SUNIX serial card designed with SUNIX UART controller and > compatible with 16C950 UART specification. > > Signed-off-by: Morris Ku Hi Morris, Thanks for your submission! Enrico has already replied with the most important comments. Here are just some more high-level thoughts from me: * We want the functionality to be present in subsystem specific standalone drivers, i.e. drivers/tty/serial/, drivers/parport/, drivers/gpio etc, as Enrico said * It looks like you may need some glue logic to tie those together for the multi-I/O cards. This is a bit tricky but doable. Many other multi-I/O cards simply appear as a set of PCI functions that are connected to a single slot. This is the ideal case, as you can simply have one driver per function and they do not have to be linked together at all. If this is not possible, what you may need to do here is to have a small driver in drivers/mfd/ that handles the PCI function and creates platform_device instances that the individual drivers can bind to. Have a look at the various files in drivers/mfd that come with a 'struct pci_driver' instance to see what I mean. * In any way, new drivers must probing according to our driver module if possible. This means you should have a 'pci_driver' structure listing the possible vendor/device ID combinations, and register that with 'module_pci_driver'. If you use mfd_cell to register sub-drivers, use 'module_platform_driver' to register the driver for those. * do not implement your own ioctl handlers. If you need a custom interface for something hardware specific, split that out into a separate patch, so the base support can be reviewed independently. * If the functions (in particular serial and parport) have a similar register layout to existing drivers, try to reuse the existing code and extend it, rather than duplicating the implementation. Arnd