summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_device.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-11-13 22:25:38 +0100
committerTony Lindgren <tony@atomide.com>2012-11-13 22:25:38 +0100
commit89ab216b33ba9405880fd3d89531305a931bc70f (patch)
tree8f6428ce51ecaed6f6e1379c036dbe341eb71e34 /drivers/target/target_core_device.c
parentMerge tag 'omap-cleanup-b2-for-3.8' of git://git.kernel.org/pub/scm/linux/ker... (diff)
parentMerge tag 'for_3.8-pm-voltage' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
downloadlinux-89ab216b33ba9405880fd3d89531305a931bc70f.tar.xz
linux-89ab216b33ba9405880fd3d89531305a931bc70f.zip
Merge branch 'omap-for-v3.8/pm' into omap-for-v3.8/clock
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r--drivers/target/target_core_device.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 8d774da16320..9abef9f8eb76 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev)
static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size)
{
- u32 tmp, aligned_max_sectors;
+ u32 aligned_max_sectors;
+ u32 alignment;
/*
* Limit max_sectors to a PAGE_SIZE aligned value for modern
* transport_allocate_data_tasks() operation.
*/
- tmp = rounddown((max_sectors * block_size), PAGE_SIZE);
- aligned_max_sectors = (tmp / block_size);
- if (max_sectors != aligned_max_sectors) {
- printk(KERN_INFO "Rounding down aligned max_sectors from %u"
- " to %u\n", max_sectors, aligned_max_sectors);
- return aligned_max_sectors;
- }
+ alignment = max(1ul, PAGE_SIZE / block_size);
+ aligned_max_sectors = rounddown(max_sectors, alignment);
+
+ if (max_sectors != aligned_max_sectors)
+ pr_info("Rounding down aligned max_sectors from %u to %u\n",
+ max_sectors, aligned_max_sectors);
- return max_sectors;
+ return aligned_max_sectors;
}
void se_dev_set_default_attribs(