From patchwork Thu Sep 6 11:30:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 10590465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFC8A921 for ; Thu, 6 Sep 2018 11:30:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D18F02A75E for ; Thu, 6 Sep 2018 11:30:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C59CF2A761; Thu, 6 Sep 2018 11:30:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E21A2A75E for ; Thu, 6 Sep 2018 11:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbeIFQFG (ORCPT ); Thu, 6 Sep 2018 12:05:06 -0400 Received: from nbd.name ([46.4.11.11]:56608 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbeIFQFG (ORCPT ); Thu, 6 Sep 2018 12:05:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HbiHj9GQwLr7/MGLzfoD9y28EvnVWN+5FqrXvvsFsrM=; b=aB17gOmSyUp7MEQ9dxwfhNFJBg 6Xv22jwwoT3kSXUTmQ2WpGPSyLuPmniWucDjAgWp/96RhQsY82H3glUula79UjeIstm/jD4P1Ji1D dn7TNK2m42lZHmlDIMiptUtAfVKvIz2qr10OMOSXv2W6kCdOD5QsFdWhiacKViI9gu9k=; Received: by maeck.local (Postfix, from userid 501) id 56A8837AF938; Thu, 6 Sep 2018 13:30:02 +0200 (CEST) From: Felix Fietkau To: backports@vger.kernel.org Cc: john@phrozen.org Subject: [PATCH] backports: backport sg_init_marker() Date: Thu, 6 Sep 2018 13:30:02 +0200 Message-Id: <20180906113002.59425-1-nbd@nbd.name> X-Mailer: git-send-email 2.17.0 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is used by new mt76 changes Signed-off-by: Felix Fietkau --- backport/backport-include/linux/scatterlist.h | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/backport/backport-include/linux/scatterlist.h b/backport/backport-include/linux/scatterlist.h index bfc74494..06934b6b 100644 --- a/backport/backport-include/linux/scatterlist.h +++ b/backport/backport-include/linux/scatterlist.h @@ -102,4 +102,27 @@ size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents, #endif /* LINUX_VERSION_IS_LESS(3, 11, 0) */ +#if LINUX_VERSION_IS_LESS(4, 17, 0) + +#define sg_init_marker LINUX_BACKPORT(sg_init_marker) +/** + * sg_init_marker - Initialize markers in sg table + * @sgl: The SG table + * @nents: Number of entries in table + * + **/ +static inline void sg_init_marker(struct scatterlist *sgl, + unsigned int nents) +{ +#ifdef CONFIG_DEBUG_SG + unsigned int i; + + for (i = 0; i < nents; i++) + sgl[i].sg_magic = SG_MAGIC; +#endif + sg_mark_end(&sgl[nents - 1]); +} + +#endif /* LINUX_VERSION_IS_LESS(4, 17, 0) */ + #endif /* __BACKPORT_SCATTERLIST_H */