From patchwork Wed Mar 15 21:27:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Herbszt X-Patchwork-Id: 9626689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03FA0604A9 for ; Wed, 15 Mar 2017 21:27:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF41628537 for ; Wed, 15 Mar 2017 21:27:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0CB02857B; Wed, 15 Mar 2017 21:27:58 +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=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM 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 4A6BF28537 for ; Wed, 15 Mar 2017 21:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752851AbdCOV16 (ORCPT ); Wed, 15 Mar 2017 17:27:58 -0400 Received: from mout.gmx.net ([212.227.15.18]:61442 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752585AbdCOV15 (ORCPT ); Wed, 15 Mar 2017 17:27:57 -0400 Received: from localhost ([178.12.227.126]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Lugbo-1c6ACQ0UE4-00zpOw; Wed, 15 Mar 2017 22:27:54 +0100 Date: Wed, 15 Mar 2017 22:27:43 +0100 From: Sebastian Herbszt To: James Smart Cc: linux-scsi@vger.kernel.org, Sebastian Herbszt Subject: [PATCH] efct: fix compilation warning about atomic_t usage Message-ID: <20170315222743.00004630@gmx.de> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.28; i686-w64-mingw32) MIME-Version: 1.0 X-Provags-ID: V03:K0:oQMVDYaVF9XAxi1d217xPSF8w8TcL6NfSX4seQSbi/8F51tGo62 gfB1DN4jlQ7kTw47xzJVFuKT2tUJZXw+cdFZtkhw9ahJwEkNwPXoknIJI/WFFaPP+enQwah vOp/H93WlAFMCURdrj1QFr1ZMQrMKj0pXml7qS6QZvgPrG6xxDaKoUDjlQHtgslxT2FEvWu wfbkHcaH2LnRfZjgZlfDg== X-UI-Out-Filterresults: notjunk:1; V01:K0://52ejJZAyo=:4D6PPhxs+MKBJo5Eeob3oz i6hQ4QauavmC2Bvb69JFJOaDPn4pzWRgamz9RgEpibIjr3Y3djYkR8ZSRNmXMqm7ICcfVx9Ue qgXOesCJqTTac0EujJVzUo0LGS/WLJY2zxpq+CDgE/YbjNViYHFD8UAq4dQYdJVtDLa1e1+Ij XvlM4LUyg3rlxT3uaXN1+C51+dRwpsw6xAXeFe7ilMPqPLDUkiV2Sldhde/lTWxXvv2SSOkVB d78EIpl5X8YvCWkaFoqe5uRMXPY62+oVupmIG1Bm37Mac/ScpV1ssB1/nyVdsRNhPZwJyLbHQ FyFXaJSnqu/9zFB+plcpq3DtUOmXZElmWW37gMceIt8lzLTcQWKAkEG4j63ZxTXqfJdkcOALp uN/FYMfbRJSbwZbIdQIuK4y0+X0Z1hGHdmf1ggY0eIbnmYi86btIGYbcYpg1M+fwKPNDsBBsN lT31++soajaE9q6DESkGyBZEXYKdFc1sliMHBK4S6Np4NftESH5Mmvxc5KO1sROMo3eA1U/zU rB3xAN8kl4+oxgFvLgN6D+2wfZN0vdY9pz9Pot7tI4t6eQ+ewAfjEJLoZlG7Hf+vK+09mzRcV ZGAd/MHIQrmODPGa/CaZ773DOClsQ1nJjSSrEFtt0uTayYJmB3FHfai4/FdL4nrysVzYDwjRQ Y+MKSYk47GLxn4XZi37x4Y564uMOwjgMNfXx/rKrijcHiRiTH0vGiJmAyTS7cFTeVRB20ejQk kXEw6JV7Uhb5Z+l4bsQIXOil1oESb+1WId2mR6C9XeGdZmWP4z7C+km0TxmxQogL9UOtKMLBr xZK7mfJ Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kref_read() instead of accessing the counter inside a kref. Signed-off-by: Sebastian Herbszt --- efct/efct_ddump.c | 5 ++--- efct/efct_hw.c | 6 +++--- efct/efct_io.c | 3 +-- efct/efct_lio.c | 2 +- efct/efct_scsi.c | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/efct/efct_ddump.c b/efct/efct_ddump.c index e91a838..faea9a0 100644 --- a/efct/efct_ddump.c +++ b/efct/efct_ddump.c @@ -340,8 +340,7 @@ efct_ddump_hw_io(struct efct_textbuf_s *textbuf, struct efct_hw_io_s *io) efct_ddump_value(textbuf, "tag", "0x%x", io->reqtag); efct_ddump_value(textbuf, "abort_reqtag", "0x%x", io->abort_reqtag); - efct_ddump_value(textbuf, "ref_count", "%d", - atomic_read(&io->ref.refcount)); + efct_ddump_value(textbuf, "ref_count", "%d", kref_read(&io->ref)); /* just to make it obvious, display abort bit from tag */ efct_ddump_value(textbuf, "abort", "0x%x", io->abort_in_progress); @@ -606,7 +605,7 @@ efct_ddump_hw(struct efct_textbuf_s *textbuf, struct efct_hw_s *hw, io = &hw->io[i]; if (efct_hw_is_xri_port_owned(hw, io->indicator)) { - if (atomic_read(&io->ref.refcount)) { + if (kref_read(&io->ref)) { /* only display free ios if they're active */ efct_ddump_hw_io(textbuf, io); } diff --git a/efct/efct_hw.c b/efct/efct_hw.c index e52a505..cf37dc9 100644 --- a/efct/efct_hw.c +++ b/efct/efct_hw.c @@ -3647,7 +3647,7 @@ efct_hw_io_alloc(struct efct_hw_s *hw) struct efct_hw_io_s * efct_hw_io_activate_port_owned(struct efct_hw_s *hw, struct efct_hw_io_s *io) { - if (atomic_read(&io->ref.refcount) > 0) { + if (kref_read(&io->ref) > 0) { efct_log_err(hw->os, "Bad parameter: refcount > 0\n"); return NULL; } @@ -3794,7 +3794,7 @@ int32_t efct_hw_io_free(struct efct_hw_s *hw, struct efct_hw_io_s *io) { /* just put refcount */ - if (atomic_read(&io->ref.refcount) <= 0) { + if (kref_read(&io->ref) <= 0) { efct_log_err(hw->os, "Bad parameter: refcount <= 0 xri=%x tag=%x\n", io->indicator, io->reqtag); @@ -3821,7 +3821,7 @@ efct_hw_io_free(struct efct_hw_s *hw, struct efct_hw_io_s *io) uint8_t efct_hw_io_inuse(struct efct_hw_s *hw, struct efct_hw_io_s *io) { - return (atomic_read(&io->ref.refcount) > 0); + return (kref_read(&io->ref) > 0); } /** diff --git a/efct/efct_io.c b/efct/efct_io.c index 988ec28..9ee9932 100644 --- a/efct/efct_io.c +++ b/efct/efct_io.c @@ -332,8 +332,7 @@ efct_ddump_io(struct efct_textbuf_s *textbuf, struct efct_io_s *io) efct_ddump_value(textbuf, "display_name", "%s", io->display_name); efct_ddump_value(textbuf, "node_name", "%s", io->node->display_name); - efct_ddump_value(textbuf, "ref_count", "%d", - atomic_read(&io->ref.refcount)); + efct_ddump_value(textbuf, "ref_count", "%d", kref_read(&io->ref)); efct_ddump_value(textbuf, "io_type", "%d", io->io_type); efct_ddump_value(textbuf, "hio_type", "%d", io->hio_type); efct_ddump_value(textbuf, "cmd_tgt", "%d", io->cmd_tgt); diff --git a/efct/efct_lio.c b/efct/efct_lio.c index f5c7a70..74b48ad 100644 --- a/efct/efct_lio.c +++ b/efct/efct_lio.c @@ -2276,7 +2276,7 @@ efct_scsi_tgt_ddump(struct efct_textbuf_s *textbuf, efct_ddump_value(textbuf, "se_cmd.state_active", "%d", io->tgt_io.cmd.state_active); efct_ddump_value(textbuf, "se_cmd.cmd_kref.refcount", "%d", - atomic_read(&io->tgt_io.cmd.cmd_kref.refcount)); + kref_read(&io->tgt_io.cmd.cmd_kref)); efct_ddump_value(textbuf, "se_cmd.se_cmd_flags", "%#x", io->tgt_io.cmd.se_cmd_flags); efct_ddump_value(textbuf, "se_cmd.t_state", "%d", diff --git a/efct/efct_scsi.c b/efct/efct_scsi.c index c2f5a35..ad49aa6 100644 --- a/efct/efct_scsi.c +++ b/efct/efct_scsi.c @@ -301,7 +301,7 @@ void efct_scsi_io_free(struct efct_io_s *io) { scsi_io_trace(io, "freeing io 0x%p %s\n", io, io->display_name); - efct_assert(atomic_read(&io->ref.refcount) > 0); + efct_assert(kref_read(&io->ref) > 0); kref_put(&io->ref, io->release); } @@ -2320,7 +2320,7 @@ efct_scsi_io_complete(struct efct_io_s *io) } scsi_io_trace(io, "freeing io 0x%p %s\n", io, io->display_name); - efct_assert(atomic_read(&io->ref.refcount) > 0); + efct_assert(kref_read(&io->ref) > 0); kref_put(&io->ref, io->release); }