Commit 4dea97f8 authored by Yury Norov's avatar Yury Norov
Browse files

lib/bitmap: change type of bitmap_weight to unsigned long



bitmap_weight() doesn't return negative values, so change it's type
to unsigned long. It may help compiler to generate better code and
catch bugs.

Signed-off-by: default avatarYury Norov <yury.norov@gmail.com>
parent e2863a78
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4997,7 +4997,7 @@ static int setup_resources(struct udma_dev *ud)
	switch (ud->match_data->type) {
	case DMA_TYPE_UDMA:
		dev_info(dev,
			 "Channels: %d (tchan: %u, rchan: %u, gp-rflow: %u)\n",
			 "Channels: %d (tchan: %lu, rchan: %lu, gp-rflow: %lu)\n",
			 ch_count,
			 ud->tchan_cnt - bitmap_weight(ud->tchan_map,
						       ud->tchan_cnt),
@@ -5008,7 +5008,7 @@ static int setup_resources(struct udma_dev *ud)
		break;
	case DMA_TYPE_BCDMA:
		dev_info(dev,
			 "Channels: %d (bchan: %u, tchan: %u, rchan: %u)\n",
			 "Channels: %d (bchan: %lu, tchan: %lu, rchan: %lu)\n",
			 ch_count,
			 ud->bchan_cnt - bitmap_weight(ud->bchan_map,
						       ud->bchan_cnt),
@@ -5019,7 +5019,7 @@ static int setup_resources(struct udma_dev *ud)
		break;
	case DMA_TYPE_PKTDMA:
		dev_info(dev,
			 "Channels: %d (tchan: %u, rchan: %u)\n",
			 "Channels: %d (tchan: %lu, rchan: %lu)\n",
			 ch_count,
			 ud->tchan_cnt - bitmap_weight(ud->tchan_map,
						       ud->tchan_cnt),
+1 −1
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev)
			set_bit(i, adev->gfx.mec.queue_bitmap);
	}

	dev_dbg(adev->dev, "mec queue bitmap weight=%d\n", bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES));
	dev_dbg(adev->dev, "mec queue bitmap weight=%ld\n", bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES));
}

void amdgpu_gfx_graphics_queue_acquire(struct amdgpu_device *adev)
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ static void print_power_domains(struct i915_power_domains *power_domains,
						     power_domains);
	enum intel_display_power_domain domain;

	drm_dbg(&i915->drm, "%s (%d):\n", prefix, bitmap_weight(mask->bits, POWER_DOMAIN_NUM));
	drm_dbg(&i915->drm, "%s (%ld):\n", prefix, bitmap_weight(mask->bits, POWER_DOMAIN_NUM));
	for_each_power_domain(domain, mask)
		drm_dbg(&i915->drm, "%s use_count %d\n",
			intel_display_power_domain_str(domain),
+1 −1
Original line number Diff line number Diff line
@@ -363,7 +363,7 @@ void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p)
	}

	drm_printf(p, "TOTAL:\t%d\t(of %d)\n", total, smp->blk_cnt);
	drm_printf(p, "AVAIL:\t%d\n", smp->blk_cnt -
	drm_printf(p, "AVAIL:\t%ld\n", smp->blk_cnt -
			bitmap_weight(state->state, smp->blk_cnt));

	if (drm_can_sleep())
+1 −1
Original line number Diff line number Diff line
@@ -3946,7 +3946,7 @@ static ssize_t domains_used_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{
	struct intel_iommu *iommu = dev_to_intel_iommu(dev);
	return sprintf(buf, "%d\n", bitmap_weight(iommu->domain_ids,
	return sprintf(buf, "%ld\n", bitmap_weight(iommu->domain_ids,
						  cap_ndoms(iommu->cap)));
}
static DEVICE_ATTR_RO(domains_used);
Loading