search for: min_t

Displaying 20 results from an estimated 457 matches for "min_t".

2014 Dec 01
2
[PATCH v7 42/46] virtio_scsi: v1.0 support
...ak; > > } > > > > - WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE); > > + WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > > > + VIRTIO_SCSI_SENSE_SIZE); > > Introduce a local variable for this? Might make this statement and the > min_t statement below easier to read. I prefer 1:1 code conversions. We can do refactorings on top. Since you mention this line as hard to read, I'll just make it > 80 chars for now, and trivial line splits can come later. OK? > > if (sc->sense_buffer) { > > memcpy(sc->sen...
2014 Dec 01
2
[PATCH v7 42/46] virtio_scsi: v1.0 support
...ak; > > } > > > > - WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE); > > + WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > > > + VIRTIO_SCSI_SENSE_SIZE); > > Introduce a local variable for this? Might make this statement and the > min_t statement below easier to read. I prefer 1:1 code conversions. We can do refactorings on top. Since you mention this line as hard to read, I'll just make it > 80 chars for now, and trivial line splits can come later. OK? > > if (sc->sense_buffer) { > > memcpy(sc->sen...
2020 May 09
1
linux-next 20200508 - build failure in kernel/resource.c w/ SPARSEMEM=n
...ebug.h:5, from ./include/linux/gfp.h:5, from ./include/linux/slab.h:15, from kernel/resource.c:17: kernel/resource.c:1654:48: error: 'MAX_PHYSMEM_BITS' undeclared (first use in this function); did you mean 'MAX_UINSN_BYTES'? end = min_t(unsigned long, base->end, (1UL << MAX_PHYSMEM_BITS) - 1); ^~~~~~~~~~~~~~~~ ./include/linux/kernel.h:848:40: note: in definition of macro '__typecheck' (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))...
2014 Nov 30
2
[PATCH v7 42/46] virtio_scsi: v1.0 support
...e_cmd(struct virtio_scsi *vscsi, void *buf) break; } - WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE); + WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > + VIRTIO_SCSI_SENSE_SIZE); if (sc->sense_buffer) { memcpy(sc->sense_buffer, resp->sense, - min_t(u32, resp->sense_len, VIRTIO_SCSI_SENSE_SIZE)); + min_t(u32, + virtio32_to_cpu(vscsi->vdev, resp->sense_len), + VIRTIO_SCSI_SENSE_SIZE)); if (resp->sense_len) set_driver_byte(sc, DRIVER_SENSE); } @@ -323,7 +326,7 @@ static void virtscsi_handle_transport_re...
2014 Nov 30
2
[PATCH v7 42/46] virtio_scsi: v1.0 support
...e_cmd(struct virtio_scsi *vscsi, void *buf) break; } - WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE); + WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > + VIRTIO_SCSI_SENSE_SIZE); if (sc->sense_buffer) { memcpy(sc->sense_buffer, resp->sense, - min_t(u32, resp->sense_len, VIRTIO_SCSI_SENSE_SIZE)); + min_t(u32, + virtio32_to_cpu(vscsi->vdev, resp->sense_len), + VIRTIO_SCSI_SENSE_SIZE)); if (resp->sense_len) set_driver_byte(sc, DRIVER_SENSE); } @@ -323,7 +326,7 @@ static void virtscsi_handle_transport_re...
2017 Oct 08
1
[RFC PATCH 16/29] clk: parse thermal policies for throttling thresholds
On 2017-09-15 — 17:11, Karol Herbst wrote: > v2: use min_t > > Signed-off-by: Karol Herbst <karolherbst at gmail.com> > --- > drm/nouveau/include/nvkm/subdev/clk.h | 2 ++ > drm/nouveau/nvkm/subdev/clk/base.c | 42 +++++++++++++++++++++++++++++++++++ > 2 files changed, 44 insertions(+) > > diff --git a/drm/nouveau/inclu...
2014 Nov 10
1
[PATCH 2/2] drm/edid: fix Baseline_ELD_Len field in drm_edid_to_eld()
...)) > return false; > > @@ -162,7 +162,7 @@ static void g4x_audio_codec_enable(struct drm_connector *connector, > len = (tmp >> 9) & 0x1f; /* ELD buffer size */ > I915_WRITE(G4X_AUD_CNTL_ST, tmp); > > - len = min_t(int, eld[2], len); > + len = min(drm_eld_size(eld) / 4, len); > DRM_DEBUG_DRIVER("ELD size %d\n", len); > for (i = 0; i < len; i++) > I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i)); > @@ -209,7 +209,7 @@ static void hsw_audio...
2017 Sep 15
0
[RFC PATCH 16/29] clk: parse thermal policies for throttling thresholds
v2: use min_t Signed-off-by: Karol Herbst <karolherbst at gmail.com> --- drm/nouveau/include/nvkm/subdev/clk.h | 2 ++ drm/nouveau/nvkm/subdev/clk/base.c | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drm/nouveau/include/nvkm/subdev/clk.h b/drm/nouveau/inclu...
2014 Dec 01
0
[PATCH v7 42/46] virtio_scsi: v1.0 support
...rtio_scsi *vscsi, void *buf) > break; > } > > - WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE); > + WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > > + VIRTIO_SCSI_SENSE_SIZE); Introduce a local variable for this? Might make this statement and the min_t statement below easier to read. > if (sc->sense_buffer) { > memcpy(sc->sense_buffer, resp->sense, > - min_t(u32, resp->sense_len, VIRTIO_SCSI_SENSE_SIZE)); > + min_t(u32, > + virtio32_to_cpu(vscsi->vdev, resp->sense_len), > + V...
2014 Dec 01
0
[PATCH v7 42/46] virtio_scsi: v1.0 support
...rtio_scsi *vscsi, void *buf) > break; > } > > - WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE); > + WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) > > + VIRTIO_SCSI_SENSE_SIZE); Introduce a local variable for this? Might make this statement and the min_t statement below easier to read. > if (sc->sense_buffer) { > memcpy(sc->sense_buffer, resp->sense, > - min_t(u32, resp->sense_len, VIRTIO_SCSI_SENSE_SIZE)); > + min_t(u32, > + virtio32_to_cpu(vscsi->vdev, resp->sense_len), > + V...
2017 Oct 22
2
[PATCH v1 1/3] virtio-balloon: replace the coarse-grained balloon_lock
...ut_of_memory() is serialized by oom_lock, I suggest using static (maybe kmalloc()ed as vb->oom_pfns[VIRTIO_BALLOON_ARRAY_PFNS_MAX]) buffer when called from out_of_memory(). > > /* We can only do one array worth at a time. */ > - num = min(num, ARRAY_SIZE(vb->pfns)); > + num = min_t(size_t, num, VIRTIO_BALLOON_ARRAY_PFNS_MAX); > > - mutex_lock(&vb->balloon_lock); > /* We can't release more pages than taken */ > - num = min(num, (size_t)vb->num_pages); > - for (vb->num_pfns = 0; vb->num_pfns < num; > - vb->num_pfns += VIRTIO_...
2017 Oct 22
2
[PATCH v1 1/3] virtio-balloon: replace the coarse-grained balloon_lock
...ut_of_memory() is serialized by oom_lock, I suggest using static (maybe kmalloc()ed as vb->oom_pfns[VIRTIO_BALLOON_ARRAY_PFNS_MAX]) buffer when called from out_of_memory(). > > /* We can only do one array worth at a time. */ > - num = min(num, ARRAY_SIZE(vb->pfns)); > + num = min_t(size_t, num, VIRTIO_BALLOON_ARRAY_PFNS_MAX); > > - mutex_lock(&vb->balloon_lock); > /* We can't release more pages than taken */ > - num = min(num, (size_t)vb->num_pages); > - for (vb->num_pfns = 0; vb->num_pfns < num; > - vb->num_pfns += VIRTIO_...
2017 Oct 22
1
[PATCH v1 1/3] virtio-balloon: replace the coarse-grained balloon_lock
...t > should > have already been inflated. But leak_balloon() finds max inflated pages from vb->num_pages, doesn't it? > > >> > >> /* We can only do one array worth at a time. */ > >> - num = min(num, ARRAY_SIZE(vb->pfns)); > >> + num = min_t(size_t, num, VIRTIO_BALLOON_ARRAY_PFNS_MAX); > >> > >> - mutex_lock(&vb->balloon_lock); > >> /* We can't release more pages than taken */ > >> - num = min(num, (size_t)vb->num_pages); > >> - for (vb->num_pfns = 0; vb->num_pfns &...
2017 Oct 22
1
[PATCH v1 1/3] virtio-balloon: replace the coarse-grained balloon_lock
...t > should > have already been inflated. But leak_balloon() finds max inflated pages from vb->num_pages, doesn't it? > > >> > >> /* We can only do one array worth at a time. */ > >> - num = min(num, ARRAY_SIZE(vb->pfns)); > >> + num = min_t(size_t, num, VIRTIO_BALLOON_ARRAY_PFNS_MAX); > >> > >> - mutex_lock(&vb->balloon_lock); > >> /* We can't release more pages than taken */ > >> - num = min(num, (size_t)vb->num_pages); > >> - for (vb->num_pfns = 0; vb->num_pfns &...
2019 Jul 07
2
[PATCH v2 3/6] drm/fb-helper: Instanciate shadow FB if configured in device's mode_config
...; > - if (!helper->fb->funcs->dirty) > - return; drm_fb_helper_dirty() is called unconditionally by drm_fb_helper_sys_imageblit() et al, so we need check with drm_fbdev_use_shadow_fb() here. > - > spin_lock_irqsave(&helper->dirty_lock, flags); > clip->x1 = min_t(u32, clip->x1, x); > clip->y1 = min_t(u32, clip->y1, y); > @@ -2166,6 +2165,16 @@ static struct fb_deferred_io drm_fbdev_defio = { > .deferred_io = drm_fb_helper_deferred_io, > }; > > +static bool drm_fbdev_use_shadow_fb(struct drm_fb_helper *fb_helper) > +{ &gt...
2019 Jul 07
2
[PATCH v2 3/6] drm/fb-helper: Instanciate shadow FB if configured in device's mode_config
...; > - if (!helper->fb->funcs->dirty) > - return; drm_fb_helper_dirty() is called unconditionally by drm_fb_helper_sys_imageblit() et al, so we need check with drm_fbdev_use_shadow_fb() here. > - > spin_lock_irqsave(&helper->dirty_lock, flags); > clip->x1 = min_t(u32, clip->x1, x); > clip->y1 = min_t(u32, clip->y1, y); > @@ -2166,6 +2165,16 @@ static struct fb_deferred_io drm_fbdev_defio = { > .deferred_io = drm_fb_helper_deferred_io, > }; > > +static bool drm_fbdev_use_shadow_fb(struct drm_fb_helper *fb_helper) > +{ &gt...
2012 Sep 25
3
[PATCH] Btrfs: limit thread pool size when remounting
...w_pool_size); - btrfs_set_max_workers(&fs_info->submit_workers, new_pool_size); - btrfs_set_max_workers(&fs_info->caching_workers, new_pool_size); - btrfs_set_max_workers(&fs_info->fixup_workers, new_pool_size); + btrfs_set_max_workers(&fs_info->submit_workers, + min_t(u64, fs_info->fs_devices->num_devices, + new_pool_size)); + btrfs_set_max_workers(&fs_info->caching_workers, min(2, new_pool_size)); + btrfs_set_max_workers(&fs_info->fixup_workers, min(1, new_pool_size)); btrfs_set_max_workers(&fs_info->endio_workers, new_pool_...
2013 Oct 25
1
[PATCH] Btrfs: stop using vfs_read in send
...+ + if (offset + len > i_size_read(inode)) { + if (offset > i_size_read(inode)) + len = 0; + else + len = offset - i_size_read(inode); + } + if (len == 0) + goto out; + + last_index = (offset + len - 1) >> PAGE_CACHE_SHIFT; + while (index <= last_index) { + unsigned cur_len = min_t(unsigned, len, PAGE_CACHE_SIZE); + + page = find_or_create_page(inode->i_mapping, index, GFP_NOFS); + if (!page) { + ret = -ENOMEM; + break; + } + + if (!PageUptodate(page)) { + btrfs_readpage(NULL, page); + lock_page(page); + if (!PageUptodate(page)) { + unlock_page(page); +...
2017 Oct 06
1
[PATCH net-next v2] vhost_net: do not stall on zerocopy depletion
...appens to correspond to VHOST_MAX_PENDING for vq->num == 256. Allow smaller fractions and ensure correctness also for much smaller values of vq->num, by testing the min() of both explicitly. See also the discussion in the second link below. Changes v1 -> v2 - replaced min with typed min_t - avoid unnecessary whitespace change Link:http://lkml.kernel.org/r/CAF=yD-+Wk9sc9dXMUq1+x_hh=3ThTXa6BnZkygP3tgVpjbp93g at mail.gmail.com Link:http://lkml.kernel.org/r/20170819064129.27272-1-den at klaipeden.com Signed-off-by: Willem de Bruijn <willemb at google.com> --- drivers/vhost/n...
2017 Oct 06
1
[PATCH net-next v2] vhost_net: do not stall on zerocopy depletion
...appens to correspond to VHOST_MAX_PENDING for vq->num == 256. Allow smaller fractions and ensure correctness also for much smaller values of vq->num, by testing the min() of both explicitly. See also the discussion in the second link below. Changes v1 -> v2 - replaced min with typed min_t - avoid unnecessary whitespace change Link:http://lkml.kernel.org/r/CAF=yD-+Wk9sc9dXMUq1+x_hh=3ThTXa6BnZkygP3tgVpjbp93g at mail.gmail.com Link:http://lkml.kernel.org/r/20170819064129.27272-1-den at klaipeden.com Signed-off-by: Willem de Bruijn <willemb at google.com> --- drivers/vhost/n...